~singpolyma/sgx-jmp

ref: 8dd92b96258d14d431e9966d0534631c7fdc0214 sgx-jmp/lib/financial_info.rb -rw-r--r-- 701 bytes
8dd92b96Stephen Paul Weber Merge branch 'admin-actions' 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require "value_semantics/monkey_patched"
require_relative "customer_finacials"
require_relative "payment_methods"

class AdminFinancialInfo
	value_semantics do
		transactions ArrayOf(CustomerFinancials::TransactionInfo)
		declines Integer
		btc_addresses ArrayOf(String)
		payment_methods PaymentMethods
	end

	def self.for(customer)
		EMPromise.all([
			customer.transactions, customer.declines,
			customer.payment_methods, customer.btc_addresses
		]).then do |transactions, declines, payment_methods, btc_addresses|
			new(
				transactions: transactions,
				declines: declines,
				payment_methods: payment_methods, btc_addresses: btc_addresses
			)
		end
	end
end