IMP-278: Retires payouts (#48)

* IMP-278: Retires payouts

* Refactors fixture for `pm_party_tests_SUITE:check_all_payment_methods/1` testcase

* Fixes dialyzer warns and updates woody metrics publishing

* Bumps CI cache

* Fixes deps order in main application

* Bumps damsel

* Reverts removed fields

* Bumps damsel

* Bumps CI

* Bumps damsel
This commit is contained in:
Aleksey Kashapov 2024-08-28 17:40:50 +03:00 committed by GitHub
parent 9af7d71577
commit e16301bd9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 254 additions and 1181 deletions

View File

@ -30,12 +30,12 @@ jobs:
run: run:
name: Run checks name: Run checks
needs: setup needs: setup
uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.14 uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.15
with: with:
otp-version: ${{ needs.setup.outputs.otp-version }} otp-version: ${{ needs.setup.outputs.otp-version }}
rebar-version: ${{ needs.setup.outputs.rebar-version }} rebar-version: ${{ needs.setup.outputs.rebar-version }}
use-thrift: true use-thrift: true
thrift-version: ${{ needs.setup.outputs.thrift-version }} thrift-version: ${{ needs.setup.outputs.thrift-version }}
run-ct-with-compose: true run-ct-with-compose: true
cache-version: v3 cache-version: v4
upload-coverage: false upload-coverage: false

View File

@ -56,27 +56,6 @@
{termination, #claimmgmt_ContractTermination{reason = Reason}} {termination, #claimmgmt_ContractTermination{reason = Reason}}
). ).
-define(cm_payout_tool_modification(PayoutToolID, Mod),
{payout_tool_modification, #claimmgmt_PayoutToolModificationUnit{
payout_tool_id = PayoutToolID,
modification = Mod
}}
).
-define(cm_payout_tool_creation(PayoutToolID, PayoutToolParams),
?cm_payout_tool_modification(PayoutToolID, {creation, PayoutToolParams})
).
-define(cm_payout_tool_info_modification(PayoutToolID, Info),
?cm_payout_tool_modification(PayoutToolID, {info_modification, Info})
).
-define(cm_payout_schedule_modification(BusinessScheduleRef),
{payout_schedule_modification, #claimmgmt_ScheduleModification{
schedule = BusinessScheduleRef
}}
).
-define(cm_cash_register_unit_creation(ID, Params), -define(cm_cash_register_unit_creation(ID, Params),
{creation, #claimmgmt_CashRegisterParams{ {creation, #claimmgmt_CashRegisterParams{
cash_register_provider_id = ID, cash_register_provider_id = ID,
@ -115,10 +94,9 @@
}} }}
). ).
-define(cm_shop_contract_modification(ContractID, PayoutToolID), -define(cm_shop_contract_modification(ContractID),
{contract_modification, #claimmgmt_ShopContractModification{ {contract_modification, #claimmgmt_ShopContractModification{
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}} }}
). ).
@ -223,40 +201,6 @@
) )
). ).
-define(cm_invalid_shop_payout_tool(ID, Reason),
?cm_invalid_shop(ID, {payout_tool_invalid, Reason})
).
-define(cm_invalid_shop_payout_tool_not_set_for_payouts(ID, Schedule),
?cm_invalid_shop_payout_tool(
ID,
{not_set_for_payouts, #claimmgmt_PayoutToolNotSetForPayouts{
payout_schedule = Schedule
}}
)
).
-define(cm_invalid_shop_payout_tool_currency_mismatch(ID, PayoutToolID, ShopAccountCurrency, PayoutToolCurrency),
?cm_invalid_shop_payout_tool(
ID,
{currency_mismatch, #claimmgmt_PayoutToolCurrencyMismatch{
shop_account_currency = ShopAccountCurrency,
payout_tool_id = PayoutToolID,
payout_tool_currency = PayoutToolCurrency
}}
)
).
-define(cm_invalid_shop_payout_tool_not_in_contract(ID, ContractID, PayoutToolID),
?cm_invalid_shop_payout_tool(
ID,
{not_in_contract, #claimmgmt_PayoutToolNotInContract{
contract_id = ContractID,
payout_tool_id = PayoutToolID
}}
)
).
-define(cm_invalid_contract(ID, Reason), -define(cm_invalid_contract(ID, Reason),
{invalid_contract, #claimmgmt_InvalidContract{id = ID, reason = Reason}} {invalid_contract, #claimmgmt_InvalidContract{id = ID, reason = Reason}}
). ).

View File

@ -36,14 +36,6 @@
{payproc_ContractParams, Contractor, TemplateRef, PaymentInstitutionRef} {payproc_ContractParams, Contractor, TemplateRef, PaymentInstitutionRef}
). ).
-define(legacy_payout_tool_creation(ID, Params),
{payout_tool_modification, {payproc_PayoutToolModificationUnit, ID, {creation, Params}}}
).
-define(legacy_payout_tool_params(Currency, PayoutToolInfo),
{payproc_PayoutToolParams, Currency, PayoutToolInfo}
).
-define(legacy_russian_legal_entity( -define(legacy_russian_legal_entity(
RegisteredName, RegisteredName,
RegisteredNumber, RegisteredNumber,
@ -89,10 +81,6 @@
{shop_modification, {payproc_ShopModificationUnit, ID, Modification}} {shop_modification, {payproc_ShopModificationUnit, ID, Modification}}
). ).
-define(legacy_schedule_modification(PayoutScheduleRef),
{payproc_ScheduleModification, PayoutScheduleRef}
).
-define(legacy_shop_effect(ID, Effect), -define(legacy_shop_effect(ID, Effect),
{shop_effect, {payproc_ShopEffectUnit, ID, Effect}} {shop_effect, {payproc_ShopEffectUnit, ID, Effect}}
). ).
@ -129,14 +117,6 @@
PayoutScheduleRef} PayoutScheduleRef}
). ).
-define(legacy_payout_schedule_ref(ID),
{domain_PayoutScheduleRef, ID}
).
-define(legacy_schedule_changed(PayoutScheduleRef),
{payproc_ScheduleChanged, PayoutScheduleRef}
).
-define(legacy_contract_effect(ID, Effect), -define(legacy_contract_effect(ID, Effect),
{contract_effect, {payproc_ContractEffectUnit, ID, Effect}} {contract_effect, {payproc_ContractEffectUnit, ID, Effect}}
). ).
@ -192,15 +172,6 @@
Adjustments, PayoutTools, LegalAgreement, ReportPreferences} Adjustments, PayoutTools, LegalAgreement, ReportPreferences}
). ).
-define(legacy_payout_tool(
ID,
CreatedAt,
Currency,
PayoutToolInfo
),
{domain_PayoutTool, ID, CreatedAt, Currency, PayoutToolInfo}
).
-define(legacy_legal_agreement( -define(legacy_legal_agreement(
SignedAt, SignedAt,
LegalAgreementID LegalAgreementID

View File

@ -82,26 +82,12 @@
}} }}
). ).
-define(payout_tool_creation(ID, Params),
{payout_tool_modification, #payproc_PayoutToolModificationUnit{
payout_tool_id = ID,
modification = {creation, Params}
}}
).
-define(payout_tool_info_modification(ID, Info),
{payout_tool_modification, #payproc_PayoutToolModificationUnit{
payout_tool_id = ID,
modification = {info_modification, Info}
}}
).
-define(shop_modification(ID, Modification), -define(shop_modification(ID, Modification),
{shop_modification, #payproc_ShopModificationUnit{id = ID, modification = Modification}} {shop_modification, #payproc_ShopModificationUnit{id = ID, modification = Modification}}
). ).
-define(shop_contract_modification(ContractID, PayoutToolID), -define(shop_contract_modification(ContractID),
{contract_modification, #payproc_ShopContractModification{contract_id = ContractID, payout_tool_id = PayoutToolID}} {contract_modification, #payproc_ShopContractModification{contract_id = ContractID}}
). ).
-define(shop_account_creation_params(CurrencyRef), -define(shop_account_creation_params(CurrencyRef),
@ -114,10 +100,6 @@
{proxy_modification, #payproc_ProxyModification{proxy = Proxy}} {proxy_modification, #payproc_ProxyModification{proxy = Proxy}}
). ).
-define(payout_schedule_modification(BusinessScheduleRef),
{payout_schedule_modification, #payproc_ScheduleModification{schedule = BusinessScheduleRef}}
).
-define(contract_effect(ID, Effect), -define(contract_effect(ID, Effect),
{contract_effect, #payproc_ContractEffectUnit{contract_id = ID, effect = Effect}} {contract_effect, #payproc_ContractEffectUnit{contract_id = ID, effect = Effect}}
). ).
@ -126,10 +108,6 @@
{shop_effect, #payproc_ShopEffectUnit{shop_id = ID, effect = Effect}} {shop_effect, #payproc_ShopEffectUnit{shop_id = ID, effect = Effect}}
). ).
-define(payout_schedule_changed(BusinessScheduleRef),
{payout_schedule_changed, #payproc_ScheduleChanged{schedule = BusinessScheduleRef}}
).
-define(wallet_modification(ID, Modification), -define(wallet_modification(ID, Modification),
{wallet_modification, #payproc_WalletModificationUnit{id = ID, modification = Modification}} {wallet_modification, #payproc_WalletModificationUnit{id = ID, modification = Modification}}
). ).

View File

@ -11,6 +11,8 @@
genlib, genlib,
pm_proto, pm_proto,
cowboy, cowboy,
prometheus,
prometheus_cowboy,
woody, woody,
scoper, % should be before any scoper event handler usage scoper, % should be before any scoper event handler usage
gproc, gproc,

View File

@ -90,8 +90,15 @@ get_prometheus_route() ->
-spec start(normal, any()) -> {ok, pid()} | {error, any()}. -spec start(normal, any()) -> {ok, pid()} | {error, any()}.
start(_StartType, _StartArgs) -> start(_StartType, _StartArgs) ->
ok = setup_metrics(),
supervisor:start_link(?MODULE, []). supervisor:start_link(?MODULE, []).
-spec stop(any()) -> ok. -spec stop(any()) -> ok.
stop(_State) -> stop(_State) ->
ok. ok.
%%
setup_metrics() ->
ok = woody_ranch_prometheus_collector:setup(),
ok = woody_hackney_prometheus_collector:setup().

View File

@ -389,15 +389,6 @@ update_contract({status_changed, Status}, Contract) ->
update_contract({adjustment_created, Adjustment}, Contract) -> update_contract({adjustment_created, Adjustment}, Contract) ->
Adjustments = Contract#domain_Contract.adjustments ++ [Adjustment], Adjustments = Contract#domain_Contract.adjustments ++ [Adjustment],
Contract#domain_Contract{adjustments = Adjustments}; Contract#domain_Contract{adjustments = Adjustments};
update_contract({payout_tool_created, PayoutTool}, Contract) ->
PayoutTools = Contract#domain_Contract.payout_tools ++ [PayoutTool],
Contract#domain_Contract{payout_tools = PayoutTools};
update_contract(
{payout_tool_info_changed, #payproc_PayoutToolInfoChanged{payout_tool_id = PayoutToolID, info = Info}},
Contract
) ->
PayoutTool = pm_contract:get_payout_tool(PayoutToolID, Contract),
pm_contract:set_payout_tool(PayoutTool#domain_PayoutTool{payout_tool_info = Info}, Contract);
update_contract({legal_agreement_bound, LegalAgreement}, Contract) -> update_contract({legal_agreement_bound, LegalAgreement}, Contract) ->
Contract#domain_Contract{legal_agreement = LegalAgreement}; Contract#domain_Contract{legal_agreement = LegalAgreement};
update_contract({report_preferences_changed, ReportPreferences}, Contract) -> update_contract({report_preferences_changed, ReportPreferences}, Contract) ->
@ -416,19 +407,15 @@ update_shop({category_changed, Category}, Shop) ->
update_shop({details_changed, Details}, Shop) -> update_shop({details_changed, Details}, Shop) ->
Shop#domain_Shop{details = Details}; Shop#domain_Shop{details = Details};
update_shop( update_shop(
{contract_changed, #payproc_ShopContractChanged{contract_id = ContractID, payout_tool_id = PayoutToolID}}, {contract_changed, #payproc_ShopContractChanged{contract_id = ContractID}},
Shop Shop
) -> ) ->
Shop#domain_Shop{contract_id = ContractID, payout_tool_id = PayoutToolID}; Shop#domain_Shop{contract_id = ContractID};
update_shop({payout_tool_changed, PayoutToolID}, Shop) ->
Shop#domain_Shop{payout_tool_id = PayoutToolID};
update_shop({location_changed, Location}, Shop) -> update_shop({location_changed, Location}, Shop) ->
Shop#domain_Shop{location = Location}; Shop#domain_Shop{location = Location};
update_shop({proxy_changed, _}, Shop) -> update_shop({proxy_changed, _}, Shop) ->
% deprecated % deprecated
Shop; Shop;
update_shop(?payout_schedule_changed(BusinessScheduleRef), Shop) ->
Shop#domain_Shop{payout_schedule = BusinessScheduleRef};
update_shop({account_created, Account}, Shop) -> update_shop({account_created, Account}, Shop) ->
Shop#domain_Shop{account = Account}; Shop#domain_Shop{account = Account};
update_shop({turnover_limits_changed, TurnoverLimits}, Shop) -> update_shop({turnover_limits_changed, TurnoverLimits}, Shop) ->
@ -524,20 +511,6 @@ assert_contract_change_applicable(ID, ?adjustment_creation(AdjustmentID, _), Con
_ -> _ ->
raise_invalid_changeset(?invalid_contract(ID, {contract_adjustment_already_exists, AdjustmentID})) raise_invalid_changeset(?invalid_contract(ID, {contract_adjustment_already_exists, AdjustmentID}))
end; end;
assert_contract_change_applicable(ID, ?payout_tool_creation(PayoutToolID, _), Contract) ->
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
undefined ->
ok;
_ ->
raise_invalid_changeset(?invalid_contract(ID, {payout_tool_already_exists, PayoutToolID}))
end;
assert_contract_change_applicable(ID, ?payout_tool_info_modification(PayoutToolID, _), Contract) ->
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
undefined ->
raise_invalid_changeset(?invalid_contract(ID, {payout_tool_not_exists, PayoutToolID}));
_ ->
ok
end;
assert_contract_change_applicable(_, _, _) -> assert_contract_change_applicable(_, _, _) ->
ok. ok.

View File

@ -148,25 +148,6 @@ assert_contract_modification_applicable(ID, ?cm_adjustment_creation(AdjustmentID
PartyChange PartyChange
]) ])
end; end;
assert_contract_modification_applicable(ID, ?cm_payout_tool_creation(PayoutToolID, _), Contract, PartyChange) ->
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
undefined ->
ok;
_ ->
raise_invalid_changeset(?cm_invalid_contract(ID, {payout_tool_already_exists, PayoutToolID}), [PartyChange])
end;
assert_contract_modification_applicable(
ID,
?cm_payout_tool_info_modification(PayoutToolID, _),
Contract,
PartyChange
) ->
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
undefined ->
raise_invalid_changeset(?cm_invalid_contract(ID, {payout_tool_not_exists, PayoutToolID}), [PartyChange]);
_ ->
ok
end;
assert_contract_modification_applicable(_, _, _, _) -> assert_contract_modification_applicable(_, _, _, _) ->
ok. ok.

View File

@ -88,13 +88,6 @@ make_contract_effect(_, ?cm_contract_termination(_), Timestamp, _) ->
{status_changed, {terminated, #domain_ContractTerminated{terminated_at = Timestamp}}}; {status_changed, {terminated, #domain_ContractTerminated{terminated_at = Timestamp}}};
make_contract_effect(_, ?cm_adjustment_creation(AdjustmentID, Params), Timestamp, Revision) -> make_contract_effect(_, ?cm_adjustment_creation(AdjustmentID, Params), Timestamp, Revision) ->
{adjustment_created, pm_contract:create_adjustment(AdjustmentID, Params, Timestamp, Revision)}; {adjustment_created, pm_contract:create_adjustment(AdjustmentID, Params, Timestamp, Revision)};
make_contract_effect(_, ?cm_payout_tool_creation(PayoutToolID, Params), Timestamp, _) ->
{payout_tool_created, pm_payout_tool:create(PayoutToolID, Params, Timestamp)};
make_contract_effect(_, ?cm_payout_tool_info_modification(PayoutToolID, Info), _, _) ->
{payout_tool_info_changed, #payproc_PayoutToolInfoChanged{
payout_tool_id = PayoutToolID,
info = Info
}};
make_contract_effect(_, {legal_agreement_binding, LegalAgreement}, _, _) -> make_contract_effect(_, {legal_agreement_binding, LegalAgreement}, _, _) ->
{legal_agreement_bound, LegalAgreement}; {legal_agreement_bound, LegalAgreement};
make_contract_effect(ID, {report_preferences_modification, ReportPreferences}, _, Revision) -> make_contract_effect(ID, {report_preferences_modification, ReportPreferences}, _, Revision) ->
@ -109,20 +102,14 @@ make_shop_effect(_, {category_modification, Category}, _, _) ->
{category_changed, Category}; {category_changed, Category};
make_shop_effect(_, {details_modification, Details}, _, _) -> make_shop_effect(_, {details_modification, Details}, _, _) ->
{details_changed, Details}; {details_changed, Details};
make_shop_effect(_, ?cm_shop_contract_modification(ContractID, PayoutToolID), _, _) -> make_shop_effect(_, ?cm_shop_contract_modification(ContractID), _, _) ->
{contract_changed, #payproc_ShopContractChanged{ {contract_changed, #payproc_ShopContractChanged{
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}}; }};
make_shop_effect(_, {payout_tool_modification, PayoutToolID}, _, _) ->
{payout_tool_changed, PayoutToolID};
make_shop_effect(_, {location_modification, Location}, _, _) -> make_shop_effect(_, {location_modification, Location}, _, _) ->
{location_changed, Location}; {location_changed, Location};
make_shop_effect(_, {shop_account_creation, Params}, _, _) -> make_shop_effect(_, {shop_account_creation, Params}, _, _) ->
{account_created, create_shop_account(Params)}; {account_created, create_shop_account(Params)};
make_shop_effect(ID, ?cm_payout_schedule_modification(PayoutScheduleRef), _, Revision) ->
_ = assert_payout_schedule_valid(ID, PayoutScheduleRef, Revision),
?payout_schedule_changed(PayoutScheduleRef);
make_shop_effect(_, {turnover_limits_modification, TurnoverLimits}, _, _) -> make_shop_effect(_, {turnover_limits_modification, TurnoverLimits}, _, _) ->
{turnover_limits_changed, TurnoverLimits}. {turnover_limits_changed, TurnoverLimits}.
@ -154,11 +141,6 @@ assert_report_schedule_valid(
) -> ) ->
assert_valid_object_ref({contract, ID}, {business_schedule, BusinessScheduleRef}, Revision). assert_valid_object_ref({contract, ID}, {business_schedule, BusinessScheduleRef}, Revision).
assert_payout_schedule_valid(ID, #domain_BusinessScheduleRef{} = BusinessScheduleRef, Revision) ->
assert_valid_object_ref({shop, ID}, {business_schedule, BusinessScheduleRef}, Revision);
assert_payout_schedule_valid(_, undefined, _) ->
ok.
assert_valid_object_ref(Prefix, Ref, Revision) -> assert_valid_object_ref(Prefix, Ref, Revision) ->
case pm_domain:exists(Revision, Ref) of case pm_domain:exists(Revision, Ref) of
true -> true ->
@ -176,8 +158,6 @@ raise_invalid_object_ref(Prefix, Ref) ->
raise_invalid_object_ref_(Prefix, Ex). raise_invalid_object_ref_(Prefix, Ex).
-spec raise_invalid_object_ref_(term(), term()) -> no_return(). -spec raise_invalid_object_ref_(term(), term()) -> no_return().
raise_invalid_object_ref_({shop, ID}, Ex) ->
pm_claim_committer:raise_invalid_changeset(?cm_invalid_shop(ID, Ex), []);
raise_invalid_object_ref_({contract, ID}, Ex) -> raise_invalid_object_ref_({contract, ID}, Ex) ->
pm_claim_committer:raise_invalid_changeset(?cm_invalid_contract(ID, Ex), []). pm_claim_committer:raise_invalid_changeset(?cm_invalid_contract(ID, Ex), []).
@ -186,12 +166,11 @@ create_shop_account(#claimmgmt_ShopAccountParams{currency = Currency}) ->
create_shop_account(#domain_CurrencyRef{symbolic_code = SymbolicCode} = CurrencyRef) -> create_shop_account(#domain_CurrencyRef{symbolic_code = SymbolicCode} = CurrencyRef) ->
GuaranteeID = pm_accounting:create_account(SymbolicCode), GuaranteeID = pm_accounting:create_account(SymbolicCode),
SettlementID = pm_accounting:create_account(SymbolicCode), SettlementID = pm_accounting:create_account(SymbolicCode),
PayoutID = pm_accounting:create_account(SymbolicCode),
#domain_ShopAccount{ #domain_ShopAccount{
currency = CurrencyRef, currency = CurrencyRef,
settlement = SettlementID, settlement = SettlementID,
guarantee = GuaranteeID, guarantee = GuaranteeID,
payout = PayoutID payout = 0
}. }.
make_optional_domain_ref(_, undefined) -> make_optional_domain_ref(_, undefined) ->
@ -238,15 +217,6 @@ update_contract({status_changed, Status}, Contract) ->
update_contract({adjustment_created, Adjustment}, Contract) -> update_contract({adjustment_created, Adjustment}, Contract) ->
Adjustments = Contract#domain_Contract.adjustments ++ [Adjustment], Adjustments = Contract#domain_Contract.adjustments ++ [Adjustment],
Contract#domain_Contract{adjustments = Adjustments}; Contract#domain_Contract{adjustments = Adjustments};
update_contract({payout_tool_created, PayoutTool}, Contract) ->
PayoutTools = Contract#domain_Contract.payout_tools ++ [PayoutTool],
Contract#domain_Contract{payout_tools = PayoutTools};
update_contract(
{payout_tool_info_changed, #payproc_PayoutToolInfoChanged{payout_tool_id = PayoutToolID, info = Info}},
Contract
) ->
PayoutTool = pm_contract:get_payout_tool(PayoutToolID, Contract),
pm_contract:set_payout_tool(PayoutTool#domain_PayoutTool{payout_tool_info = Info}, Contract);
update_contract({legal_agreement_bound, LegalAgreement}, Contract) -> update_contract({legal_agreement_bound, LegalAgreement}, Contract) ->
Contract#domain_Contract{legal_agreement = LegalAgreement}; Contract#domain_Contract{legal_agreement = LegalAgreement};
update_contract({report_preferences_changed, ReportPreferences}, Contract) -> update_contract({report_preferences_changed, ReportPreferences}, Contract) ->
@ -265,19 +235,15 @@ update_shop({category_changed, Category}, Shop) ->
update_shop({details_changed, Details}, Shop) -> update_shop({details_changed, Details}, Shop) ->
Shop#domain_Shop{details = Details}; Shop#domain_Shop{details = Details};
update_shop( update_shop(
{contract_changed, #payproc_ShopContractChanged{contract_id = ContractID, payout_tool_id = PayoutToolID}}, {contract_changed, #payproc_ShopContractChanged{contract_id = ContractID}},
Shop Shop
) -> ) ->
Shop#domain_Shop{contract_id = ContractID, payout_tool_id = PayoutToolID}; Shop#domain_Shop{contract_id = ContractID};
update_shop({payout_tool_changed, PayoutToolID}, Shop) ->
Shop#domain_Shop{payout_tool_id = PayoutToolID};
update_shop({location_changed, Location}, Shop) -> update_shop({location_changed, Location}, Shop) ->
Shop#domain_Shop{location = Location}; Shop#domain_Shop{location = Location};
update_shop({proxy_changed, _}, Shop) -> update_shop({proxy_changed, _}, Shop) ->
% deprecated % deprecated
Shop; Shop;
update_shop(?payout_schedule_changed(BusinessScheduleRef), Shop) ->
Shop#domain_Shop{payout_schedule = BusinessScheduleRef};
update_shop({account_created, Account}, Shop) -> update_shop({account_created, Account}, Shop) ->
Shop#domain_Shop{account = Account}; Shop#domain_Shop{account = Account};
update_shop({turnover_limits_changed, TurnoverLimits}, Shop) -> update_shop({turnover_limits_changed, TurnoverLimits}, Shop) ->

View File

@ -84,7 +84,6 @@ assert_shop_valid(#domain_Shop{contract_id = ContractID} = Shop, Timestamp, Revi
case pm_party:get_contract(ContractID, Party) of case pm_party:get_contract(ContractID, Party) of
#domain_Contract{} = Contract -> #domain_Contract{} = Contract ->
_ = assert_shop_contract_valid(Shop, Contract, Timestamp, Revision), _ = assert_shop_contract_valid(Shop, Contract, Timestamp, Revision),
_ = assert_shop_payout_tool_valid(Shop, Contract),
ok; ok;
undefined -> undefined ->
throw({invalid_changeset, ?cm_invalid_contract_not_exists(ContractID)}) throw({invalid_changeset, ?cm_invalid_contract_not_exists(ContractID)})
@ -119,32 +118,6 @@ assert_shop_contract_valid(
), ),
ok. ok.
assert_shop_payout_tool_valid(#domain_Shop{payout_tool_id = undefined, payout_schedule = undefined}, _) ->
% automatic payouts disabled for this shop and it's ok
ok;
assert_shop_payout_tool_valid(#domain_Shop{id = ID, payout_tool_id = undefined, payout_schedule = Schedule}, _) ->
% automatic payouts enabled for this shop but no payout tool specified
pm_claim_committer:raise_invalid_changeset(?cm_invalid_shop_payout_tool_not_set_for_payouts(ID, Schedule), []);
assert_shop_payout_tool_valid(#domain_Shop{id = ID, payout_tool_id = PayoutToolID} = Shop, Contract) ->
ShopAccountCurrency = (Shop#domain_Shop.account)#domain_ShopAccount.currency,
ContractID = Contract#domain_Contract.id,
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
#domain_PayoutTool{currency = ShopAccountCurrency} ->
ok;
#domain_PayoutTool{currency = PayoutToolCurrency} ->
throw(
{invalid_changeset,
?cm_invalid_shop_payout_tool_currency_mismatch(
ID,
PayoutToolID,
ShopAccountCurrency,
PayoutToolCurrency
)}
);
undefined ->
throw({invalid_changeset, ?cm_invalid_shop_payout_tool_not_in_contract(ID, ContractID, PayoutToolID)})
end.
assert_wallet_valid(#domain_Wallet{contract = ContractID} = Wallet, Timestamp, Revision, Party) -> assert_wallet_valid(#domain_Wallet{contract = ContractID} = Wallet, Timestamp, Revision, Party) ->
case pm_party:get_contract(ContractID, Party) of case pm_party:get_contract(ContractID, Party) of
#domain_Contract{} = Contract -> #domain_Contract{} = Contract ->

View File

@ -77,13 +77,6 @@ make_contract_effect(_, ?contract_termination(_), Timestamp, _) ->
{status_changed, {terminated, #domain_ContractTerminated{terminated_at = Timestamp}}}; {status_changed, {terminated, #domain_ContractTerminated{terminated_at = Timestamp}}};
make_contract_effect(_, ?adjustment_creation(AdjustmentID, Params), Timestamp, Revision) -> make_contract_effect(_, ?adjustment_creation(AdjustmentID, Params), Timestamp, Revision) ->
{adjustment_created, pm_contract:create_adjustment(AdjustmentID, Params, Timestamp, Revision)}; {adjustment_created, pm_contract:create_adjustment(AdjustmentID, Params, Timestamp, Revision)};
make_contract_effect(_, ?payout_tool_creation(PayoutToolID, Params), Timestamp, _) ->
{payout_tool_created, pm_payout_tool:create(PayoutToolID, Params, Timestamp)};
make_contract_effect(_, ?payout_tool_info_modification(PayoutToolID, Info), _, _) ->
{payout_tool_info_changed, #payproc_PayoutToolInfoChanged{
payout_tool_id = PayoutToolID,
info = Info
}};
make_contract_effect(_, {legal_agreement_binding, LegalAgreement}, _, _) -> make_contract_effect(_, {legal_agreement_binding, LegalAgreement}, _, _) ->
{legal_agreement_bound, LegalAgreement}; {legal_agreement_bound, LegalAgreement};
make_contract_effect(ID, {report_preferences_modification, ReportPreferences}, _, Revision) -> make_contract_effect(ID, {report_preferences_modification, ReportPreferences}, _, Revision) ->
@ -98,22 +91,16 @@ make_shop_effect(_, {category_modification, Category}, _, _) ->
{category_changed, Category}; {category_changed, Category};
make_shop_effect(_, {details_modification, Details}, _, _) -> make_shop_effect(_, {details_modification, Details}, _, _) ->
{details_changed, Details}; {details_changed, Details};
make_shop_effect(_, ?shop_contract_modification(ContractID, PayoutToolID), _, _) -> make_shop_effect(_, ?shop_contract_modification(ContractID), _, _) ->
{contract_changed, #payproc_ShopContractChanged{ {contract_changed, #payproc_ShopContractChanged{
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}}; }};
make_shop_effect(_, {payout_tool_modification, PayoutToolID}, _, _) ->
{payout_tool_changed, PayoutToolID};
make_shop_effect(_, ?proxy_modification(Proxy), _, _) -> make_shop_effect(_, ?proxy_modification(Proxy), _, _) ->
{proxy_changed, #payproc_ShopProxyChanged{proxy = Proxy}}; {proxy_changed, #payproc_ShopProxyChanged{proxy = Proxy}};
make_shop_effect(_, {location_modification, Location}, _, _) -> make_shop_effect(_, {location_modification, Location}, _, _) ->
{location_changed, Location}; {location_changed, Location};
make_shop_effect(_, {shop_account_creation, Params}, _, _) -> make_shop_effect(_, {shop_account_creation, Params}, _, _) ->
{account_created, create_shop_account(Params)}; {account_created, create_shop_account(Params)};
make_shop_effect(ID, ?payout_schedule_modification(PayoutScheduleRef), _, Revision) ->
_ = assert_payout_schedule_valid(ID, PayoutScheduleRef, Revision),
?payout_schedule_changed(PayoutScheduleRef);
make_shop_effect(_, {turnover_limits_modification, TurnoverLimits}, _, _) -> make_shop_effect(_, {turnover_limits_modification, TurnoverLimits}, _, _) ->
{turnover_limits_changed, TurnoverLimits}. {turnover_limits_changed, TurnoverLimits}.
@ -145,11 +132,6 @@ assert_report_schedule_valid(
) -> ) ->
assert_valid_object_ref({contract, ID}, {business_schedule, BusinessScheduleRef}, Revision). assert_valid_object_ref({contract, ID}, {business_schedule, BusinessScheduleRef}, Revision).
assert_payout_schedule_valid(ID, #domain_BusinessScheduleRef{} = BusinessScheduleRef, Revision) ->
assert_valid_object_ref({shop, ID}, {business_schedule, BusinessScheduleRef}, Revision);
assert_payout_schedule_valid(_, undefined, _) ->
ok.
assert_valid_object_ref(Prefix, Ref, Revision) -> assert_valid_object_ref(Prefix, Ref, Revision) ->
case pm_domain:exists(Revision, Ref) of case pm_domain:exists(Revision, Ref) of
true -> true ->
@ -167,8 +149,6 @@ raise_invalid_object_ref(Prefix, Ref) ->
raise_invalid_object_ref_(Prefix, Ex). raise_invalid_object_ref_(Prefix, Ex).
-spec raise_invalid_object_ref_(term(), term()) -> no_return(). -spec raise_invalid_object_ref_(term(), term()) -> no_return().
raise_invalid_object_ref_({shop, ID}, Ex) ->
pm_claim:raise_invalid_changeset(?invalid_shop(ID, Ex));
raise_invalid_object_ref_({contract, ID}, Ex) -> raise_invalid_object_ref_({contract, ID}, Ex) ->
pm_claim:raise_invalid_changeset(?invalid_contract(ID, Ex)). pm_claim:raise_invalid_changeset(?invalid_contract(ID, Ex)).
@ -177,12 +157,11 @@ create_shop_account(#payproc_ShopAccountParams{currency = Currency}) ->
create_shop_account(#domain_CurrencyRef{symbolic_code = SymbolicCode} = CurrencyRef) -> create_shop_account(#domain_CurrencyRef{symbolic_code = SymbolicCode} = CurrencyRef) ->
GuaranteeID = pm_accounting:create_account(SymbolicCode), GuaranteeID = pm_accounting:create_account(SymbolicCode),
SettlementID = pm_accounting:create_account(SymbolicCode), SettlementID = pm_accounting:create_account(SymbolicCode),
PayoutID = pm_accounting:create_account(SymbolicCode),
#domain_ShopAccount{ #domain_ShopAccount{
currency = CurrencyRef, currency = CurrencyRef,
settlement = SettlementID, settlement = SettlementID,
guarantee = GuaranteeID, guarantee = GuaranteeID,
payout = PayoutID payout = 0
}. }.
make_optional_domain_ref(_, undefined) -> make_optional_domain_ref(_, undefined) ->

View File

@ -38,8 +38,6 @@ test({shop_location_is, V}, #{shop := S}, _) ->
V =:= S#domain_Shop.location; V =:= S#domain_Shop.location;
test({party, V}, #{party_id := PartyID} = VS, _) -> test({party, V}, #{party_id := PartyID} = VS, _) ->
test_party(V, PartyID, VS); test_party(V, PartyID, VS);
test({payout_method_is, V1}, #{payout_method := V2}, _) ->
V1 =:= V2;
test({identification_level_is, V1}, #{identification_level := V2}, _) -> test({identification_level_is, V1}, #{identification_level := V2}, _) ->
V1 =:= V2; V1 =:= V2;
test({bin_data, #domain_BinDataCondition{} = C}, #{bin_data := #domain_BinData{} = V}, Rev) -> test({bin_data, #domain_BinDataCondition{} = C}, #{bin_data := #domain_BinData{} = V}, Rev) ->

View File

@ -12,8 +12,6 @@
-export([get_categories/3]). -export([get_categories/3]).
-export([get_adjustment/2]). -export([get_adjustment/2]).
-export([get_payout_tool/2]).
-export([set_payout_tool/2]).
-export([is_active/1]). -export([is_active/1]).
-export([is_live/2]). -export([is_live/2]).
@ -31,8 +29,6 @@
-type adjustment_params() :: -type adjustment_params() ::
dmsl_payproc_thrift:'ContractAdjustmentParams'() dmsl_payproc_thrift:'ContractAdjustmentParams'()
| dmsl_claimmgmt_thrift:'ContractAdjustmentParams'(). | dmsl_claimmgmt_thrift:'ContractAdjustmentParams'().
-type payout_tool() :: dmsl_domain_thrift:'PayoutTool'().
-type payout_tool_id() :: dmsl_domain_thrift:'PayoutToolID'().
-type category() :: dmsl_domain_thrift:'CategoryRef'(). -type category() :: dmsl_domain_thrift:'CategoryRef'().
-type contract_template_ref() :: dmsl_domain_thrift:'ContractTemplateRef'(). -type contract_template_ref() :: dmsl_domain_thrift:'ContractTemplateRef'().
-type payment_inst_ref() :: dmsl_domain_thrift:'PaymentInstitutionRef'(). -type payment_inst_ref() :: dmsl_domain_thrift:'PaymentInstitutionRef'().
@ -173,21 +169,6 @@ get_adjustment(AdjustmentID, #domain_Contract{adjustments = Adjustments}) ->
undefined undefined
end. end.
-spec get_payout_tool(payout_tool_id(), contract()) -> payout_tool() | undefined.
get_payout_tool(PayoutToolID, #domain_Contract{payout_tools = PayoutTools}) ->
case lists:keysearch(PayoutToolID, #domain_PayoutTool.id, PayoutTools) of
{value, PayoutTool} ->
PayoutTool;
false ->
undefined
end.
-spec set_payout_tool(payout_tool(), contract()) -> contract().
set_payout_tool(PayoutTool, Contract = #domain_Contract{payout_tools = PayoutTools}) ->
Contract#domain_Contract{
payout_tools = lists:keystore(PayoutTool#domain_PayoutTool.id, #domain_PayoutTool.id, PayoutTools, PayoutTool)
}.
-spec is_active(contract()) -> boolean(). -spec is_active(contract()) -> boolean().
is_active(#domain_Contract{status = {active, _}}) -> is_active(#domain_Contract{status = {active, _}}) ->
true; true;

View File

@ -161,8 +161,7 @@ create_shop(ID, #payproc_ShopParams{} = ShopParams, Timestamp) ->
category = ShopParams#payproc_ShopParams.category, category = ShopParams#payproc_ShopParams.category,
details = ShopParams#payproc_ShopParams.details, details = ShopParams#payproc_ShopParams.details,
location = ShopParams#payproc_ShopParams.location, location = ShopParams#payproc_ShopParams.location,
contract_id = ShopParams#payproc_ShopParams.contract_id, contract_id = ShopParams#payproc_ShopParams.contract_id
payout_tool_id = ShopParams#payproc_ShopParams.payout_tool_id
}; };
create_shop(ID, #claimmgmt_ShopParams{} = ShopParams, Timestamp) -> create_shop(ID, #claimmgmt_ShopParams{} = ShopParams, Timestamp) ->
#domain_Shop{ #domain_Shop{
@ -173,8 +172,7 @@ create_shop(ID, #claimmgmt_ShopParams{} = ShopParams, Timestamp) ->
category = ShopParams#claimmgmt_ShopParams.category, category = ShopParams#claimmgmt_ShopParams.category,
details = ShopParams#claimmgmt_ShopParams.details, details = ShopParams#claimmgmt_ShopParams.details,
location = ShopParams#claimmgmt_ShopParams.location, location = ShopParams#claimmgmt_ShopParams.location,
contract_id = ShopParams#claimmgmt_ShopParams.contract_id, contract_id = ShopParams#claimmgmt_ShopParams.contract_id
payout_tool_id = ShopParams#claimmgmt_ShopParams.payout_tool_id
}. }.
-spec get_shop(shop_id(), party()) -> shop() | undefined. -spec get_shop(shop_id(), party()) -> shop() | undefined.
@ -306,7 +304,6 @@ is_terms({struct, struct, {dmsl_domain_thrift, Struct}}, Terms) when
Struct =:= 'PartialRefundsServiceTerms'; Struct =:= 'PartialRefundsServiceTerms';
Struct =:= 'PaymentChargebackServiceTerms'; Struct =:= 'PaymentChargebackServiceTerms';
Struct =:= 'PartialCaptureServiceTerms'; Struct =:= 'PartialCaptureServiceTerms';
Struct =:= 'PayoutsServiceTerms';
Struct =:= 'ReportsServiceTerms'; Struct =:= 'ReportsServiceTerms';
Struct =:= 'ServiceAcceptanceActsTerms'; Struct =:= 'ServiceAcceptanceActsTerms';
Struct =:= 'WalletServiceTerms'; Struct =:= 'WalletServiceTerms';
@ -431,8 +428,6 @@ find_shop_account(ID, [{_, #domain_Shop{account = Account}} | Rest]) ->
Account; Account;
#domain_ShopAccount{guarantee = ID} -> #domain_ShopAccount{guarantee = ID} ->
Account; Account;
#domain_ShopAccount{payout = ID} ->
Account;
_ -> _ ->
find_shop_account(ID, Rest) find_shop_account(ID, Rest)
end. end.
@ -497,7 +492,6 @@ assert_shop_valid(#domain_Shop{contract_id = ContractID} = Shop, Timestamp, Revi
case get_contract(ContractID, Party) of case get_contract(ContractID, Party) of
#domain_Contract{} = Contract -> #domain_Contract{} = Contract ->
_ = assert_shop_contract_valid(Shop, Contract, Timestamp, Revision), _ = assert_shop_contract_valid(Shop, Contract, Timestamp, Revision),
_ = assert_shop_payout_tool_valid(Shop, Contract),
ok; ok;
undefined -> undefined ->
pm_claim:raise_invalid_changeset(?invalid_contract(ContractID, {not_exists, ContractID})) pm_claim:raise_invalid_changeset(?invalid_contract(ContractID, {not_exists, ContractID}))
@ -520,34 +514,6 @@ assert_shop_contract_valid(
_ = assert_category_valid({shop, ID}, pm_contract:get_id(Contract), CategoryRef, Terms, Revision), _ = assert_category_valid({shop, ID}, pm_contract:get_id(Contract), CategoryRef, Terms, Revision),
ok. ok.
assert_shop_payout_tool_valid(#domain_Shop{payout_tool_id = undefined, payout_schedule = undefined}, _) ->
% automatic payouts disabled for this shop and it's ok
ok;
assert_shop_payout_tool_valid(#domain_Shop{id = ID, payout_tool_id = undefined, payout_schedule = _Schedule}, _) ->
% automatic payouts enabled for this shop but no payout tool specified
pm_claim:raise_invalid_changeset(?invalid_shop(ID, {payout_tool_invalid, #payproc_ShopPayoutToolInvalid{}}));
assert_shop_payout_tool_valid(#domain_Shop{id = ID, payout_tool_id = PayoutToolID} = Shop, Contract) ->
ShopCurrency = (Shop#domain_Shop.account)#domain_ShopAccount.currency,
case pm_contract:get_payout_tool(PayoutToolID, Contract) of
#domain_PayoutTool{currency = ShopCurrency} ->
ok;
#domain_PayoutTool{} ->
% currency missmatch
pm_claim:raise_invalid_changeset(
?invalid_shop(
ID,
{payout_tool_invalid, #payproc_ShopPayoutToolInvalid{payout_tool_id = PayoutToolID}}
)
);
undefined ->
pm_claim:raise_invalid_changeset(
?invalid_shop(
ID,
{payout_tool_invalid, #payproc_ShopPayoutToolInvalid{payout_tool_id = PayoutToolID}}
)
)
end.
assert_wallet_valid(#domain_Wallet{contract = ContractID} = Wallet, Timestamp, Revision, Party) -> assert_wallet_valid(#domain_Wallet{contract = ContractID} = Wallet, Timestamp, Revision, Party) ->
case get_contract(ContractID, Party) of case get_contract(ContractID, Party) of
#domain_Contract{} = Contract -> #domain_Contract{} = Contract ->

View File

@ -229,36 +229,7 @@ handle_function_('ComputePaymentInstitution', Args, _Opts) ->
{PaymentInstitutionRef, DomainRevision, Varset} = Args, {PaymentInstitutionRef, DomainRevision, Varset} = Args,
PaymentInstitution = get_payment_institution(PaymentInstitutionRef, DomainRevision), PaymentInstitution = get_payment_institution(PaymentInstitutionRef, DomainRevision),
VS = pm_varset:decode_varset(Varset), VS = pm_varset:decode_varset(Varset),
pm_payment_institution:reduce_payment_institution(PaymentInstitution, VS, DomainRevision); pm_payment_institution:reduce_payment_institution(PaymentInstitution, VS, DomainRevision).
%% Payouts adhocs
handle_function_(
'ComputePayoutCashFlow',
{PartyID, #payproc_PayoutParams{id = ShopID, amount = Amount, timestamp = Timestamp} = PayoutParams},
_Opts
) ->
_ = set_party_mgmt_meta(PartyID),
Party = checkout_party(PartyID, {timestamp, Timestamp}),
Shop = ensure_shop(pm_party:get_shop(ShopID, Party)),
Contract = pm_party:get_contract(Shop#domain_Shop.contract_id, Party),
Currency = Amount#domain_Cash.currency,
ok = pm_currency:validate_currency(Currency, Shop),
PayoutTool = get_payout_tool(Shop, Contract, PayoutParams),
VS = #{
party_id => PartyID,
shop_id => ShopID,
category => Shop#domain_Shop.category,
currency => Currency,
cost => Amount,
payout_method => pm_payout_tool:get_method(PayoutTool)
},
Revision = pm_domain:head(),
case pm_party:get_terms(Contract, Timestamp, Revision) of
#domain_TermSet{payouts = PayoutsTerms} when PayoutsTerms /= undefined ->
compute_payout_cash_flow(Amount, PayoutsTerms, Shop, Contract, VS, Revision);
#domain_TermSet{payouts = undefined} ->
throw(#payproc_OperationNotPermitted{})
end.
%% %%
@ -272,16 +243,6 @@ call(PartyID, FunctionName, Args) ->
%% %%
get_payout_tool(_Shop, Contract, #payproc_PayoutParams{payout_tool_id = ToolID}) when ToolID =/= undefined ->
case pm_contract:get_payout_tool(ToolID, Contract) of
undefined ->
throw(#payproc_PayoutToolNotFound{});
PayoutTool ->
PayoutTool
end;
get_payout_tool(Shop, Contract, _PayoutParams) ->
pm_contract:get_payout_tool(Shop#domain_Shop.payout_tool_id, Contract).
assert_provider_reduced(#domain_Provider{terms = Terms}) -> assert_provider_reduced(#domain_Provider{terms = Terms}) ->
assert_provider_terms_reduced(Terms). assert_provider_terms_reduced(Terms).
@ -359,37 +320,6 @@ get_default_contract_template(#domain_PaymentInstitution{default_contract_templa
ContractTemplateRef = pm_selector:reduce_to_value(ContractSelector, VS, Revision), ContractTemplateRef = pm_selector:reduce_to_value(ContractSelector, VS, Revision),
pm_domain:get(Revision, {contract_template, ContractTemplateRef}). pm_domain:get(Revision, {contract_template, ContractTemplateRef}).
compute_payout_cash_flow(
Amount,
#domain_PayoutsServiceTerms{fees = CashFlowSelector},
Shop,
Contract,
VS,
Revision
) ->
Cashflow = pm_selector:reduce_to_value(CashFlowSelector, VS, Revision),
CashFlowContext = #{operation_amount => Amount},
Currency = Amount#domain_Cash.currency,
AccountMap = collect_payout_account_map(Currency, Shop, Contract, VS, Revision),
pm_cashflow:finalize(Cashflow, CashFlowContext, AccountMap).
collect_payout_account_map(
Currency,
#domain_Shop{account = ShopAccount},
#domain_Contract{payment_institution = PaymentInstitutionRef},
VS,
Revision
) ->
PaymentInstitution = get_payment_institution(PaymentInstitutionRef, Revision),
SystemAccount = pm_payment_institution:get_system_account(Currency, VS, Revision, PaymentInstitution),
#{
{merchant, settlement} => ShopAccount#domain_ShopAccount.settlement,
{merchant, guarantee} => ShopAccount#domain_ShopAccount.guarantee,
{merchant, payout} => ShopAccount#domain_ShopAccount.payout,
{system, settlement} => SystemAccount#domain_SystemAccount.settlement,
{system, subagent} => SystemAccount#domain_SystemAccount.subagent
}.
get_identification_level(#domain_Contract{contractor_id = undefined, contractor = Contractor}, _) -> get_identification_level(#domain_Contract{contractor_id = undefined, contractor = Contractor}, _) ->
%% TODO legacy, remove after migration %% TODO legacy, remove after migration
case Contractor of case Contractor of

View File

@ -1435,22 +1435,6 @@ transmute_party_modification(
ID, ID,
{creation, transmute_contractor(V1, V2, Contractor)} {creation, transmute_contractor(V1, V2, Contractor)}
); );
transmute_party_modification(
V1,
V2,
?legacy_contract_modification(
ContractID,
?legacy_payout_tool_creation(
ID,
?legacy_payout_tool_params(Currency, ToolInfo)
)
)
) when V1 =:= 1; V1 =:= 2; V1 =:= 5 ->
PayoutToolParams = #payproc_PayoutToolParams{
currency = Currency,
tool_info = transmute_payout_tool_info(V1, V2, ToolInfo)
},
?contract_modification(ContractID, ?payout_tool_creation(ID, PayoutToolParams));
transmute_party_modification( transmute_party_modification(
3, 3,
4, 4,
@ -1460,20 +1444,6 @@ transmute_party_modification(
) )
) -> ) ->
?contract_modification(ID, {legal_agreement_binding, transmute_legal_agreement(3, 4, LegalAgreement)}); ?contract_modification(ID, {legal_agreement_binding, transmute_legal_agreement(3, 4, LegalAgreement)});
transmute_party_modification(
3,
4,
?legacy_shop_modification(
ID,
{payout_schedule_modification, ?legacy_schedule_modification(PayoutScheduleRef)}
)
) ->
?shop_modification(
ID,
{payout_schedule_modification, #payproc_ScheduleModification{
schedule = transmute_payout_schedule_ref(3, 4, PayoutScheduleRef)
}}
);
transmute_party_modification(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION -> transmute_party_modification(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION ->
C. C.
@ -1492,7 +1462,7 @@ transmute_claim_effect(
Status, Status,
Terms, Terms,
Adjustments, Adjustments,
PayoutTools, _PayoutTools,
LegalAgreement LegalAgreement
)} )}
) )
@ -1507,7 +1477,7 @@ transmute_claim_effect(
Status, Status,
Terms, Terms,
Adjustments, Adjustments,
[transmute_payout_tool(1, 2, P) || P <- PayoutTools], [],
LegalAgreement LegalAgreement
), ),
?legacy_contract_effect(ID, {created, Contract}); ?legacy_contract_effect(ID, {created, Contract});
@ -1527,7 +1497,7 @@ transmute_claim_effect(
Status, Status,
Terms, Terms,
Adjustments, Adjustments,
PayoutTools, _PayoutTools,
LegalAgreement LegalAgreement
)} )}
) )
@ -1542,7 +1512,7 @@ transmute_claim_effect(
Status, Status,
Terms, Terms,
Adjustments, Adjustments,
[transmute_payout_tool(2, 3, P) || P <- PayoutTools], [],
LegalAgreement LegalAgreement
), ),
?legacy_contract_effect(ID, {created, Contract}); ?legacy_contract_effect(ID, {created, Contract});
@ -1598,7 +1568,7 @@ transmute_claim_effect(
Status, Status,
Terms, Terms,
Adjustments, Adjustments,
PayoutTools, _PayoutTools,
LegalAgreement, LegalAgreement,
ReportPreferences ReportPreferences
)} )}
@ -1614,25 +1584,11 @@ transmute_claim_effect(
status = Status, status = Status,
terms = Terms, terms = Terms,
adjustments = Adjustments, adjustments = Adjustments,
payout_tools = PayoutTools, payout_tools = [],
legal_agreement = LegalAgreement, legal_agreement = LegalAgreement,
report_preferences = ReportPreferences report_preferences = ReportPreferences
}, },
?contract_effect(ID, {created, Contract}); ?contract_effect(ID, {created, Contract});
transmute_claim_effect(
5,
6,
?contract_effect(
ID,
{created, Contract = #domain_Contract{payout_tools = PayoutTools}}
)
) ->
?contract_effect(
ID,
{created, Contract#domain_Contract{
payout_tools = [transmute_payout_tool(5, 6, P) || P <- PayoutTools]
}}
);
transmute_claim_effect( transmute_claim_effect(
6 = V1, 6 = V1,
7 = V2, 7 = V2,
@ -1659,18 +1615,6 @@ transmute_claim_effect(
ID, ID,
{created, transmute_party_contractor(V1, V2, PartyContractor)} {created, transmute_party_contractor(V1, V2, PartyContractor)}
); );
transmute_claim_effect(
V1,
V2,
?legacy_contract_effect(
ContractID,
{payout_tool_created, PayoutTool}
)
) when V1 =:= 1; V1 =:= 2; V1 =:= 5 ->
?contract_effect(
ContractID,
{payout_tool_created, transmute_payout_tool(V1, V2, PayoutTool)}
);
transmute_claim_effect( transmute_claim_effect(
3, 3,
4, 4,
@ -1696,7 +1640,7 @@ transmute_claim_effect(
Category, Category,
Account, Account,
ContractID, ContractID,
PayoutToolID _PayoutToolID
)} )}
) )
) -> ) ->
@ -1709,8 +1653,7 @@ transmute_claim_effect(
location = Location, location = Location,
category = Category, category = Category,
account = Account, account = Account,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}, },
?shop_effect(ID, {created, Shop}); ?shop_effect(ID, {created, Shop});
transmute_claim_effect( transmute_claim_effect(
@ -1729,8 +1672,8 @@ transmute_claim_effect(
Category, Category,
Account, Account,
ContractID, ContractID,
PayoutToolID, _PayoutToolID,
PayoutSchedule _PayoutSchedule
)} )}
) )
) -> ) ->
@ -1743,25 +1686,9 @@ transmute_claim_effect(
location = Location, location = Location,
category = Category, category = Category,
account = Account, account = Account,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID,
payout_schedule = transmute_payout_schedule_ref(3, 4, PayoutSchedule)
}, },
?shop_effect(ID, {created, Shop}); ?shop_effect(ID, {created, Shop});
transmute_claim_effect(
3,
4,
?legacy_shop_effect(
ID,
{payout_schedule_changed, ?legacy_schedule_changed(PayoutSchedule)}
)
) ->
?shop_effect(
ID,
{payout_schedule_changed, #payproc_ScheduleChanged{
schedule = transmute_payout_schedule_ref(3, 4, PayoutSchedule)
}}
);
transmute_claim_effect(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION -> transmute_claim_effect(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION ->
C. C.
@ -1839,75 +1766,6 @@ transmute_contractor(
transmute_contractor(V1, _, Contractor) when V1 =:= 1; V1 =:= 2; V1 =:= 6 -> transmute_contractor(V1, _, Contractor) when V1 =:= 1; V1 =:= 2; V1 =:= 6 ->
Contractor. Contractor.
transmute_payout_tool(
V1,
V2,
?legacy_payout_tool(
ID,
CreatedAt,
Currency,
ToolInfo
)
) when V1 =:= 1; V1 =:= 2 ->
#domain_PayoutTool{
id = ID,
created_at = CreatedAt,
currency = Currency,
payout_tool_info = transmute_payout_tool_info(V1, V2, ToolInfo)
};
transmute_payout_tool(V1, _, PayoutTool) when V1 =:= 1; V1 =:= 2 ->
PayoutTool;
transmute_payout_tool(V1, V2, PayoutTool = #domain_PayoutTool{payout_tool_info = ToolInfo}) when V1 =:= 5 ->
PayoutTool#domain_PayoutTool{payout_tool_info = transmute_payout_tool_info(V1, V2, ToolInfo)}.
transmute_payout_tool_info(1, 2, {bank_account, BankAccount}) ->
{russian_bank_account, transmute_bank_account(1, 2, BankAccount)};
transmute_payout_tool_info(
2,
3,
{international_bank_account,
?legacy_international_bank_account(
AccountHolder,
BankName,
BankAddress,
Iban,
Bic
)}
) ->
{international_bank_account,
?legacy_international_bank_account_v3_4_5(
AccountHolder,
BankName,
BankAddress,
Iban,
Bic,
undefined
)};
transmute_payout_tool_info(
5,
6,
{international_bank_account,
?legacy_international_bank_account_v3_4_5(
AccountHolder,
BankName,
BankAddress,
Iban,
Bic,
_LocalBankCode
)}
) ->
{international_bank_account, #domain_InternationalBankAccount{
bank = #domain_InternationalBankDetails{
bic = Bic,
name = BankName,
address = BankAddress
},
iban = Iban,
account_holder = AccountHolder
}};
transmute_payout_tool_info(V1, _, ToolInfo) when V1 =:= 1; V1 =:= 2; V1 =:= 5 ->
ToolInfo.
transmute_bank_account(1, 2, ?legacy_bank_account(Account, BankName, BankPostAccount, BankBik)) -> transmute_bank_account(1, 2, ?legacy_bank_account(Account, BankName, BankPostAccount, BankBik)) ->
#domain_RussianBankAccount{ #domain_RussianBankAccount{
account = Account, account = Account,
@ -1924,11 +1782,6 @@ transmute_legal_agreement(3, 4, ?legacy_legal_agreement(SignedAt, LegalAgreement
transmute_legal_agreement(3, 4, undefined) -> transmute_legal_agreement(3, 4, undefined) ->
undefined. undefined.
transmute_payout_schedule_ref(3, 4, ?legacy_payout_schedule_ref(ID)) ->
#domain_BusinessScheduleRef{id = ID};
transmute_payout_schedule_ref(3, 4, undefined) ->
undefined.
%% %%
-ifdef(TEST). -ifdef(TEST).

View File

@ -1,62 +0,0 @@
%%% Payout tools
-module(pm_payout_tool).
-include_lib("damsel/include/dmsl_claimmgmt_thrift.hrl").
-include_lib("damsel/include/dmsl_payproc_thrift.hrl").
-include_lib("damsel/include/dmsl_domain_thrift.hrl").
%%
-export([create/3]).
-export([get_method/1]).
%%
-type payout_tool() :: dmsl_domain_thrift:'PayoutTool'().
-type payout_tool_id() :: dmsl_domain_thrift:'PayoutToolID'().
-type payout_tool_params() ::
dmsl_payproc_thrift:'PayoutToolParams'() | dmsl_claimmgmt_thrift:'PayoutToolParams'().
-type method() :: dmsl_domain_thrift:'PayoutMethodRef'().
-type timestamp() :: dmsl_base_thrift:'Timestamp'().
%%
-spec create(payout_tool_id(), payout_tool_params(), timestamp()) -> payout_tool().
create(
ID,
#payproc_PayoutToolParams{
currency = Currency,
tool_info = ToolInfo
},
Timestamp
) ->
#domain_PayoutTool{
id = ID,
created_at = Timestamp,
currency = Currency,
payout_tool_info = ToolInfo
};
create(
ID,
#claimmgmt_PayoutToolParams{
currency = Currency,
tool_info = ToolInfo
},
Timestamp
) ->
#domain_PayoutTool{
id = ID,
created_at = Timestamp,
currency = Currency,
payout_tool_info = ToolInfo
}.
-spec get_method(payout_tool()) -> method().
get_method(#domain_PayoutTool{payout_tool_info = {russian_bank_account, _}}) ->
#domain_PayoutMethodRef{id = russian_bank_account};
get_method(#domain_PayoutTool{payout_tool_info = {international_bank_account, _}}) ->
#domain_PayoutMethodRef{id = international_bank_account};
get_method(#domain_PayoutTool{payout_tool_info = {wallet_info, _}}) ->
#domain_PayoutMethodRef{id = wallet_info};
get_method(#domain_PayoutTool{payout_tool_info = {payment_institution_account, _}}) ->
#domain_PayoutMethodRef{id = payment_institution_account}.

View File

@ -37,7 +37,6 @@ reduce_withdrawal_terms(#domain_WithdrawalProvisionTerms{} = Terms, VS, Rev) ->
allow = reduce_predicate_if_defined(Terms#domain_WithdrawalProvisionTerms.allow, VS, Rev), allow = reduce_predicate_if_defined(Terms#domain_WithdrawalProvisionTerms.allow, VS, Rev),
global_allow = reduce_predicate_if_defined(Terms#domain_WithdrawalProvisionTerms.global_allow, VS, Rev), global_allow = reduce_predicate_if_defined(Terms#domain_WithdrawalProvisionTerms.global_allow, VS, Rev),
currencies = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.currencies, VS, Rev), currencies = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.currencies, VS, Rev),
payout_methods = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.payout_methods, VS, Rev),
cash_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_limit, VS, Rev), cash_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_limit, VS, Rev),
cash_flow = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_flow, VS, Rev), cash_flow = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.cash_flow, VS, Rev),
turnover_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.turnover_limit, VS, Rev) turnover_limit = reduce_if_defined(Terms#domain_WithdrawalProvisionTerms.turnover_limit, VS, Rev)
@ -259,7 +258,6 @@ merge_withdrawal_terms(
allow = PAllow, allow = PAllow,
global_allow = PGAllow, global_allow = PGAllow,
currencies = PCurrencies, currencies = PCurrencies,
payout_methods = PMethods,
cash_limit = PLimit, cash_limit = PLimit,
cash_flow = PCashflow, cash_flow = PCashflow,
turnover_limit = PTurnoverLimit turnover_limit = PTurnoverLimit
@ -268,7 +266,6 @@ merge_withdrawal_terms(
allow = TAllow, allow = TAllow,
global_allow = TGAllow, global_allow = TGAllow,
currencies = TCurrencies, currencies = TCurrencies,
payout_methods = TMethods,
cash_limit = TLimit, cash_limit = TLimit,
cash_flow = TCashflow, cash_flow = TCashflow,
turnover_limit = TTurnoverLimit turnover_limit = TTurnoverLimit
@ -278,7 +275,6 @@ merge_withdrawal_terms(
allow = pm_utils:select_defined(TAllow, PAllow), allow = pm_utils:select_defined(TAllow, PAllow),
global_allow = pm_utils:select_defined(TGAllow, PGAllow), global_allow = pm_utils:select_defined(TGAllow, PGAllow),
currencies = pm_utils:select_defined(TCurrencies, PCurrencies), currencies = pm_utils:select_defined(TCurrencies, PCurrencies),
payout_methods = pm_utils:select_defined(TMethods, PMethods),
cash_limit = pm_utils:select_defined(TLimit, PLimit), cash_limit = pm_utils:select_defined(TLimit, PLimit),
cash_flow = pm_utils:select_defined(TCashflow, PCashflow), cash_flow = pm_utils:select_defined(TCashflow, PCashflow),
turnover_limit = pm_utils:select_defined(TTurnoverLimit, PTurnoverLimit) turnover_limit = pm_utils:select_defined(TTurnoverLimit, PTurnoverLimit)

View File

@ -42,7 +42,6 @@
shop_id => dmsl_domain_thrift:'ShopID'(), shop_id => dmsl_domain_thrift:'ShopID'(),
risk_score => dmsl_domain_thrift:'RiskScore'(), risk_score => dmsl_domain_thrift:'RiskScore'(),
flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()}, flow => instant | {hold, dmsl_domain_thrift:'HoldLifetime'()},
payout_method => dmsl_domain_thrift:'PayoutMethodRef'(),
wallet_id => dmsl_domain_thrift:'WalletID'(), wallet_id => dmsl_domain_thrift:'WalletID'(),
identification_level => dmsl_domain_thrift:'ContractorIdentificationLevel'() identification_level => dmsl_domain_thrift:'ContractorIdentificationLevel'()
}. }.

View File

@ -14,7 +14,6 @@
currency => dmsl_domain_thrift:'CurrencyRef'(), currency => dmsl_domain_thrift:'CurrencyRef'(),
cost => dmsl_domain_thrift:'Cash'(), cost => dmsl_domain_thrift:'Cash'(),
payment_method => dmsl_domain_thrift:'PaymentMethodRef'(), payment_method => dmsl_domain_thrift:'PaymentMethodRef'(),
payout_method => dmsl_domain_thrift:'PayoutMethodRef'(),
wallet_id => dmsl_domain_thrift:'WalletID'(), wallet_id => dmsl_domain_thrift:'WalletID'(),
shop_id => dmsl_domain_thrift:'ShopID'(), shop_id => dmsl_domain_thrift:'ShopID'(),
identification_level => dmsl_domain_thrift:'ContractorIdentificationLevel'(), identification_level => dmsl_domain_thrift:'ContractorIdentificationLevel'(),
@ -34,7 +33,6 @@ encode_varset(Varset) ->
currency = genlib_map:get(currency, Varset), currency = genlib_map:get(currency, Varset),
amount = genlib_map:get(cost, Varset), amount = genlib_map:get(cost, Varset),
payment_method = genlib_map:get(payment_method, Varset), payment_method = genlib_map:get(payment_method, Varset),
payout_method = genlib_map:get(payout_method, Varset),
wallet_id = genlib_map:get(wallet_id, Varset), wallet_id = genlib_map:get(wallet_id, Varset),
shop_id = genlib_map:get(shop_id, Varset), shop_id = genlib_map:get(shop_id, Varset),
identification_level = genlib_map:get(identification_level, Varset), identification_level = genlib_map:get(identification_level, Varset),
@ -53,7 +51,6 @@ decode_varset(#payproc_Varset{} = Varset, VS) ->
currency => Varset#payproc_Varset.currency, currency => Varset#payproc_Varset.currency,
cost => Varset#payproc_Varset.amount, cost => Varset#payproc_Varset.amount,
payment_method => Varset#payproc_Varset.payment_method, payment_method => Varset#payproc_Varset.payment_method,
payout_method => Varset#payproc_Varset.payout_method,
wallet_id => Varset#payproc_Varset.wallet_id, wallet_id => Varset#payproc_Varset.wallet_id,
shop_id => Varset#payproc_Varset.shop_id, shop_id => Varset#payproc_Varset.shop_id,
identification_level => Varset#payproc_Varset.identification_level, identification_level => Varset#payproc_Varset.identification_level,
@ -67,7 +64,6 @@ decode_varset(#payproc_Varset{} = Varset, VS) ->
decode_varset(#payproc_ComputeShopTermsVarset{} = Varset, VS) -> decode_varset(#payproc_ComputeShopTermsVarset{} = Varset, VS) ->
genlib_map:compact(VS#{ genlib_map:compact(VS#{
cost => Varset#payproc_ComputeShopTermsVarset.amount, cost => Varset#payproc_ComputeShopTermsVarset.amount,
payout_method => Varset#payproc_ComputeShopTermsVarset.payout_method,
payment_tool => Varset#payproc_ComputeShopTermsVarset.payment_tool payment_tool => Varset#payproc_ComputeShopTermsVarset.payment_tool
}); });
decode_varset(#payproc_ComputeContractTermsVarset{} = Varset, VS) -> decode_varset(#payproc_ComputeContractTermsVarset{} = Varset, VS) ->
@ -75,7 +71,6 @@ decode_varset(#payproc_ComputeContractTermsVarset{} = Varset, VS) ->
currency => Varset#payproc_ComputeContractTermsVarset.currency, currency => Varset#payproc_ComputeContractTermsVarset.currency,
cost => Varset#payproc_ComputeContractTermsVarset.amount, cost => Varset#payproc_ComputeContractTermsVarset.amount,
shop_id => Varset#payproc_ComputeContractTermsVarset.shop_id, shop_id => Varset#payproc_ComputeContractTermsVarset.shop_id,
payout_method => Varset#payproc_ComputeContractTermsVarset.payout_method,
payment_tool => Varset#payproc_ComputeContractTermsVarset.payment_tool, payment_tool => Varset#payproc_ComputeContractTermsVarset.payment_tool,
wallet_id => Varset#payproc_ComputeContractTermsVarset.wallet_id, wallet_id => Varset#payproc_ComputeContractTermsVarset.wallet_id,
bin_data => Varset#payproc_ComputeContractTermsVarset.bin_data bin_data => Varset#payproc_ComputeContractTermsVarset.bin_data
@ -108,7 +103,6 @@ encode_decode_test() ->
payment_system = #domain_PaymentSystemRef{id = <<"visa">>} payment_system = #domain_PaymentSystemRef{id = <<"visa">>}
}} }}
}, },
payout_method => #domain_PayoutMethodRef{id = russian_bank_account},
wallet_id => <<"wallet_id">>, wallet_id => <<"wallet_id">>,
shop_id => <<"shop_id">>, shop_id => <<"shop_id">>,
identification_level => full, identification_level => full,

View File

@ -60,20 +60,18 @@ create(
create_account(#payproc_WalletAccountParams{currency = Currency}) -> create_account(#payproc_WalletAccountParams{currency = Currency}) ->
SymbolicCode = Currency#domain_CurrencyRef.symbolic_code, SymbolicCode = Currency#domain_CurrencyRef.symbolic_code,
SettlementID = pm_accounting:create_account(SymbolicCode), SettlementID = pm_accounting:create_account(SymbolicCode),
PayoutID = pm_accounting:create_account(SymbolicCode),
#domain_WalletAccount{ #domain_WalletAccount{
currency = Currency, currency = Currency,
settlement = SettlementID, settlement = SettlementID,
payout = PayoutID payout = 0
}; };
create_account(#claimmgmt_WalletAccountParams{currency = Currency}) -> create_account(#claimmgmt_WalletAccountParams{currency = Currency}) ->
SymbolicCode = Currency#domain_CurrencyRef.symbolic_code, SymbolicCode = Currency#domain_CurrencyRef.symbolic_code,
SettlementID = pm_accounting:create_account(SymbolicCode), SettlementID = pm_accounting:create_account(SymbolicCode),
PayoutID = pm_accounting:create_account(SymbolicCode),
#domain_WalletAccount{ #domain_WalletAccount{
currency = Currency, currency = Currency,
settlement = SettlementID, settlement = SettlementID,
payout = PayoutID payout = 0
}. }.
-spec create_fake_account(wallet_account_params()) -> wallet_account(). -spec create_fake_account(wallet_account_params()) -> wallet_account().

View File

@ -30,8 +30,6 @@
-export([contract_already_exists/1]). -export([contract_already_exists/1]).
-export([contract_already_terminated/1]). -export([contract_already_terminated/1]).
-export([shop_already_exists/1]). -export([shop_already_exists/1]).
-export([invalid_shop_payout_tool_not_in_contract/1]).
-export([invalid_shop_payout_tool_currency_mismatch/1]).
-export([wallet_account_creation/1]). -export([wallet_account_creation/1]).
-export([additional_info_modification/1]). -export([additional_info_modification/1]).
@ -42,11 +40,7 @@
-define(REAL_CONTRACTOR_ID2, <<"CONTRACTOR3">>). -define(REAL_CONTRACTOR_ID2, <<"CONTRACTOR3">>).
-define(REAL_CONTRACT_ID1, <<"CONTRACT2">>). -define(REAL_CONTRACT_ID1, <<"CONTRACT2">>).
-define(REAL_CONTRACT_ID2, <<"CONTRACT3">>). -define(REAL_CONTRACT_ID2, <<"CONTRACT3">>).
-define(REAL_PAYOUT_TOOL_ID1, <<"PAYOUTTOOL2">>).
-define(REAL_PAYOUT_TOOL_ID2, <<"PAYOUTTOOL3">>).
-define(REAL_PAYOUT_TOOL_ID4, <<"PAYOUTTOOL4">>).
-define(REAL_SHOP_ID, <<"SHOP2">>). -define(REAL_SHOP_ID, <<"SHOP2">>).
-define(REAL_SHOP_ID4, <<"SHOP4">>).
%%% CT %%% CT
@ -72,8 +66,6 @@ all() ->
contract_already_exists, contract_already_exists,
contract_already_terminated, contract_already_terminated,
shop_already_exists, shop_already_exists,
invalid_shop_payout_tool_not_in_contract,
invalid_shop_payout_tool_currency_mismatch,
wallet_account_creation, wallet_account_creation,
additional_info_modification additional_info_modification
]. ].
@ -157,45 +149,32 @@ contractor_modification(C) ->
-spec contract_one_creation(config()) -> _. -spec contract_one_creation(config()) -> _.
contract_one_creation(C) -> contract_one_creation(C) ->
ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1), ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1),
PayoutToolParams = make_payout_tool_params(),
ContractID = ?REAL_CONTRACT_ID1, ContractID = ?REAL_CONTRACT_ID1,
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
PayoutToolID2 = ?REAL_PAYOUT_TOOL_ID2,
Modifications = [ Modifications = [
?cm_contract_creation(ContractID, ContractParams), ?cm_contract_creation(ContractID, ContractParams)
?cm_contract_modification(ContractID, ?cm_payout_tool_creation(PayoutToolID1, PayoutToolParams)),
?cm_contract_modification(ContractID, ?cm_payout_tool_creation(PayoutToolID2, PayoutToolParams))
], ],
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
Claim = claim(Modifications, PartyID), Claim = claim(Modifications, PartyID),
ok = accept_claim(Claim, C), ok = accept_claim(Claim, C),
ok = commit_claim(Claim, C), ok = commit_claim(Claim, C),
{ok, #domain_Contract{ {ok, #domain_Contract{
id = ContractID, id = ContractID
payout_tools = PayoutTools }} = get_contract(PartyID, ContractID, C).
}} = get_contract(PartyID, ContractID, C),
true = lists:keymember(PayoutToolID1, #domain_PayoutTool.id, PayoutTools),
true = lists:keymember(PayoutToolID2, #domain_PayoutTool.id, PayoutTools).
-spec contract_two_creation(config()) -> _. -spec contract_two_creation(config()) -> _.
contract_two_creation(C) -> contract_two_creation(C) ->
ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1), ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1),
PayoutToolParams = make_payout_tool_params(),
ContractID = ?REAL_CONTRACT_ID2, ContractID = ?REAL_CONTRACT_ID2,
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
Modifications = [ Modifications = [
?cm_contract_creation(ContractID, ContractParams), ?cm_contract_creation(ContractID, ContractParams)
?cm_contract_modification(ContractID, ?cm_payout_tool_creation(PayoutToolID1, PayoutToolParams))
], ],
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
Claim = claim(Modifications, PartyID), Claim = claim(Modifications, PartyID),
ok = accept_claim(Claim, C), ok = accept_claim(Claim, C),
ok = commit_claim(Claim, C), ok = commit_claim(Claim, C),
{ok, #domain_Contract{ {ok, #domain_Contract{
id = ContractID, id = ContractID
payout_tools = PayoutTools }} = get_contract(PartyID, ContractID, C).
}} = get_contract(PartyID, ContractID, C),
true = lists:keymember(PayoutToolID1, #domain_PayoutTool.id, PayoutTools).
-spec contract_contractor_modification(config()) -> _. -spec contract_contractor_modification(config()) -> _.
contract_contractor_modification(C) -> contract_contractor_modification(C) ->
@ -284,20 +263,15 @@ shop_creation(C) ->
Location = {url, <<"https://example.com">>}, Location = {url, <<"https://example.com">>},
ContractID = ?REAL_CONTRACT_ID1, ContractID = ?REAL_CONTRACT_ID1,
ShopID = ?REAL_SHOP_ID, ShopID = ?REAL_SHOP_ID,
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
ShopParams = #claimmgmt_ShopParams{ ShopParams = #claimmgmt_ShopParams{
category = Category, category = Category,
location = Location, location = Location,
details = Details, details = Details,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID1
}, },
Schedule = ?bussched(1),
ScheduleParams = #claimmgmt_ScheduleModification{schedule = Schedule},
Modifications = [ Modifications = [
?cm_shop_creation(ShopID, ShopParams), ?cm_shop_creation(ShopID, ShopParams),
?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>)), ?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>))
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
], ],
Claim = claim(Modifications, PartyID), Claim = claim(Modifications, PartyID),
ok = accept_claim(Claim, C), ok = accept_claim(Claim, C),
@ -308,9 +282,7 @@ shop_creation(C) ->
location = Location, location = Location,
category = Category, category = Category,
account = #domain_ShopAccount{currency = ?cur(<<"RUB">>)}, account = #domain_ShopAccount{currency = ?cur(<<"RUB">>)},
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID1,
payout_schedule = Schedule
}} = get_shop(PartyID, ShopID, C). }} = get_shop(PartyID, ShopID, C).
-spec shop_complex_modification(config()) -> _. -spec shop_complex_modification(config()) -> _.
@ -323,9 +295,6 @@ shop_complex_modification(C) ->
description = <<"Updated shop description.">> description = <<"Updated shop description.">>
}, },
NewLocation = {url, <<"http://localhost">>}, NewLocation = {url, <<"http://localhost">>},
PayoutToolID2 = ?REAL_PAYOUT_TOOL_ID2,
Schedule = ?bussched(2),
ScheduleParams = #claimmgmt_ScheduleModification{schedule = Schedule},
CashRegisterModificationUnit = #claimmgmt_CashRegisterModificationUnit{ CashRegisterModificationUnit = #claimmgmt_CashRegisterModificationUnit{
id = <<"1">>, id = <<"1">>,
modification = ?cm_cash_register_unit_creation(1, #{}) modification = ?cm_cash_register_unit_creation(1, #{})
@ -342,8 +311,6 @@ shop_complex_modification(C) ->
?cm_shop_modification(ShopID, {category_modification, NewCategory}), ?cm_shop_modification(ShopID, {category_modification, NewCategory}),
?cm_shop_modification(ShopID, {details_modification, NewDetails}), ?cm_shop_modification(ShopID, {details_modification, NewDetails}),
?cm_shop_modification(ShopID, {location_modification, NewLocation}), ?cm_shop_modification(ShopID, {location_modification, NewLocation}),
?cm_shop_modification(ShopID, {payout_tool_modification, PayoutToolID2}),
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams}),
?cm_shop_modification(ShopID, {cash_register_modification_unit, CashRegisterModificationUnit}), ?cm_shop_modification(ShopID, {cash_register_modification_unit, CashRegisterModificationUnit}),
?cm_shop_modification(ShopID, {turnover_limits_modification, TurnoverLimits}) ?cm_shop_modification(ShopID, {turnover_limits_modification, TurnoverLimits})
], ],
@ -354,8 +321,6 @@ shop_complex_modification(C) ->
category = NewCategory, category = NewCategory,
details = NewDetails, details = NewDetails,
location = NewLocation, location = NewLocation,
payout_tool_id = PayoutToolID2,
payout_schedule = Schedule,
turnover_limits = TurnoverLimits turnover_limits = TurnoverLimits
}} = get_shop(PartyID, ShopID, C). }} = get_shop(PartyID, ShopID, C).
@ -377,90 +342,20 @@ invalid_cash_register_modification(C) ->
{exception, ?cm_invalid_party_changeset(?cm_invalid_shop_not_exists(AnotherShopID), [{party_modification, Mod}])} = {exception, ?cm_invalid_party_changeset(?cm_invalid_shop_not_exists(AnotherShopID), [{party_modification, Mod}])} =
accept_claim(Claim, C). accept_claim(Claim, C).
-spec invalid_shop_payout_tool_not_in_contract(config()) -> _.
invalid_shop_payout_tool_not_in_contract(C) ->
PartyID = cfg(party_id, C),
Details = #domain_ShopDetails{
name = <<"SOME SHOP NAME">>,
description = <<"Very meaningfull description of the shop.">>
},
Category = ?cat(2),
Location = {url, <<"https://example.com">>},
ContractID = ?REAL_CONTRACT_ID1,
ShopID = ?REAL_SHOP_ID4,
ShopParams = #claimmgmt_ShopParams{
category = Category,
location = Location,
details = Details,
contract_id = ContractID,
payout_tool_id = ?REAL_PAYOUT_TOOL_ID1
},
Schedule = ?bussched(1),
ScheduleParams = #claimmgmt_ScheduleModification{schedule = Schedule},
Modifications = [
?cm_shop_creation(ShopID, ShopParams),
?cm_shop_account_creation(ShopID, ?cur(<<"USD">>)),
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
],
Claim = claim(Modifications, PartyID),
{exception,
?cm_invalid_party_changeset(
?cm_invalid_shop_payout_tool_currency_mismatch(
ShopID, ?REAL_PAYOUT_TOOL_ID1, ?cur(<<"USD">>), ?cur(<<"RUB">>)
),
_
)} =
accept_claim(Claim, C).
-spec invalid_shop_payout_tool_currency_mismatch(config()) -> _.
invalid_shop_payout_tool_currency_mismatch(C) ->
PartyID = cfg(party_id, C),
Details = #domain_ShopDetails{
name = <<"SOME SHOP NAME">>,
description = <<"Very meaningfull description of the shop.">>
},
Category = ?cat(2),
Location = {url, <<"https://example.com">>},
ContractID = ?REAL_CONTRACT_ID1,
ShopID = ?REAL_SHOP_ID4,
ShopParams = #claimmgmt_ShopParams{
category = Category,
location = Location,
details = Details,
contract_id = ContractID,
payout_tool_id = ?REAL_PAYOUT_TOOL_ID4
},
Schedule = ?bussched(1),
ScheduleParams = #claimmgmt_ScheduleModification{schedule = Schedule},
Modifications = [
?cm_shop_creation(ShopID, ShopParams),
?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>)),
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
],
Claim = claim(Modifications, PartyID),
{exception,
?cm_invalid_party_changeset(
?cm_invalid_shop_payout_tool_not_in_contract(ShopID, ContractID, ?REAL_PAYOUT_TOOL_ID4), _
)} =
accept_claim(Claim, C).
-spec shop_contract_modification(config()) -> _. -spec shop_contract_modification(config()) -> _.
shop_contract_modification(C) -> shop_contract_modification(C) ->
PartyID = cfg(party_id, C), PartyID = cfg(party_id, C),
ShopID = ?REAL_SHOP_ID, ShopID = ?REAL_SHOP_ID,
ContractID = ?REAL_CONTRACT_ID2, ContractID = ?REAL_CONTRACT_ID2,
PayoutToolID = ?REAL_PAYOUT_TOOL_ID1,
ShopContractParams = #claimmgmt_ShopContractModification{ ShopContractParams = #claimmgmt_ShopContractModification{
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}, },
Modifications = [?cm_shop_modification(ShopID, {contract_modification, ShopContractParams})], Modifications = [?cm_shop_modification(ShopID, {contract_modification, ShopContractParams})],
Claim = claim(Modifications, PartyID), Claim = claim(Modifications, PartyID),
ok = accept_claim(Claim, C), ok = accept_claim(Claim, C),
ok = commit_claim(Claim, C), ok = commit_claim(Claim, C),
{ok, #domain_Shop{ {ok, #domain_Shop{
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}} = get_shop(PartyID, ShopID, C). }} = get_shop(PartyID, ShopID, C).
-spec contract_termination(config()) -> _. -spec contract_termination(config()) -> _.
@ -524,16 +419,13 @@ shop_already_exists(C) ->
category = ?cat(2), category = ?cat(2),
location = {url, <<"https://example.com">>}, location = {url, <<"https://example.com">>},
details = Details, details = Details,
contract_id = ?REAL_CONTRACT_ID1, contract_id = ?REAL_CONTRACT_ID1
payout_tool_id = ?REAL_PAYOUT_TOOL_ID1
}, },
ScheduleParams = #claimmgmt_ScheduleModification{schedule = ?bussched(1)},
Mod = ?cm_shop_modification(ShopID, {creation, ShopParams}), Mod = ?cm_shop_modification(ShopID, {creation, ShopParams}),
Modifications = [ Modifications = [
Mod, Mod,
?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>)), ?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>))
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
], ],
Claim = claim(Modifications, PartyID), Claim = claim(Modifications, PartyID),
{exception, ?cm_invalid_party_changeset(?cm_invalid_shop_already_exists(ShopID), [{party_modification, Mod}])} = {exception, ?cm_invalid_party_changeset(?cm_invalid_shop_already_exists(ShopID), [{party_modification, Mod}])} =
@ -662,18 +554,6 @@ make_contract_params(ContractorID, TemplateRef, PaymentInstitutionRef) ->
payment_institution = PaymentInstitutionRef payment_institution = PaymentInstitutionRef
}. }.
make_payout_tool_params() ->
#claimmgmt_PayoutToolParams{
currency = ?cur(<<"RUB">>),
tool_info =
{russian_bank_account, #domain_RussianBankAccount{
account = <<"4276300010908312893">>,
bank_name = <<"SomeBank">>,
bank_post_account = <<"123129876">>,
bank_bik = <<"66642666">>
}}
}.
-spec construct_domain_fixture() -> [pm_domain:object()]. -spec construct_domain_fixture() -> [pm_domain:object()].
construct_domain_fixture() -> construct_domain_fixture() ->
TestTermSet = #domain_TermSet{ TestTermSet = #domain_TermSet{
@ -719,55 +599,6 @@ construct_domain_fixture() ->
) )
]} ]}
}, },
payouts = #domain_PayoutsServiceTerms{
payout_methods =
{decisions, [
#domain_PayoutMethodDecision{
if_ =
{condition,
{payment_tool,
{bank_card, #domain_BankCardCondition{
definition = {issuer_bank_is, ?bank(1)}
}}}},
then_ =
{value, ordsets:from_list([?pomt(russian_bank_account), ?pomt(international_bank_account)])}
},
#domain_PayoutMethodDecision{
if_ =
{condition,
{payment_tool,
{bank_card, #domain_BankCardCondition{
definition = {empty_cvv_is, true}
}}}},
then_ = {value, ordsets:from_list([])}
},
#domain_PayoutMethodDecision{
if_ = {condition, {payment_tool, {bank_card, #domain_BankCardCondition{}}}},
then_ = {value, ordsets:from_list([?pomt(russian_bank_account)])}
},
#domain_PayoutMethodDecision{
if_ = {condition, {payment_tool, {payment_terminal, #domain_PaymentTerminalCondition{}}}},
then_ = {value, ordsets:from_list([?pomt(international_bank_account)])}
},
#domain_PayoutMethodDecision{
if_ = {constant, true},
then_ = {value, ordsets:from_list([])}
}
]},
fees =
{value, [
?cfpost(
{merchant, settlement},
{merchant, payout},
?share(750, 1000, operation_amount)
),
?cfpost(
{merchant, settlement},
{system, settlement},
?share(250, 1000, operation_amount)
)
]}
},
wallets = #domain_WalletServiceTerms{ wallets = #domain_WalletServiceTerms{
currencies = {value, ordsets:from_list([?cur(<<"RUB">>)])} currencies = {value, ordsets:from_list([?cur(<<"RUB">>)])}
} }
@ -786,9 +617,6 @@ construct_domain_fixture() ->
pm_ct_fixture:construct_payment_method(?pmt(payment_terminal, ?pmt_srv(<<"euroset">>))), pm_ct_fixture:construct_payment_method(?pmt(payment_terminal, ?pmt_srv(<<"euroset">>))),
pm_ct_fixture:construct_payment_method(?pmt(bank_card, ?bank_card_no_cvv(<<"visa">>))), pm_ct_fixture:construct_payment_method(?pmt(bank_card, ?bank_card_no_cvv(<<"visa">>))),
pm_ct_fixture:construct_payout_method(?pomt(russian_bank_account)),
pm_ct_fixture:construct_payout_method(?pomt(international_bank_account)),
pm_ct_fixture:construct_proxy(?prx(1), <<"Dummy proxy">>), pm_ct_fixture:construct_proxy(?prx(1), <<"Dummy proxy">>),
pm_ct_fixture:construct_inspector(?insp(1), <<"Dummy Inspector">>, ?prx(1)), pm_ct_fixture:construct_inspector(?insp(1), <<"Dummy Inspector">>, ?prx(1)),
pm_ct_fixture:construct_system_account_set(?sas(1)), pm_ct_fixture:construct_system_account_set(?sas(1)),

