1212-export ([create_account /1 ]).
1313-export ([create_account /2 ]).
1414-export ([collect_account_map /1 ]).
15- -export ([collect_merchant_account_map /3 ]).
15+ -export ([collect_merchant_account_map /4 ]).
1616-export ([collect_provider_account_map /4 ]).
1717-export ([collect_system_account_map /4 ]).
1818-export ([collect_external_account_map /4 ]).
2727-include_lib (" damsel/include/dmsl_accounter_thrift.hrl" ).
2828
2929-type amount () :: dmsl_domain_thrift :'Amount' ().
30+ -type currency () :: dmsl_domain_thrift :'CurrencyRef' ().
3031-type currency_code () :: dmsl_domain_thrift :'CurrencySymbolicCode' ().
3132-type account_id () :: dmsl_accounter_thrift :'AccountID' ().
3233-type plan_id () :: dmsl_accounter_thrift :'PlanID' ().
3738-type thrift_account () :: dmsl_accounter_thrift :'Account' ().
3839
3940-type payment () :: dmsl_domain_thrift :'InvoicePayment' ().
40- -type party () :: dmsl_domain_thrift :'Party ' ().
41- -type shop () :: dmsl_domain_thrift :'Shop ' ().
41+ -type party () :: dmsl_domain_thrift :'PartyConfig ' ().
42+ -type shop () :: dmsl_domain_thrift :'ShopConfig ' ().
4243-type route () :: hg_route :payment_route ().
4344-type payment_institution () :: dmsl_domain_thrift :'PaymentInstitution' ().
4445-type provider () :: dmsl_domain_thrift :'Provider' ().
@@ -99,7 +100,7 @@ create_account(CurrencyCode, Description) ->
99100
100101-spec collect_account_map (collect_account_context ()) -> map ().
101102collect_account_map (#{
102- payment := Payment ,
103+ payment := # domain_InvoicePayment { cost = # domain_Cash { currency = Currency }} = Payment ,
103104 party := Party ,
104105 shop := Shop ,
105106 route := Route ,
@@ -108,17 +109,20 @@ collect_account_map(#{
108109 varset := VS ,
109110 revision := Revision
110111}) ->
111- Map0 = collect_merchant_account_map (Party , Shop , #{}),
112+ Map0 = collect_merchant_account_map (Currency , Party , Shop , #{}),
112113 Map1 = collect_provider_account_map (Payment , Provider , Route , Map0 ),
113114 Map2 = collect_system_account_map (Payment , PaymentInstitution , Revision , Map1 ),
114115 collect_external_account_map (Payment , VS , Revision , Map2 ).
115116
116- -spec collect_merchant_account_map (party (), shop (), map ()) -> map ().
117- collect_merchant_account_map (# domain_Party {id = PartyID }, # domain_Shop {id = ShopID , account = MerchantAccount }, Acc ) ->
117+ -spec collect_merchant_account_map (currency (), party (), shop (), map ()) -> map ().
118+ collect_merchant_account_map (
119+ Currency , # domain_PartyConfig {id = PartyID }, # domain_ShopConfig {id = ShopID , currency_configs = Configs }, Acc
120+ ) ->
121+ #{Currency := Config } = Configs ,
118122 Acc #{
119123 merchant => {PartyID , ShopID },
120- {merchant , settlement } => MerchantAccount # domain_ShopAccount .settlement ,
121- {merchant , guarantee } => MerchantAccount # domain_ShopAccount .guarantee
124+ {merchant , settlement } => Config # domain_ShopCurrencyConfig .settlement ,
125+ {merchant , guarantee } => Config # domain_ShopCurrencyConfig .guarantee
122126 }.
123127
124128-spec collect_provider_account_map (payment (), provider (), route (), map ()) -> map ().
0 commit comments