1# frozen_string_literal: true
2
3require "value_semantics/monkey_patched"
4
5class AdminFinancialInfo
6 value_semantics do
7 transactions ArrayOf(CustomerFinancials::TransactionInfo)
8 declines Integer
9 btc_addresses ArrayOf(String)
10 payment_methods PaymentMethods
11 end
12
13 def self.for(customer)
14 EMPromise.all([
15 customer.transactions, customer.declines,
16 customer.payment_methods, customer.btc_addresses
17 ]).then do |transactions, declines, payment_methods, btc_addresses|
18 new(
19 transactions: transactions,
20 declines: declines,
21 payment_methods: payment_methods, btc_addresses: btc_addresses
22 )
23 end
24 end
25end