View File

@ -11,7 +11,6 @@
-define(pmt(C, T), #domain_PaymentMethodRef{id = {C, T}}). -define(pmt(C, T), #domain_PaymentMethodRef{id = {C, T}}).
-define(pmt_sys(ID), #domain_PaymentSystemRef{id = ID}). -define(pmt_sys(ID), #domain_PaymentSystemRef{id = ID}).
-define(pmt_srv(ID), #domain_PaymentServiceRef{id = ID}). -define(pmt_srv(ID), #domain_PaymentServiceRef{id = ID}).
-define(pomt(M), #domain_PayoutMethodRef{id = M}).
-define(cat(ID), #domain_CategoryRef{id = ID}). -define(cat(ID), #domain_CategoryRef{id = ID}).
-define(prx(ID), #domain_ProxyRef{id = ID}). -define(prx(ID), #domain_ProxyRef{id = ID}).
-define(prv(ID), #domain_ProviderRef{id = ID}). -define(prv(ID), #domain_ProviderRef{id = ID}).

View File

@ -12,7 +12,6 @@
-export([construct_category/2]). -export([construct_category/2]).
-export([construct_category/3]). -export([construct_category/3]).
-export([construct_payment_method/1]). -export([construct_payment_method/1]).
-export([construct_payout_method/1]).
-export([construct_proxy/2]). -export([construct_proxy/2]).
-export([construct_proxy/4]). -export([construct_proxy/4]).
-export([construct_inspector/3]). -export([construct_inspector/3]).
@ -179,18 +178,6 @@ construct_tokenized_service(Ref, Name) ->
} }
}}. }}.
-spec construct_payout_method(dmsl_domain_thrift:'PayoutMethodRef'()) ->
{payout_method, dmsl_domain_thrift:'PayoutMethodObject'()}.
construct_payout_method(?pomt(M) = Ref) ->
Def = erlang:atom_to_binary(M, unicode),
{payout_method, #domain_PayoutMethodObject{
ref = Ref,
data = #domain_PayoutMethodDefinition{
name = Def,
description = Def
}
}}.
-spec construct_proxy(proxy(), name()) -> {proxy, dmsl_domain_thrift:'ProxyObject'()}. -spec construct_proxy(proxy(), name()) -> {proxy, dmsl_domain_thrift:'ProxyObject'()}.
construct_proxy(Ref, Name) -> construct_proxy(Ref, Name) ->
construct_proxy(Ref, Name, <<>>, #{}). construct_proxy(Ref, Name, <<>>, #{}).

View File

@ -14,12 +14,10 @@
-export([create_contract/3]). -export([create_contract/3]).
-export([get_first_contract_id/1]). -export([get_first_contract_id/1]).
-export([get_first_battle_ready_contract_id/1]). -export([get_first_battle_ready_contract_id/1]).
-export([get_first_payout_tool_id/2]).
-export([adjust_contract/3]). -export([adjust_contract/3]).
-export([make_battle_ready_contract_params/2]). -export([make_battle_ready_contract_params/2]).
-export([make_battle_ready_contractor/0]). -export([make_battle_ready_contractor/0]).
-export([make_battle_ready_payout_tool_params/0]).
-export([make_shop_details/1]). -export([make_shop_details/1]).
-export([make_shop_details/2]). -export([make_shop_details/2]).
@ -30,7 +28,6 @@
-include("pm_ct_domain.hrl"). -include("pm_ct_domain.hrl").
-include_lib("damsel/include/dmsl_base_thrift.hrl").
-include_lib("damsel/include/dmsl_domain_thrift.hrl"). -include_lib("damsel/include/dmsl_domain_thrift.hrl").
-export_type([config/0]). -export_type([config/0]).
@ -203,15 +200,12 @@ make_party_params() ->
create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef, Client) -> create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef, Client) ->
ContractID = pm_utils:unique_id(), ContractID = pm_utils:unique_id(),
ContractParams = make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef), ContractParams = make_battle_ready_contract_params(TemplateRef, PaymentInstitutionRef),
PayoutToolID = pm_utils:unique_id(),
PayoutToolParams = make_battle_ready_payout_tool_params(),
ShopID = pm_utils:unique_id(), ShopID = pm_utils:unique_id(),
ShopParams = #payproc_ShopParams{ ShopParams = #payproc_ShopParams{
category = Category, category = Category,
location = {url, <<>>}, location = {url, <<>>},
details = make_shop_details(<<"Battle Ready Shop">>), details = make_shop_details(<<"Battle Ready Shop">>),
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
}, },
ShopAccountParams = #payproc_ShopAccountParams{currency = ?cur(Currency)}, ShopAccountParams = #payproc_ShopAccountParams{currency = ?cur(Currency)},
Changeset = [ Changeset = [
@ -219,14 +213,6 @@ create_battle_ready_shop(Category, Currency, TemplateRef, PaymentInstitutionRef,
id = ContractID, id = ContractID,
modification = {creation, ContractParams} modification = {creation, ContractParams}
}}, }},
{contract_modification, #payproc_ContractModificationUnit{
id = ContractID,
modification =
{payout_tool_modification, #payproc_PayoutToolModificationUnit{
payout_tool_id = PayoutToolID,
modification = {creation, PayoutToolParams}
}}
}},
?shop_modification(ShopID, {creation, ShopParams}), ?shop_modification(ShopID, {creation, ShopParams}),
?shop_modification(ShopID, {shop_account_creation, ShopAccountParams}) ?shop_modification(ShopID, {shop_account_creation, ShopAccountParams})
], ],
@ -259,8 +245,7 @@ get_first_battle_ready_contract_id(Client) ->
fun({ID, Contract}, Acc) -> fun({ID, Contract}, Acc) ->
case Contract of case Contract of
#domain_Contract{ #domain_Contract{
contractor = {legal_entity, _}, contractor = {legal_entity, _}
payout_tools = [#domain_PayoutTool{} | _]
} -> } ->
[ID | Acc]; [ID | Acc];
_ -> _ ->
@ -307,16 +292,6 @@ ensure_claim_accepted(#payproc_Claim{id = ClaimID, revision = ClaimRevision, sta
ok = pm_client_party:accept_claim(ClaimID, ClaimRevision, Client) ok = pm_client_party:accept_claim(ClaimID, ClaimRevision, Client)
end. end.
-spec get_first_payout_tool_id(contract_id(), Client :: pid()) -> dmsl_domain_thrift:'PayoutToolID'().
get_first_payout_tool_id(ContractID, Client) ->
#domain_Contract{payout_tools = PayoutTools} = pm_client_party:get_contract(ContractID, Client),
case PayoutTools of
[Tool | _] ->
Tool#domain_PayoutTool.id;
[] ->
error(not_found)
end.
-spec make_battle_ready_contract_params( -spec make_battle_ready_contract_params(
dmsl_domain_thrift:'ContractTemplateRef'() | undefined, dmsl_domain_thrift:'ContractTemplateRef'() | undefined,
dmsl_domain_thrift:'PaymentInstitutionRef'() dmsl_domain_thrift:'PaymentInstitutionRef'()
@ -349,19 +324,6 @@ make_battle_ready_contractor() ->
russian_bank_account = BankAccount russian_bank_account = BankAccount
}}}. }}}.
-spec make_battle_ready_payout_tool_params() -> dmsl_payproc_thrift:'PayoutToolParams'().
make_battle_ready_payout_tool_params() ->
#payproc_PayoutToolParams{
currency = ?cur(<<"RUB">>),
tool_info =
{russian_bank_account, #domain_RussianBankAccount{
account = <<"4276300010908312893">>,
bank_name = <<"SomeBank">>,
bank_post_account = <<"123129876">>,
bank_bik = <<"66642666">>
}}
}.
-spec make_shop_details(binary()) -> dmsl_domain_thrift:'ShopDetails'(). -spec make_shop_details(binary()) -> dmsl_domain_thrift:'ShopDetails'().
make_shop_details(Name) -> make_shop_details(Name) ->
make_shop_details(Name, undefined). make_shop_details(Name, undefined).

