transactions_group_by_proforma = Transaction.select('transaction_id as id, count(proforma_id) as proforma_count').group('transaction_id')
transactions = Transaction.where(transaction_id: transactions_group_by_proforma.map(&:id)).where.not(proforma_id: nil).group_by(&:transaction_id)
transactions_group_by_proforma.each do |parent_transaction|
puts "Root: #{parent_transaction.id}, Proforma: #{parent_transaction.proforma_count}"
puts "--- Childs ---"
if transactions[parent_transaction.id.to_i].present?
transactions[parent_transaction.id.to_i].each.with_index(1) do |child_transaction, index|
puts "#{index}: #{child_transaction.proforma_no}"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find the service | |
mekari_pay_addons_service = Service.find_by(name: "Jurnal Pay") | |
# find the related invoices | |
invoices = Invoice.where(service: service, status: %i[unpaid, expired], enable_manual_transfer: false) | |
# enable manual transfer for all the related invoices | |
invoices.update_all(enable_manual_transfer: true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class Storage | |
class InvalidRecord | |
end | |
def initialize | |
@storages = [] | |
end |
# frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require 'benchmark/ips'
require File.expand_path('../config/environment', __dir__)
require 'rspec/rails'
RSpec::Core::Runner.autorun
# lib/credit_card__payment_payload.rb
class CreditCardPaymentPayload
def initialize(payment)
end
def record
end
def to_json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.fontFamily": "Jetbrains Mono, Dank Mono, Menlo, Monaco, 'Courier New', monospace", | |
"workbench.iconTheme": "material-icon-theme", | |
"workbench.activityBar.visible": false, | |
"workbench.editor.showTabs": false, | |
"workbench.statusBar.visible": false, | |
"editor.minimap.enabled": false, | |
"window.zoomLevel": 1, | |
"editor.tabSize": 2, | |
"ruby.useLanguageServer": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected_response = { | |
data: [ | |
{ | |
start_date: '2020-01-01', | |
end_date: '2020-01-01', | |
total_items: 1, | |
amount: 40_000, | |
amount_formatted: 'Rp 40.000,00' | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prolog: | |
# | |
# In default rails testing setup we actually will running assets compiling in every thread | |
# In this case, we doing 8 times compiling assets (becuase we use parallel_test for 8 threads). | |
# And in some cases (thread) our compiling doesn't work as expected, so, this module will help us | |
# to only run assets compiling at once. | |
# | |
# This code was taken from: | |
# https://makandracards.com/makandra/46247-how-to-make-webpacker-compile-once-for-parallel-tests-and-only-if-necessary | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Web | |
module JurnalPay | |
module Authenticable | |
extend ActiveSupport::Concern | |
included do | |
helper_method :current_jurnal_user | |
def require_authentication | |
access_token = params[:access_token] || session[:jurnal_pay_access_token] |