Skip to content

Commit c5761bc

Browse files
committed
Merge branch 'master' into epic/dmt-client-v2
2 parents fced522 + 0ba898c commit c5761bc

41 files changed

Lines changed: 896 additions & 5907 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/erlang-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
thrift-version: ${{ needs.setup.outputs.thrift-version }}
3939
run-ct-with-compose: true
4040
use-coveralls: true
41-
cache-version: v7
41+
cache-version: v9
4242
upload-coverage: false

apps/hellgate/include/customer_events.hrl

Lines changed: 0 additions & 82 deletions
This file was deleted.

apps/hellgate/include/domain.hrl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@
5151
{payment_resource, #domain_PaymentResourcePayer{}}
5252
).
5353

54-
-define(customer_payer(CustomerID, CustomerBindingID, RecurrentPaytoolID, PaymentTool, ContactInfo),
55-
{customer, #domain_CustomerPayer{
56-
customer_id = CustomerID,
57-
customer_binding_id = CustomerBindingID,
58-
rec_payment_tool_id = RecurrentPaytoolID,
59-
payment_tool = PaymentTool,
60-
contact_info = ContactInfo
61-
}}
62-
).
63-
64-
-define(customer_payer(), {customer, #domain_CustomerPayer{}}).
65-
6654
-define(recurrent_payer(PaymentTool, Parent, ContactInfo),
6755
{recurrent, #domain_RecurrentPayer{
6856
payment_tool = PaymentTool,

apps/hellgate/include/hg_invoice_payment.hrl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
refunds = #{} :: #{hg_invoice_payment:refund_id() => hg_invoice_payment:refund_state()},
2323
chargebacks = #{} :: #{hg_invoice_payment_chargeback:id() => hg_invoice_payment_chargeback:state()},
2424
adjustments = [] :: [hg_invoice_payment:adjustment()],
25-
recurrent_token :: undefined | hg_recurrent_paytool:token(),
25+
recurrent_token :: undefined | dmsl_domain_thrift:'Token'(),
2626
opts :: undefined | hg_invoice_payment:opts(),
2727
repair_scenario :: undefined | hg_invoice_repair:scenario(),
2828
capture_data :: undefined | hg_invoice_payment:capture_data(),

apps/hellgate/include/recurrent_payment_tools.hrl

Lines changed: 0 additions & 127 deletions
This file was deleted.

apps/hellgate/src/hellgate.erl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ stop() ->
3737
init([]) ->
3838
MachineHandlers = [
3939
hg_invoice,
40-
hg_invoice_template,
41-
hg_customer,
42-
hg_recurrent_paytool
40+
hg_invoice_template
4341
],
4442
PartyClient = party_client:create_client(),
4543
DefaultTimeout = genlib_app:env(hellgate, default_woody_handling_timeout, ?DEFAULT_HANDLING_TIMEOUT),
@@ -76,9 +74,6 @@ get_api_child_spec(MachineHandlers, Opts) ->
7674
[
7775
construct_service_handler(invoicing, hg_invoice_handler, Opts),
7876
construct_service_handler(invoice_templating, hg_invoice_template, Opts),
79-
construct_service_handler(customer_management, hg_customer, Opts),
80-
construct_service_handler(recurrent_paytool, hg_recurrent_paytool, Opts),
81-
construct_service_handler(recurrent_paytool_eventsink, hg_recurrent_paytool, Opts),
8277
construct_service_handler(proxy_host_provider, hg_proxy_host_provider, Opts)
8378
],
8479
additional_routes => [PrometeusRoute | HealthRoutes],

apps/hellgate/src/hg_accounting.erl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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]).
@@ -27,6 +27,7 @@
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'().
@@ -37,8 +38,8 @@
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().
101102
collect_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

Comments
 (0)