View File

@ -83,16 +83,12 @@
-export([contract_expiration/1]). -export([contract_expiration/1]).
-export([contract_legal_agreement_binding/1]). -export([contract_legal_agreement_binding/1]).
-export([contract_report_preferences_modification/1]). -export([contract_report_preferences_modification/1]).
-export([contract_payout_tool_creation/1]).
-export([contract_payout_tool_modification/1]).
-export([contract_adjustment_creation/1]). -export([contract_adjustment_creation/1]).
-export([contract_adjustment_expiration/1]). -export([contract_adjustment_expiration/1]).
-export([contract_w2w_terms/1]). -export([contract_w2w_terms/1]).
-export([compute_payment_institution_terms/1]). -export([compute_payment_institution_terms/1]).
-export([compute_payment_institution/1]). -export([compute_payment_institution/1]).
-export([compute_payout_cash_flow/1]).
-export([compute_payout_cash_flow_payout_tool/1]).
-export([contractor_creation/1]). -export([contractor_creation/1]).
-export([contractor_modification/1]). -export([contractor_modification/1]).
@ -206,8 +202,6 @@ groups() ->
contract_report_preferences_modification, contract_report_preferences_modification,
contract_adjustment_creation, contract_adjustment_creation,
contract_adjustment_expiration, contract_adjustment_expiration,
contract_payout_tool_creation,
contract_payout_tool_modification,
compute_payment_institution_terms, compute_payment_institution_terms,
compute_payment_institution, compute_payment_institution,
contract_w2w_terms contract_w2w_terms
@ -223,8 +217,6 @@ groups() ->
shop_terms_retrieval, shop_terms_retrieval,
shop_already_exists, shop_already_exists,
shop_update, shop_update,
compute_payout_cash_flow,
compute_payout_cash_flow_payout_tool,
{group, shop_blocking_suspension} {group, shop_blocking_suspension}
]}, ]},
{shop_blocking_suspension, [sequence], [ {shop_blocking_suspension, [sequence], [
@ -492,14 +484,10 @@ end_per_testcase(_Name, _C) ->
-spec contract_expiration(config()) -> _ | no_return(). -spec contract_expiration(config()) -> _ | no_return().
-spec contract_legal_agreement_binding(config()) -> _ | no_return(). -spec contract_legal_agreement_binding(config()) -> _ | no_return().
-spec contract_report_preferences_modification(config()) -> _ | no_return(). -spec contract_report_preferences_modification(config()) -> _ | no_return().
-spec contract_payout_tool_creation(config()) -> _ | no_return().
-spec contract_payout_tool_modification(config()) -> _ | no_return().
-spec contract_adjustment_creation(config()) -> _ | no_return(). -spec contract_adjustment_creation(config()) -> _ | no_return().
-spec contract_adjustment_expiration(config()) -> _ | no_return(). -spec contract_adjustment_expiration(config()) -> _ | no_return().
-spec compute_payment_institution_terms(config()) -> _ | no_return(). -spec compute_payment_institution_terms(config()) -> _ | no_return().
-spec compute_payment_institution(config()) -> _ | no_return(). -spec compute_payment_institution(config()) -> _ | no_return().
-spec compute_payout_cash_flow(config()) -> _ | no_return().
-spec compute_payout_cash_flow_payout_tool(config()) -> _ | no_return().
-spec contract_w2w_terms(config()) -> _ | no_return(). -spec contract_w2w_terms(config()) -> _ | no_return().
-spec contractor_creation(config()) -> _ | no_return(). -spec contractor_creation(config()) -> _ | no_return().
-spec contractor_modification(config()) -> _ | no_return(). -spec contractor_modification(config()) -> _ | no_return().
@ -608,13 +596,10 @@ party_get_revision(C) ->
create_change_set(ID) -> create_change_set(ID) ->
ContractParams = make_contract_params(), ContractParams = make_contract_params(),
PayoutToolParams = pm_ct_helper:make_battle_ready_payout_tool_params(),
BinaryID = erlang:integer_to_binary(ID), BinaryID = erlang:integer_to_binary(ID),
ContractID = <<?REAL_CONTRACT_ID/binary, BinaryID/binary>>, ContractID = <<?REAL_CONTRACT_ID/binary, BinaryID/binary>>,
PayoutToolID = <<"1">>,
[ [
?contract_modification(ContractID, {creation, ContractParams}), ?contract_modification(ContractID, {creation, ContractParams})
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID, PayoutToolParams))
]. ].
contract_not_found(C) -> contract_not_found(C) ->
@ -623,17 +608,13 @@ contract_not_found(C) ->
contract_creation(C) -> contract_creation(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ContractParams = make_contract_params(), ContractParams = make_contract_params(),
PayoutToolParams = pm_ct_helper:make_battle_ready_payout_tool_params(),
ContractID = ?REAL_CONTRACT_ID, ContractID = ?REAL_CONTRACT_ID,
PayoutToolID = <<"1">>,
Changeset = [ Changeset = [
?contract_modification(ContractID, {creation, ContractParams}), ?contract_modification(ContractID, {creation, ContractParams})
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID, PayoutToolParams))
], ],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client), Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
ok = accept_claim(Claim, Client), ok = accept_claim(Claim, Client),
#domain_Contract{id = ContractID, payout_tools = PayoutTools} = pm_client_party:get_contract(ContractID, Client), #domain_Contract{id = ContractID} = pm_client_party:get_contract(ContractID, Client).
true = lists:keymember(PayoutToolID, #domain_PayoutTool.id, PayoutTools).
contract_terms_retrieval(C) -> contract_terms_retrieval(C) ->
Client = cfg(client, C), Client = cfg(client, C),
@ -718,11 +699,9 @@ contract_already_terminated(C) ->
contract_expiration(C) -> contract_expiration(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ContractParams = make_contract_params(?tmpl(3)), ContractParams = make_contract_params(?tmpl(3)),
PayoutToolParams = pm_ct_helper:make_battle_ready_payout_tool_params(),
ContractID = <<"CONTRACT_EXPIRED">>, ContractID = <<"CONTRACT_EXPIRED">>,
Changeset = [ Changeset = [
?contract_modification(ContractID, {creation, ContractParams}), ?contract_modification(ContractID, {creation, ContractParams})
?contract_modification(ContractID, ?payout_tool_creation(<<"1">>, PayoutToolParams))
], ],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client), Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
ok = accept_claim(Claim, Client), ok = accept_claim(Claim, Client),
@ -772,88 +751,6 @@ contract_report_preferences_modification(C) ->
report_preferences = Pref2 report_preferences = Pref2
} = pm_client_party:get_contract(ContractID, Client). } = pm_client_party:get_contract(ContractID, Client).
contract_payout_tool_creation(C) ->
Client = cfg(client, C),
ContractID = ?REAL_CONTRACT_ID,
PayoutToolID1 = <<"2">>,
PayoutToolParams1 = #payproc_PayoutToolParams{
currency = ?cur(<<"RUB">>),
tool_info =
{russian_bank_account, #domain_RussianBankAccount{
account = <<"4276300010908312893">>,
bank_name = <<"SomeBank">>,
bank_post_account = <<"123129876">>,
bank_bik = <<"66642666">>
}}
},
PayoutToolID2 = <<"3">>,
PayoutToolParams2 = #payproc_PayoutToolParams{
currency = ?cur(<<"USD">>),
tool_info =
{international_bank_account, #domain_InternationalBankAccount{
bank = #domain_InternationalBankDetails{
name = <<"SomeBank">>,
address = <<"Bahamas">>,
bic = <<"66642666">>
},
iban = <<"DC6664266612312312">>
}}
},
PayoutToolID3 = <<"4">>,
PayoutToolParams3 = #payproc_PayoutToolParams{
currency = ?cur(<<"USD">>),
tool_info =
{wallet_info, #domain_WalletInfo{
wallet_id = <<"123">>
}}
},
Changeset = [
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID1, PayoutToolParams1)),
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID2, PayoutToolParams2)),
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID3, PayoutToolParams3))
],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
ok = accept_claim(Claim, Client),
#domain_Contract{
id = ContractID,
payout_tools = PayoutTools
} = pm_client_party:get_contract(ContractID, Client),
true = lists:keymember(PayoutToolID1, #domain_PayoutTool.id, PayoutTools),
true = lists:keymember(PayoutToolID2, #domain_PayoutTool.id, PayoutTools),
true = lists:keymember(PayoutToolID3, #domain_PayoutTool.id, PayoutTools).
contract_payout_tool_modification(C) ->
Client = cfg(client, C),
ContractID = ?REAL_CONTRACT_ID,
PayoutToolID = <<"3">>,
ToolInfo =
{international_bank_account, #domain_InternationalBankAccount{
number = <<"123456789">>,
bank = #domain_InternationalBankDetails{
name = <<"ABetterBank">>,
address = <<"Burkina Faso">>,
bic = <<"BCAOBFBFBOB">>
},
correspondent_account = #domain_InternationalBankAccount{
number = <<"1111222233334444">>
},
iban = <<"BF42BF0840101300463574000390">>
}},
Changeset = [
?contract_modification(ContractID, ?payout_tool_info_modification(PayoutToolID, ToolInfo))
],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
ok = accept_claim(Claim, Client),
#domain_Contract{
id = ContractID,
payout_tools = PayoutTools
} = pm_client_party:get_contract(ContractID, Client),
#domain_PayoutTool{payout_tool_info = ToolInfo} = lists:keyfind(
PayoutToolID,
#domain_PayoutTool.id,
PayoutTools
).
contract_adjustment_creation(C) -> contract_adjustment_creation(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ContractID = ?REAL_CONTRACT_ID, ContractID = ?REAL_CONTRACT_ID,
@ -953,22 +850,22 @@ check_all_payment_methods(C) ->
TermsFun = fun(Type, Object) -> TermsFun = fun(Type, Object) ->
?assertMatch( ?assertMatch(
#domain_TermSet{ #domain_TermSet{
payouts = #domain_PayoutsServiceTerms{ payments = #domain_PaymentsServiceTerms{
payout_methods = payment_methods =
{value, [_]} {value, [_]}
} }
}, },
pm_client_party:compute_payment_institution_terms( pm_client_party:compute_payment_institution_terms(
?pinst(2), ?pinst(5),
#payproc_Varset{payment_method = ?pmt(Type, Object)}, #payproc_Varset{payment_method = ?pmt(Type, Object)},
Client Client
) )
), ),
ok ok
end, end,
#domain_TermSet{payouts = #domain_PayoutsServiceTerms{payout_methods = {value, []}}} = #domain_TermSet{payments = #domain_PaymentsServiceTerms{payment_methods = {value, []}}} =
pm_client_party:compute_payment_institution_terms( pm_client_party:compute_payment_institution_terms(
?pinst(2), ?pinst(5),
#payproc_Varset{payment_method = ?pmt(digital_wallet, ?pmt_srv(<<"wrong-ref">>))}, #payproc_Varset{payment_method = ?pmt(digital_wallet, ?pmt_srv(<<"wrong-ref">>))},
Client Client
), ),
@ -982,50 +879,6 @@ check_all_payment_methods(C) ->
TermsFun(bank_card, ?bank_card_no_cvv(<<"visa">>)), TermsFun(bank_card, ?bank_card_no_cvv(<<"visa">>)),
TermsFun(generic, ?gnrc(?pmt_srv(<<"generic">>))). TermsFun(generic, ?gnrc(?pmt_srv(<<"generic">>))).
compute_payout_cash_flow(C) ->
Client = cfg(client, C),
Params = #payproc_PayoutParams{
id = ?REAL_SHOP_ID,
amount = #domain_Cash{amount = 10000, currency = ?cur(<<"RUB">>)},
timestamp = pm_datetime:format_now()
},
[
#domain_FinalCashFlowPosting{
source = #domain_FinalCashFlowAccount{account_type = {merchant, settlement}},
destination = #domain_FinalCashFlowAccount{account_type = {merchant, payout}},
volume = #domain_Cash{amount = 7500, currency = ?cur(<<"RUB">>)}
},
#domain_FinalCashFlowPosting{
source = #domain_FinalCashFlowAccount{account_type = {merchant, settlement}},
destination = #domain_FinalCashFlowAccount{account_type = {system, settlement}},
volume = #domain_Cash{amount = 2500, currency = ?cur(<<"RUB">>)}
}
] = pm_client_party:compute_payout_cash_flow(Params, Client).
compute_payout_cash_flow_payout_tool(C) ->
Client = cfg(client, C),
Params = #payproc_PayoutParams{
id = ?REAL_SHOP_ID,
amount = #domain_Cash{amount = 10000, currency = ?cur(<<"RUB">>)},
timestamp = pm_datetime:format_now(),
payout_tool_id = <<"1">>
},
[
#domain_FinalCashFlowPosting{
source = #domain_FinalCashFlowAccount{account_type = {merchant, settlement}},
destination = #domain_FinalCashFlowAccount{account_type = {merchant, payout}},
volume = #domain_Cash{amount = 7500, currency = ?cur(<<"RUB">>)}
},
#domain_FinalCashFlowPosting{
source = #domain_FinalCashFlowAccount{account_type = {merchant, settlement}},
destination = #domain_FinalCashFlowAccount{account_type = {system, settlement}},
volume = #domain_Cash{amount = 2500, currency = ?cur(<<"RUB">>)}
}
] = pm_client_party:compute_payout_cash_flow(Params, Client),
{exception, #payproc_PayoutToolNotFound{}} = pm_client_party:compute_payout_cash_flow(
Params#payproc_PayoutParams{payout_tool_id = <<"Nope">>}, Client
).
contract_w2w_terms(C) -> contract_w2w_terms(C) ->
Client = cfg(client, C), Client = cfg(client, C),
ContractID = ?REAL_CONTRACT_ID, ContractID = ?REAL_CONTRACT_ID,
@ -1103,8 +956,7 @@ shop_creation(C) ->
category = ?cat(2), category = ?cat(2),
location = {url, <<"https://somename.somedomain/p/123?redirect=1">>}, location = {url, <<"https://somename.somedomain/p/123?redirect=1">>},
details = Details, details = Details,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = pm_ct_helper:get_first_payout_tool_id(ContractID, Client)
}, },
ShopAccountParams = #payproc_ShopAccountParams{currency = ?cur(<<"RUB">>)}, ShopAccountParams = #payproc_ShopAccountParams{currency = ?cur(<<"RUB">>)},
Changeset = [ Changeset = [
@ -1162,8 +1014,7 @@ shop_already_exists(C) ->
category = ?cat(2), category = ?cat(2),
location = {url, <<"https://s0mename.s0med0main">>}, location = {url, <<"https://s0mename.s0med0main">>},
details = Details, details = Details,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = pm_ct_helper:get_first_payout_tool_id(ContractID, Client)
}, },
Changeset = [?shop_modification(ShopID, {creation, Params})], Changeset = [?shop_modification(ShopID, {creation, Params})],
?invalid_changeset(?invalid_shop(ShopID, {already_exists, _})) = pm_client_party:create_claim(Changeset, Client). ?invalid_changeset(?invalid_shop(ShopID, {already_exists, _})) = pm_client_party:create_claim(Changeset, Client).
@ -1183,21 +1034,17 @@ shop_update(C) ->
ok = accept_claim(Claim2, Client), ok = accept_claim(Claim2, Client),
#domain_Shop{location = Location, details = Details} = pm_client_party:get_shop(ShopID, Client), #domain_Shop{location = Location, details = Details} = pm_client_party:get_shop(ShopID, Client),
PayoutToolParams = pm_ct_helper:make_battle_ready_payout_tool_params(),
ContractID = <<"CONTRACT_IN_DIFFERENT_PAYMENT_INST">>, ContractID = <<"CONTRACT_IN_DIFFERENT_PAYMENT_INST">>,
PayoutToolID = <<"1">>,
Changeset3 = [ Changeset3 = [
?contract_modification(ContractID, {creation, make_contract_params(?tmpl(2), ?pinst(3))}), ?contract_modification(ContractID, {creation, make_contract_params(?tmpl(2), ?pinst(3))}),
?contract_modification(ContractID, ?payout_tool_creation(PayoutToolID, PayoutToolParams)), ?shop_modification(ShopID, ?shop_contract_modification(ContractID))
?shop_modification(ShopID, ?shop_contract_modification(ContractID, PayoutToolID))
], ],
Claim3 = assert_claim_pending(pm_client_party:create_claim(Changeset3, Client), Client), Claim3 = assert_claim_pending(pm_client_party:create_claim(Changeset3, Client), Client),
ok = accept_claim(Claim3, Client), ok = accept_claim(Claim3, Client),
#domain_Shop{ #domain_Shop{
location = Location, location = Location,
details = Details, details = Details,
contract_id = ContractID, contract_id = ContractID
payout_tool_id = PayoutToolID
} = pm_client_party:get_shop(ShopID, Client). } = pm_client_party:get_shop(ShopID, Client).
shop_update_before_confirm(C) -> shop_update_before_confirm(C) ->
@ -1207,8 +1054,7 @@ shop_update_before_confirm(C) ->
Params = #payproc_ShopParams{ Params = #payproc_ShopParams{
location = {url, <<"">>}, location = {url, <<"">>},
details = pm_ct_helper:make_shop_details(<<"THRIFT SHOP">>, <<"Hot. Fancy. Almost free.">>), details = pm_ct_helper:make_shop_details(<<"THRIFT SHOP">>, <<"Hot. Fancy. Almost free.">>),
contract_id = ContractID, contract_id = ContractID
payout_tool_id = pm_ct_helper:get_first_payout_tool_id(ContractID, Client)
}, },
Changeset1 = [?shop_modification(ShopID, {creation, Params})], Changeset1 = [?shop_modification(ShopID, {creation, Params})],
Claim0 = assert_claim_pending(pm_client_party:create_claim(Changeset1, Client), Client), Claim0 = assert_claim_pending(pm_client_party:create_claim(Changeset1, Client), Client),
@ -1232,10 +1078,8 @@ shop_update_with_bad_params(C) ->
ShopID = <<"SHOP2">>, ShopID = <<"SHOP2">>,
ContractID = <<"CONTRACT3">>, ContractID = <<"CONTRACT3">>,
ContractParams = make_contract_params(#domain_ContractTemplateRef{id = 5}), ContractParams = make_contract_params(#domain_ContractTemplateRef{id = 5}),
PayoutToolParams = pm_ct_helper:make_battle_ready_payout_tool_params(),
Changeset = [ Changeset = [
?contract_modification(ContractID, {creation, ContractParams}), ?contract_modification(ContractID, {creation, ContractParams})
?contract_modification(ContractID, ?payout_tool_creation(<<"1">>, PayoutToolParams))
], ],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client), Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
ok = accept_claim(Claim, Client), ok = accept_claim(Claim, Client),
@ -1282,8 +1126,7 @@ claim_revocation(C) ->
Params = #payproc_ShopParams{ Params = #payproc_ShopParams{
location = {url, <<"https://url3">>}, location = {url, <<"https://url3">>},
details = pm_ct_helper:make_shop_details(<<"OOPS">>), details = pm_ct_helper:make_shop_details(<<"OOPS">>),
contract_id = ContractID, contract_id = ContractID
payout_tool_id = <<"1">>
}, },
Changeset = [?shop_modification(ShopID, {creation, Params})], Changeset = [?shop_modification(ShopID, {creation, Params})],
Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client), Claim = assert_claim_pending(pm_client_party:create_claim(Changeset, Client), Client),
@ -1299,16 +1142,14 @@ complex_claim_acceptance(C) ->
location = {url, <<"https://url4">>}, location = {url, <<"https://url4">>},
category = ?cat(2), category = ?cat(2),
details = Details1 = pm_ct_helper:make_shop_details(<<"SHOP4">>), details = Details1 = pm_ct_helper:make_shop_details(<<"SHOP4">>),
contract_id = ContractID, contract_id = ContractID
payout_tool_id = <<"1">>
}, },
ShopID2 = <<"SHOP5">>, ShopID2 = <<"SHOP5">>,
Params2 = #payproc_ShopParams{ Params2 = #payproc_ShopParams{
location = {url, <<"http://url5">>}, location = {url, <<"http://url5">>},
category = ?cat(3), category = ?cat(3),
details = Details2 = pm_ct_helper:make_shop_details(<<"SHOP5">>), details = Details2 = pm_ct_helper:make_shop_details(<<"SHOP5">>),
contract_id = ContractID, contract_id = ContractID
payout_tool_id = <<"1">>
}, },
PartyName = <<"PartyName">>, PartyName = <<"PartyName">>,
PartyComment = <<"PartyComment">>, PartyComment = <<"PartyComment">>,
@ -2284,22 +2125,76 @@ construct_domain_fixture() ->
} }
}, },
PayoutMDFun = fun(PaymentTool, PayoutMethods) -> AllMethodsTermSet = #domain_TermSet{
#domain_PayoutMethodDecision{
if_ = {condition, {payment_tool, PaymentTool}},
then_ = {value, ordsets:from_list(PayoutMethods)}
}
end,
PaymentMDFun = fun(PaymentTool, PaymentMethods) ->
#domain_PaymentMethodDecision{
if_ = {condition, {payment_tool, PaymentTool}},
then_ = {value, ordsets:from_list(PaymentMethods)}
}
end,
TermSet = #domain_TermSet{
payments = #domain_PaymentsServiceTerms{ payments = #domain_PaymentsServiceTerms{
payment_methods =
{decisions, [
%% For check_all_payment_methods
mk_payment_decision(
{bank_card, #domain_BankCardCondition{
definition = {
payment_system,
#domain_PaymentSystemCondition{
payment_system_is = ?pmt_sys(<<"visa">>)
}
}
}},
[?pmt(bank_card, ?bank_card(<<"visa">>))]
),
mk_payment_decision(
{payment_terminal, #domain_PaymentTerminalCondition{
definition = {
payment_service_is,
?pmt_srv(<<"alipay">>)
}
}},
[?pmt(payment_terminal, ?pmt_srv(<<"alipay">>))]
),
mk_payment_decision(
{digital_wallet, #domain_DigitalWalletCondition{
definition =
{payment_service_is, ?pmt_srv(<<"qiwi">>)}
}},
[?pmt(digital_wallet, ?pmt_srv(<<"qiwi">>))]
),
mk_payment_decision(
{mobile_commerce, #domain_MobileCommerceCondition{
definition = {operator_is, ?mob(<<"mts">>)}
}},
[?pmt(mobile, ?mob(<<"mts">>))]
),
mk_payment_decision(
{crypto_currency, #domain_CryptoCurrencyCondition{
definition = {crypto_currency_is, ?crypta(<<"bitcoin">>)}
}},
[?pmt(crypto_currency, ?crypta(<<"bitcoin">>))]
),
mk_payment_decision(
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
token_service_is = ?token_srv(<<"applepay">>)
}}
}},
[?pmt(bank_card, ?token_bank_card(<<"visa">>, <<"applepay">>))]
),
mk_payment_decision(
{generic, {payment_service_is, ?pmt_srv(<<"generic">>)}},
[?pmt(generic, ?gnrc(?pmt_srv(<<"generic">>)))]
),
#domain_PaymentMethodDecision{
if_ = {condition, {payment_tool, {bank_card, #domain_BankCardCondition{}}}},
then_ = {value, ordsets:from_list([?pmt(bank_card, ?bank_card(<<"mastercard">>))])}
},
#domain_PaymentMethodDecision{
if_ = {condition, {payment_tool, {payment_terminal, #domain_PaymentTerminalCondition{}}}},
then_ = {value, ordsets:from_list([?pmt(payment_terminal, ?pmt_srv(<<"euroset">>))])}
},
#domain_PaymentMethodDecision{
if_ = {constant, true},
then_ = {value, ordsets:from_list([])}
}
]},
cash_limit = cash_limit =
{value, #domain_CashRange{ {value, #domain_CashRange{
lower = {inclusive, #domain_Cash{amount = 1000, currency = ?cur(<<"RUB">>)}}, lower = {inclusive, #domain_Cash{amount = 1000, currency = ?cur(<<"RUB">>)}},
@ -2313,96 +2208,44 @@ construct_domain_fixture() ->
?share(45, 1000, operation_amount) ?share(45, 1000, operation_amount)
) )
]} ]}
}
}, },
payouts = #domain_PayoutsServiceTerms{
payout_methods =
{decisions, [
PayoutMDFun(
{bank_card, #domain_BankCardCondition{definition = {issuer_bank_is, ?bank(1)}}},
[?pomt(russian_bank_account), ?pomt(international_bank_account)]
),
PayoutMDFun(
{bank_card, #domain_BankCardCondition{definition = {empty_cvv_is, true}}},
[?pomt(wallet_info)]
),
%% For check_all_payment_methods TermSet = #domain_TermSet{
PayoutMDFun( recurrent_paytools = #domain_RecurrentPaytoolsServiceTerms{
{bank_card, #domain_BankCardCondition{ payment_methods =
definition = { {decisions, [
payment_system, mk_payment_decision(
#domain_PaymentSystemCondition{ {bank_card, #domain_BankCardCondition{definition = {issuer_bank_is, ?bank(1)}}},
payment_system_is = ?pmt_sys(<<"visa">>) [?pmt(bank_card, ?bank_card(<<"visa">>)), ?pmt(crypto_currency, ?crypta(<<"bitcoin">>))]
}
}
}},
[?pomt(international_bank_account)]
), ),
PayoutMDFun( mk_payment_decision({bank_card, #domain_BankCardCondition{definition = {empty_cvv_is, true}}}, []),
{payment_terminal, #domain_PaymentTerminalCondition{ mk_payment_decision(
definition = { {bank_card, #domain_BankCardCondition{}},
payment_service_is, [?pmt(bank_card, ?bank_card(<<"visa">>))]
?pmt_srv(<<"alipay">>)
}
}},
[?pomt(wallet_info)]
), ),
PayoutMDFun( mk_payment_decision(
{digital_wallet, #domain_DigitalWalletCondition{ {payment_terminal, #domain_PaymentTerminalCondition{}},
definition = [?pmt(crypto_currency, ?crypta(<<"bitcoin">>))]
{payment_service_is, ?pmt_srv(<<"qiwi">>)}
}},
[?pomt(wallet_info)]
), ),
PayoutMDFun( #domain_PaymentMethodDecision{
{mobile_commerce, #domain_MobileCommerceCondition{
definition = {operator_is, ?mob(<<"mts">>)}
}},
[?pomt(wallet_info)]
),
PayoutMDFun(
{crypto_currency, #domain_CryptoCurrencyCondition{
definition = {crypto_currency_is, ?crypta(<<"bitcoin">>)}
}},
[?pomt(wallet_info)]
),
PayoutMDFun(
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
token_service_is = ?token_srv(<<"applepay">>)
}}
}},
[?pomt(wallet_info)]
),
PayoutMDFun(
{generic, {payment_service_is, ?pmt_srv(<<"generic">>)}},
[?pomt(wallet_info)]
),
#domain_PayoutMethodDecision{
if_ = {condition, {payment_tool, {bank_card, #domain_BankCardCondition{}}}},
then_ = {value, ordsets:from_list([?pomt(russian_bank_account)])}
},
#domain_PayoutMethodDecision{
if_ = {condition, {payment_tool, {payment_terminal, #domain_PaymentTerminalCondition{}}}},
then_ = {value, ordsets:from_list([?pomt(international_bank_account)])}
},
#domain_PayoutMethodDecision{
if_ = {constant, true}, if_ = {constant, true},
then_ = {value, ordsets:from_list([])} then_ = {value, ordsets:from_list([])}
} }
]}, ]}
},
payments = #domain_PaymentsServiceTerms{
cash_limit =
{value, #domain_CashRange{
lower = {inclusive, #domain_Cash{amount = 1000, currency = ?cur(<<"RUB">>)}},
upper = {exclusive, #domain_Cash{amount = 4200000, currency = ?cur(<<"RUB">>)}}
}},
fees = fees =
{value, [ {value, [
?cfpost(
{merchant, settlement},
{merchant, payout},
?share(750, 1000, operation_amount)
),
?cfpost( ?cfpost(
{merchant, settlement}, {merchant, settlement},
{system, settlement}, {system, settlement},
?share(250, 1000, operation_amount) ?share(45, 1000, operation_amount)
) )
]} ]}
}, },
@ -2432,7 +2275,7 @@ construct_domain_fixture() ->
withdrawals = #domain_WithdrawalServiceTerms{ withdrawals = #domain_WithdrawalServiceTerms{
methods = methods =
{decisions, [ {decisions, [
PaymentMDFun( mk_payment_decision(
{bank_card, #domain_BankCardCondition{ {bank_card, #domain_BankCardCondition{
definition = { definition = {
payment_system, payment_system,
@ -2443,20 +2286,20 @@ construct_domain_fixture() ->
}}, }},
[?pmt(bank_card, ?bank_card(<<"visa">>))] [?pmt(bank_card, ?bank_card(<<"visa">>))]
), ),
PaymentMDFun( mk_payment_decision(
{digital_wallet, #domain_DigitalWalletCondition{ {digital_wallet, #domain_DigitalWalletCondition{
definition = definition =
{payment_service_is, ?pmt_srv(<<"qiwi">>)} {payment_service_is, ?pmt_srv(<<"qiwi">>)}
}}, }},
[?pmt(bank_card, ?bank_card(<<"visa">>))] [?pmt(bank_card, ?bank_card(<<"visa">>))]
), ),
PaymentMDFun( mk_payment_decision(
{mobile_commerce, #domain_MobileCommerceCondition{ {mobile_commerce, #domain_MobileCommerceCondition{
definition = {operator_is, ?mob(<<"mts">>)} definition = {operator_is, ?mob(<<"mts">>)}
}}, }},
[?pmt(bank_card, ?bank_card(<<"visa">>))] [?pmt(bank_card, ?bank_card(<<"visa">>))]
), ),
PaymentMDFun( mk_payment_decision(
{crypto_currency, #domain_CryptoCurrencyCondition{ {crypto_currency, #domain_CryptoCurrencyCondition{
definition = {crypto_currency_is, ?crypta(<<"bitcoin">>)} definition = {crypto_currency_is, ?crypta(<<"bitcoin">>)}
}}, }},
@ -2662,10 +2505,6 @@ construct_domain_fixture() ->
pm_ct_fixture:construct_payment_method(?pmt(payment_terminal, ?pmt_srv(<<"euroset">>))), pm_ct_fixture:construct_payment_method(?pmt(payment_terminal, ?pmt_srv(<<"euroset">>))),
pm_ct_fixture:construct_payment_method(?pmt(bank_card, ?bank_card_no_cvv(<<"visa">>))), pm_ct_fixture:construct_payment_method(?pmt(bank_card, ?bank_card_no_cvv(<<"visa">>))),
pm_ct_fixture:construct_payout_method(?pomt(russian_bank_account)),
pm_ct_fixture:construct_payout_method(?pomt(international_bank_account)),
pm_ct_fixture:construct_payout_method(?pomt(wallet_info)),
pm_ct_fixture:construct_proxy( pm_ct_fixture:construct_proxy(
?prx(1), ?prx(1),
<<"Dummy proxy">>, <<"Dummy proxy">>,
@ -2754,6 +2593,20 @@ construct_domain_fixture() ->
} }
}}, }},
%% For check_all_payment_methods
{payment_institution, #domain_PaymentInstitutionObject{
ref = ?pinst(5),
data = #domain_PaymentInstitution{
name = <<"All Payments GmbH">>,
system_account_set = {value, ?sas(2)},
default_contract_template = {value, ?tmpl(6)},
providers = {value, ?ordset([])},
inspector = {value, ?insp(1)},
residences = [],
realm = live
}
}},
{globals, #domain_GlobalsObject{ {globals, #domain_GlobalsObject{
ref = #domain_GlobalsRef{}, ref = #domain_GlobalsRef{},
data = #domain_Globals{ data = #domain_Globals{
@ -2764,7 +2617,7 @@ construct_domain_fixture() ->
then_ = {value, ?eas(1)} then_ = {value, ?eas(1)}
} }
]}, ]},
payment_institutions = ?ordset([?pinst(1), ?pinst(2)]) payment_institutions = ?ordset([?pinst(1), ?pinst(2), ?pinst(5)])
} }
}}, }},
pm_ct_fixture:construct_contract_template( pm_ct_fixture:construct_contract_template(
@ -2791,6 +2644,11 @@ construct_domain_fixture() ->
?tmpl(5), ?tmpl(5),
?trms(4) ?trms(4)
), ),
%% For check_all_payment_methods
pm_ct_fixture:construct_contract_template(
?tmpl(6),
?trms(5)
),
pm_ct_fixture:construct_term_set_hierarchy(?trms(1), undefined, TestTermSet), pm_ct_fixture:construct_term_set_hierarchy(?trms(1), undefined, TestTermSet),
pm_ct_fixture:construct_term_set_hierarchy(?trms(2), undefined, DefaultTermSet), pm_ct_fixture:construct_term_set_hierarchy(?trms(2), undefined, DefaultTermSet),
pm_ct_fixture:construct_term_set_hierarchy(?trms(3), ?trms(2), TermSet), pm_ct_fixture:construct_term_set_hierarchy(?trms(3), ?trms(2), TermSet),
@ -2817,6 +2675,8 @@ construct_domain_fixture() ->
} }
} }
), ),
%% For check_all_payment_methods
pm_ct_fixture:construct_term_set_hierarchy(?trms(5), ?trms(2), AllMethodsTermSet),
{bank, #domain_BankObject{ {bank, #domain_BankObject{
ref = ?bank(1), ref = ?bank(1),
data = #domain_Bank{ data = #domain_Bank{
@ -3124,3 +2984,9 @@ construct_domain_fixture() ->
} }
}} }}
]. ].
mk_payment_decision(PaymentTool, PaymentMethods) ->
#domain_PaymentMethodDecision{
if_ = {condition, {payment_tool, PaymentTool}},
then_ = {value, ordsets:from_list(PaymentMethods)}
}.

View File

@ -27,7 +27,6 @@
-export([compute_shop_terms/5]). -export([compute_shop_terms/5]).
-export([compute_payment_institution_terms/3]). -export([compute_payment_institution_terms/3]).
-export([compute_payment_institution/4]). -export([compute_payment_institution/4]).
-export([compute_payout_cash_flow/2]).
-export([block_shop/3]). -export([block_shop/3]).
-export([unblock_shop/3]). -export([unblock_shop/3]).
@ -179,11 +178,6 @@ compute_payment_institution_terms(Ref, Varset, Client) ->
compute_payment_institution(Ref, DomainRevision, Varset, Client) -> compute_payment_institution(Ref, DomainRevision, Varset, Client) ->
call(Client, 'ComputePaymentInstitution', [Ref, DomainRevision, Varset]). call(Client, 'ComputePaymentInstitution', [Ref, DomainRevision, Varset]).
-spec compute_payout_cash_flow(dmsl_payproc_thrift:'PayoutParams'(), pid()) ->
dmsl_domain_thrift:'FinalCashFlow'() | woody_error:business_error().
compute_payout_cash_flow(Params, Client) ->
call(Client, 'ComputePayoutCashFlow', with_party_id([Params])).
-spec get_shop(shop_id(), pid()) -> dmsl_domain_thrift:'Shop'() | woody_error:business_error(). -spec get_shop(shop_id(), pid()) -> dmsl_domain_thrift:'Shop'() | woody_error:business_error().
get_shop(ID, Client) -> get_shop(ID, Client) ->
call(Client, 'GetShop', with_party_id([ID])). call(Client, 'GetShop', with_party_id([ID])).

View File

@ -1,5 +1,20 @@
services: services:
dominant:
environment: &otlp_enabled
OTEL_TRACES_EXPORTER: otlp
OTEL_TRACES_SAMPLER: parentbased_always_off
OTEL_EXPORTER_OTLP_PROTOCOL: http_protobuf
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
machinegun:
environment: *otlp_enabled
testrunner: testrunner:
environment:
<<: *otlp_enabled
OTEL_SERVICE_NAME: party-management_testrunner
OTEL_TRACES_SAMPLER: parentbased_always_on
depends_on: depends_on:
jaeger: jaeger:
condition: service_healthy condition: service_healthy

View File

@ -24,7 +24,7 @@ services:
command: /sbin/init command: /sbin/init
dominant: dominant:
image: ghcr.io/valitydev/dominant:sha-2150eea image: ghcr.io/valitydev/dominant:sha-1c283be-epic-IMP-278-fx-retire-payouts
depends_on: depends_on:
- machinegun - machinegun
ports: ports:
@ -39,15 +39,15 @@ services:
retries: 20 retries: 20
machinegun: machinegun:
image: ghcr.io/valitydev/machinegun:sha-5c0db56 image: ghcr.io/valitydev/mg2:sha-8bbcd29
command: /opt/machinegun/bin/machinegun foreground command: /opt/machinegun/bin/machinegun foreground
volumes: volumes:
- ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml - ./test/machinegun/config.yaml:/opt/machinegun/etc/config.yaml
- ./test/machinegun/cookie:/opt/machinegun/etc/cookie - ./test/machinegun/cookie:/opt/machinegun/etc/cookie
healthcheck: healthcheck:
test: "/opt/machinegun/bin/machinegun ping" test: "/opt/machinegun/bin/machinegun ping"
interval: 5s interval: 10s
timeout: 1s timeout: 5s
retries: 10 retries: 10
shumway: shumway:

View File

@ -69,16 +69,6 @@
}} }}
]}, ]},
{how_are_you, [
{metrics_publishers, [
% {hay_statsd_publisher, #{
% key_prefix => <<"hellgate.">>,
% host => "localhost",
% port => 8125
% }}
]}
]},
{snowflake, [ {snowflake, [
{max_backward_clock_moving, 1000}, % 1 second {max_backward_clock_moving, 1000}, % 1 second
{machine_id, hostname_hash} {machine_id, hostname_hash}
@ -86,5 +76,9 @@
{prometheus, [ {prometheus, [
{collectors, [default]} {collectors, [default]}
]},
{hackney, [
{mod_metrics, woody_hackney_prometheus}
]} ]}
]. ].

View File

@ -29,6 +29,8 @@
{cache, "2.3.3"}, {cache, "2.3.3"},
{gproc, "0.9.0"}, {gproc, "0.9.0"},
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}}, {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
{prometheus, "4.8.1"},
{prometheus_cowboy, "0.1.8"},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}}, {woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}, {damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}},
{payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}}, {payproc_errors, {git, "https://github.com/valitydev/payproc-errors-erlang.git", {branch, "master"}}},
@ -68,12 +70,6 @@
{profiles, [ {profiles, [
{prod, [ {prod, [
{deps, [ {deps, [
% Because of a dependency conflict, prometheus libs are only included in the prod profile for now
% https://github.com/valitydev/hellgate/pull/2/commits/884724c1799703cee4d1033850fe32c17f986d9e
{prometheus, "4.8.1"},
{prometheus_cowboy, "0.1.8"},
{how_are_you, {git, "https://github.com/valitydev/how_are_you.git", {ref, "2fd80134"}}},
{woody_api_hay, {git, "https://github.com/valitydev/woody_api_hay.git", {ref, "4c39134cd"}}},
% for introspection on production % for introspection on production
{recon, "2.5.2"}, {recon, "2.5.2"},
{logger_logstash_formatter, {logger_logstash_formatter,
@ -88,8 +84,6 @@
{tools, load}, {tools, load},
{opentelemetry, temporary}, {opentelemetry, temporary},
{logger_logstash_formatter, load}, {logger_logstash_formatter, load},
woody_api_hay,
how_are_you,
prometheus, prometheus,
prometheus_cowboy, prometheus_cowboy,
sasl, sasl,
@ -118,3 +112,11 @@
{files, ["apps/*/{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config"]}, {files, ["apps/*/{src,include,test}/*.{hrl,erl}", "rebar.config", "elvis.config"]},
{exclude_files, ["apps/pm_proto/{src,include}/*_thrift.*rl"]} {exclude_files, ["apps/pm_proto/{src,include}/*_thrift.*rl"]}
]}. ]}.
%% NOTE
%% It is needed to use rebar3 lint plugin
{overrides, [
{del, accept, [{plugins, [{rebar3_archive_plugin, "0.0.2"}]}]},
{del, prometheus_cowboy, [{plugins, [{rebar3_archive_plugin, "0.0.1"}]}]},
{del, prometheus_httpd, [{plugins, [{rebar3_archive_plugin, "0.0.1"}]}]}
]}.

View File

@ -1,5 +1,6 @@
{"1.2.0", {"1.2.0",
[{<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},2}, [{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
{<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},2},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0}, {<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2},
{<<"cg_mon">>, {<<"cg_mon">>,
@ -12,15 +13,15 @@
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2}, {<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},2},
{<<"damsel">>, {<<"damsel">>,
{git,"https://github.com/valitydev/damsel.git", {git,"https://github.com/valitydev/damsel.git",
{ref,"02e0ec0db6fc70c30a97d61af3729c4e09df4a88"}}, {ref,"8e034bc74b1f4ed0e00dd63d0c3ca9c922be1c47"}},
0}, 0},
{<<"dmt_client">>, {<<"dmt_client">>,
{git,"https://github.com/valitydev/dmt_client.git", {git,"https://github.com/valitydev/dmt_client.git",
{ref,"b8bc0281dbf1e55a1a67ef6da861e0353ff14913"}}, {ref,"d8a4f490d49c038d96f1cbc2a279164c6f4039f9"}},
0}, 0},
{<<"dmt_core">>, {<<"dmt_core">>,
{git,"https://github.com/valitydev/dmt-core.git", {git,"https://github.com/valitydev/dmt-core.git",
{ref,"75841332fe0b40a77da0c12ea8d5dbb994da8e82"}}, {ref,"19d8f57198f2cbe5b64aa4a923ba32774e505503"}},
1}, 1},
{<<"erl_health">>, {<<"erl_health">>,
{git,"https://github.com/valitydev/erlang-health.git", {git,"https://github.com/valitydev/erlang-health.git",
@ -39,9 +40,9 @@
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
{<<"mg_proto">>, {<<"mg_proto">>,
{git,"https://github.com/valitydev/machinegun-proto.git", {git,"https://github.com/valitydev/machinegun-proto.git",
{ref,"f32e92d16fdcf92a35903d267b2bfec94f64a117"}}, {ref,"3decc8f8b13c9cd1701deab47781aacddd7dbc92"}},
0}, 0},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.3.0">>},2},
{<<"opentelemetry">>,{pkg,<<"opentelemetry">>,<<"1.3.0">>},0}, {<<"opentelemetry">>,{pkg,<<"opentelemetry">>,<<"1.3.0">>},0},
{<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.2.1">>},0}, {<<"opentelemetry_api">>,{pkg,<<"opentelemetry_api">>,<<"1.2.1">>},0},
{<<"opentelemetry_exporter">>, {<<"opentelemetry_exporter">>,
@ -55,8 +56,10 @@
{git,"https://github.com/valitydev/payproc-errors-erlang.git", {git,"https://github.com/valitydev/payproc-errors-erlang.git",
{ref,"8ae8586239ef68098398acf7eb8363d9ec3b3234"}}, {ref,"8ae8586239ef68098398acf7eb8363d9ec3b3234"}},
0}, 0},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.8.1">>},1}, {<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.8.1">>},0},
{<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},2}, {<<"prometheus_cowboy">>,{pkg,<<"prometheus_cowboy">>,<<"0.1.8">>},0},
{<<"prometheus_httpd">>,{pkg,<<"prometheus_httpd">>,<<"2.1.11">>},1},
{<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2},
{<<"scoper">>, {<<"scoper">>,
{git,"https://github.com/valitydev/scoper.git", {git,"https://github.com/valitydev/scoper.git",
@ -77,10 +80,11 @@
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2},
{<<"woody">>, {<<"woody">>,
{git,"https://github.com/valitydev/woody_erlang.git", {git,"https://github.com/valitydev/woody_erlang.git",
{ref,"3e2337a818086f33f0a1ede5d204aee7744c7c36"}}, {ref,"072825ee7179825a4078feb0649df71303c74157"}},
0}]}. 0}]}.
[ [
{pkg_hash,[ {pkg_hash,[
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
{<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>}, {<<"acceptor_pool">>, <<"43C20D2ACAE35F0C2BCD64F9D2BDE267E459F0F3FD23DAB26485BF518C281B21">>},
{<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>}, {<<"cache">>, <<"B23A5FE7095445A88412A6E614C933377E0137B44FFED77C9B3FEF1A731A20B2">>},
{<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>}, {<<"certifi">>, <<"D4FB0A6BB20B7C9C3643E22507E42F356AC090A1DCEA9AB99E27E0376D695EBA">>},
@ -95,19 +99,22 @@
{<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>}, {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>},
{<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, {<<"mimerl">>, <<"D0CD9FC04B9061F82490F6581E0128379830E78535E017F7780F37FEA7545726">>},
{<<"opentelemetry">>, <<"988AC3C26ACAC9720A1D4FB8D9DC52E95B45ECFEC2D5B5583276A09E8936BC5E">>}, {<<"opentelemetry">>, <<"988AC3C26ACAC9720A1D4FB8D9DC52E95B45ECFEC2D5B5583276A09E8936BC5E">>},
{<<"opentelemetry_api">>, <<"7B69ED4F40025C005DE0B74FCE8C0549625D59CB4DF12D15C32FE6DC5076FF42">>}, {<<"opentelemetry_api">>, <<"7B69ED4F40025C005DE0B74FCE8C0549625D59CB4DF12D15C32FE6DC5076FF42">>},
{<<"opentelemetry_exporter">>, <<"1D8809C0D4F4ACF986405F7700ED11992BCBDB6A4915DD11921E80777FFA7167">>}, {<<"opentelemetry_exporter">>, <<"1D8809C0D4F4ACF986405F7700ED11992BCBDB6A4915DD11921E80777FFA7167">>},
{<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>}, {<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>},
{<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>}, {<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>},
{<<"prometheus">>, <<"FA76B152555273739C14B06F09F485CF6D5D301FE4E9D31B7FF803D26025D7A0">>}, {<<"prometheus">>, <<"FA76B152555273739C14B06F09F485CF6D5D301FE4E9D31B7FF803D26025D7A0">>},
{<<"prometheus_cowboy">>, <<"CFCE0BC7B668C5096639084FCD873826E6220EA714BF60A716F5BD080EF2A99C">>},
{<<"prometheus_httpd">>, <<"F616ED9B85B536B195D94104063025A91F904A4CFC20255363F49A197D96C896">>},
{<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>}, {<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>},
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>}, {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
{<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>}, {<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>},
{<<"tls_certificate_check">>, <<"C76C4C5D79EE79A2B11C84F910C825D6F024A78427C854F515748E9BD025E987">>}, {<<"tls_certificate_check">>, <<"C76C4C5D79EE79A2B11C84F910C825D6F024A78427C854F515748E9BD025E987">>},
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[ {pkg_hash_ext,[
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
{<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>}, {<<"acceptor_pool">>, <<"0CBCD83FDC8B9AD2EEE2067EF8B91A14858A5883CB7CD800E6FCD5803E158788">>},
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>}, {<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
{<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>}, {<<"certifi">>, <<"6AC7EFC1C6F8600B08D625292D4BBF584E14847CE1B6B5C44D983D273E1097EA">>},
@ -122,13 +129,15 @@
{<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>}, {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>},
{<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>},
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, {<<"mimerl">>, <<"A1E15A50D1887217DE95F0B9B0793E32853F7C258A5CD227650889B38839FE9D">>},
{<<"opentelemetry">>, <<"8E09EDC26AAD11161509D7ECAD854A3285D88580F93B63B0B1CF0BAC332BFCC0">>}, {<<"opentelemetry">>, <<"8E09EDC26AAD11161509D7ECAD854A3285D88580F93B63B0B1CF0BAC332BFCC0">>},
{<<"opentelemetry_api">>, <<"6D7A27B7CAD2AD69A09CABF6670514CAFCEC717C8441BEB5C96322BAC3D05350">>}, {<<"opentelemetry_api">>, <<"6D7A27B7CAD2AD69A09CABF6670514CAFCEC717C8441BEB5C96322BAC3D05350">>},
{<<"opentelemetry_exporter">>, <<"2B40007F509D38361744882FD060A8841AF772AB83BB542AA5350908B303AD65">>}, {<<"opentelemetry_exporter">>, <<"2B40007F509D38361744882FD060A8841AF772AB83BB542AA5350908B303AD65">>},
{<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>}, {<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>},
{<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>}, {<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>},
{<<"prometheus">>, <<"6EDFBE928D271C7F657A6F2C46258738086584BD6CAE4A000B8B9A6009BA23A5">>}, {<<"prometheus">>, <<"6EDFBE928D271C7F657A6F2C46258738086584BD6CAE4A000B8B9A6009BA23A5">>},
{<<"prometheus_cowboy">>, <<"BA286BECA9302618418892D37BCD5DC669A6CC001F4EB6D6AF85FF81F3F4F34C">>},
{<<"prometheus_httpd">>, <<"0BBE831452CFDF9588538EB2F570B26F30C348ADAE5E95A7D87F35A5910BCF92">>},
{<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>}, {<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>},
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>}, {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
{<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>}, {<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>},

View File

@ -3,10 +3,6 @@ erlang:
secret_cookie_file: "/opt/machinegun/etc/cookie" secret_cookie_file: "/opt/machinegun/etc/cookie"
namespaces: namespaces:
party: party:
event_sinks:
machine:
type: machine
machine_id: payproc
processor: processor:
url: http://party-management:8022/v1/stateproc/party url: http://party-management:8022/v1/stateproc/party
pool_size: 300 pool_size: 300
@ -25,9 +21,3 @@ woody_server:
logging: logging:
out_type: stdout out_type: stdout
level: info level: info
opentelemetry:
service_name: machinegun
exporter:
protocol: http/protobuf
endpoint: http://jaeger:4318