mirror of
https://github.com/valitydev/hellgate.git
synced 2024-11-06 10:55:22 +00:00
Acts second try (#214)
* Revert "Revert "HG-370: support reporting preferences modification (#208) (#209)" (#212)"
This reverts commit 03ad14a90e
.
* fix PayoutScheduleRef unmarshalling
This commit is contained in:
parent
03ad14a90e
commit
6bccc80200
@ -36,7 +36,6 @@
|
||||
-define(legacy_claim_updated(ID, Changeset, ClaimRevision, Timestamp),
|
||||
{claim_updated, {payproc_ClaimUpdated, ID, Changeset, ClaimRevision, Timestamp}}).
|
||||
|
||||
|
||||
-define(legacy_contract_modification(ID, Modification),
|
||||
{contract_modification, {payproc_ContractModificationUnit, ID, Modification}}).
|
||||
|
||||
@ -100,10 +99,16 @@
|
||||
Bic
|
||||
}).
|
||||
|
||||
-define(legacy_shop_modification(ID, Modification),
|
||||
{shop_modification, {payproc_ShopModificationUnit, ID, Modification}}).
|
||||
|
||||
-define(legacy_schedule_modification(PayoutScheduleRef),
|
||||
{payproc_ScheduleModification, PayoutScheduleRef}).
|
||||
|
||||
-define(legacy_shop_effect(ID, Effect),
|
||||
{shop_effect, {payproc_ShopEffectUnit, ID, Effect}}).
|
||||
|
||||
-define(legacy_shop(ID, CreatedAt, Blocking, Suspension, Details, Location, Category, Account, ContractID, PayoutToolID),
|
||||
-define(legacy_shop_v2(ID, CreatedAt, Blocking, Suspension, Details, Location, Category, Account, ContractID, PayoutToolID),
|
||||
{domain_Shop,
|
||||
ID,
|
||||
CreatedAt,
|
||||
@ -117,6 +122,39 @@
|
||||
PayoutToolID
|
||||
}).
|
||||
|
||||
-define(legacy_shop_v3(
|
||||
ID,
|
||||
CreatedAt,
|
||||
Blocking,
|
||||
Suspension,
|
||||
Details,
|
||||
Location,
|
||||
Category,
|
||||
Account,
|
||||
ContractID,
|
||||
PayoutToolID,
|
||||
PayoutScheduleRef
|
||||
),
|
||||
{domain_Shop,
|
||||
ID,
|
||||
CreatedAt,
|
||||
Blocking,
|
||||
Suspension,
|
||||
Details,
|
||||
Location,
|
||||
Category,
|
||||
Account,
|
||||
ContractID,
|
||||
PayoutToolID,
|
||||
PayoutScheduleRef
|
||||
}).
|
||||
|
||||
-define(legacy_payout_schedule_ref(ID),
|
||||
{domain_PayoutScheduleRef, ID}).
|
||||
|
||||
-define(legacy_schedule_changed(PayoutScheduleRef),
|
||||
{payproc_ScheduleChanged, PayoutScheduleRef}).
|
||||
|
||||
-define(legacy_contract_effect(ID, Effect),
|
||||
{contract_effect, {payproc_ContractEffectUnit, ID, Effect}}).
|
||||
|
||||
@ -146,7 +184,7 @@
|
||||
}
|
||||
).
|
||||
|
||||
-define(legacy_contract_v2(
|
||||
-define(legacy_contract_v2_3(
|
||||
ID,
|
||||
Contractor,
|
||||
PaymentInstitutionRef,
|
||||
@ -187,4 +225,13 @@
|
||||
PayoutToolInfo
|
||||
}).
|
||||
|
||||
-define(legacy_legal_agreement(
|
||||
SignedAt,
|
||||
LegalAgreementID
|
||||
),
|
||||
{domain_LegalAgreement,
|
||||
SignedAt,
|
||||
LegalAgreementID
|
||||
}).
|
||||
|
||||
-endif.
|
||||
|
@ -60,8 +60,8 @@
|
||||
-define(proxy_modification(Proxy),
|
||||
{proxy_modification, #payproc_ProxyModification{proxy = Proxy}}).
|
||||
|
||||
-define(payout_schedule_modification(PayoutScheduleRef),
|
||||
{payout_schedule_modification, #payproc_ScheduleModification{schedule = PayoutScheduleRef}}).
|
||||
-define(payout_schedule_modification(BusinessScheduleRef),
|
||||
{payout_schedule_modification, #payproc_ScheduleModification{schedule = BusinessScheduleRef}}).
|
||||
|
||||
-define(contract_effect(ID, Effect),
|
||||
{contract_effect, #payproc_ContractEffectUnit{contract_id = ID, effect = Effect}}).
|
||||
@ -69,8 +69,8 @@
|
||||
-define(shop_effect(ID, Effect),
|
||||
{shop_effect, #payproc_ShopEffectUnit{shop_id = ID, effect = Effect}}).
|
||||
|
||||
-define(payout_schedule_changed(PayoutScheduleRef),
|
||||
{payout_schedule_changed, #payproc_ScheduleChanged{schedule = PayoutScheduleRef}}).
|
||||
-define(payout_schedule_changed(BusinessScheduleRef),
|
||||
{payout_schedule_changed, #payproc_ScheduleChanged{schedule = BusinessScheduleRef}}).
|
||||
|
||||
-define(claim_created(Claim),
|
||||
{claim_created, Claim}).
|
||||
|
@ -280,7 +280,10 @@ make_contract_modification_effect(_, ?adjustment_creation(AdjustmentID, Params),
|
||||
make_contract_modification_effect(_, ?payout_tool_creation(PayoutToolID, Params), Timestamp, _) ->
|
||||
{payout_tool_created, hg_payout_tool:create(PayoutToolID, Params, Timestamp)};
|
||||
make_contract_modification_effect(_, {legal_agreement_binding, LegalAgreement}, _, _) ->
|
||||
{legal_agreement_bound, LegalAgreement}.
|
||||
{legal_agreement_bound, LegalAgreement};
|
||||
make_contract_modification_effect(ID, {report_preferences_modification, ReportPreferences}, _, Revision) ->
|
||||
_ = assert_report_schedule_valid(ID, ReportPreferences, Revision),
|
||||
{report_preferences_changed, ReportPreferences}.
|
||||
|
||||
make_shop_modification_effect(ID, {creation, ShopParams}, Timestamp, _) ->
|
||||
{created, hg_party:create_shop(ID, ShopParams, Timestamp)};
|
||||
@ -301,9 +304,9 @@ make_shop_modification_effect(_, {location_modification, Location}, _, _) ->
|
||||
{location_changed, Location};
|
||||
make_shop_modification_effect(_, {shop_account_creation, Params}, _, _) ->
|
||||
{account_created, create_shop_account(Params)};
|
||||
make_shop_modification_effect(ID, ?payout_schedule_modification(PayoutScheduleRef), _, Revision) ->
|
||||
_ = assert_payout_schedule_valid(ID, PayoutScheduleRef, Revision),
|
||||
?payout_schedule_changed(PayoutScheduleRef).
|
||||
make_shop_modification_effect(ID, ?payout_schedule_modification(BusinessScheduleRef), _, Revision) ->
|
||||
_ = assert_payout_schedule_valid(ID, BusinessScheduleRef, Revision),
|
||||
?payout_schedule_changed(BusinessScheduleRef).
|
||||
|
||||
create_shop_account(#payproc_ShopAccountParams{currency = Currency}) ->
|
||||
create_shop_account(Currency);
|
||||
@ -436,7 +439,9 @@ update_contract({payout_tool_created, PayoutTool}, Contract) ->
|
||||
PayoutTools = Contract#domain_Contract.payout_tools ++ [PayoutTool],
|
||||
Contract#domain_Contract{payout_tools = PayoutTools};
|
||||
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) ->
|
||||
Contract#domain_Contract{report_preferences = ReportPreferences}.
|
||||
|
||||
apply_shop_effect(_, {created, Shop}, Party) ->
|
||||
hg_party:set_shop(Shop, Party);
|
||||
@ -460,8 +465,8 @@ update_shop({location_changed, Location}, Shop) ->
|
||||
update_shop({proxy_changed, _}, Shop) ->
|
||||
% deprecated
|
||||
Shop;
|
||||
update_shop(?payout_schedule_changed(PayoutScheduleRef), Shop) ->
|
||||
Shop#domain_Shop{payout_schedule = PayoutScheduleRef};
|
||||
update_shop(?payout_schedule_changed(BusinessScheduleRef), Shop) ->
|
||||
Shop#domain_Shop{payout_schedule = BusinessScheduleRef};
|
||||
update_shop({account_created, Account}, Shop) ->
|
||||
Shop#domain_Shop{account = Account}.
|
||||
|
||||
@ -569,19 +574,48 @@ assert_changeset_acceptable(Changeset, Timestamp, Revision, Party0) ->
|
||||
Party = apply_effects(Effects, Timestamp, Party0),
|
||||
hg_party:assert_party_objects_valid(Timestamp, Revision, Party).
|
||||
|
||||
assert_payout_schedule_valid(ShopID, #domain_PayoutScheduleRef{} = PayoutScheduleRef, Revision) ->
|
||||
Ref = {payout_schedule, PayoutScheduleRef},
|
||||
assert_report_schedule_valid(_, #domain_ReportPreferences{service_acceptance_act_preferences = undefined}, _) ->
|
||||
ok;
|
||||
assert_report_schedule_valid(
|
||||
ID,
|
||||
#domain_ReportPreferences{
|
||||
service_acceptance_act_preferences = #domain_ServiceAcceptanceActPreferences{
|
||||
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) ->
|
||||
case hg_domain:exists(Revision, Ref) of
|
||||
true ->
|
||||
ok;
|
||||
false ->
|
||||
raise_invalid_changeset(?invalid_shop(
|
||||
ShopID,
|
||||
{invalid_object_reference, #payproc_InvalidObjectReference{ref = Ref}}
|
||||
))
|
||||
end;
|
||||
assert_payout_schedule_valid(_, undefined, _) ->
|
||||
ok.
|
||||
raise_invalid_object_ref(Prefix, Ref)
|
||||
end.
|
||||
|
||||
-spec raise_invalid_object_ref(
|
||||
{shop, dmsl_domain_thrift:'ShopID'()} | {contract, dmsl_domain_thrift:'ContractID'()},
|
||||
hg_domain:ref()
|
||||
) ->
|
||||
no_return().
|
||||
|
||||
raise_invalid_object_ref(Prefix, Ref) ->
|
||||
Ex = {invalid_object_reference, #payproc_InvalidObjectReference{ref = Ref}},
|
||||
raise_invalid_object_ref_(Prefix, Ex).
|
||||
|
||||
-spec raise_invalid_object_ref_(term(), term()) -> no_return().
|
||||
|
||||
raise_invalid_object_ref_({shop, ID}, Ex) ->
|
||||
raise_invalid_changeset(?invalid_shop(ID, Ex));
|
||||
raise_invalid_object_ref_({contract, ID}, Ex) ->
|
||||
raise_invalid_changeset(?invalid_contract(ID, Ex)).
|
||||
|
||||
make_optional_domain_ref(_, undefined) ->
|
||||
undefined;
|
||||
|
@ -331,13 +331,24 @@ merge_term_sets(TermSets) when is_list(TermSets)->
|
||||
lists:foldl(fun merge_term_sets/2, undefined, TermSets).
|
||||
|
||||
merge_term_sets(
|
||||
#domain_TermSet{payments = PaymentTerms1, recurrent_paytools = RecurrentPaytoolTerms1, payouts = PayoutTerms1},
|
||||
#domain_TermSet{payments = PaymentTerms0, recurrent_paytools = RecurrentPaytoolTerms0, payouts = PayoutTerms0}
|
||||
#domain_TermSet{
|
||||
payments = PaymentTerms1,
|
||||
recurrent_paytools = RecurrentPaytoolTerms1,
|
||||
payouts = PayoutTerms1,
|
||||
reports = Reports1
|
||||
},
|
||||
#domain_TermSet{
|
||||
payments = PaymentTerms0,
|
||||
recurrent_paytools = RecurrentPaytoolTerms0,
|
||||
payouts = PayoutTerms0,
|
||||
reports = Reports0
|
||||
}
|
||||
) ->
|
||||
#domain_TermSet{
|
||||
payments = merge_payments_terms(PaymentTerms0, PaymentTerms1),
|
||||
recurrent_paytools = merge_recurrent_paytools_terms(RecurrentPaytoolTerms0, RecurrentPaytoolTerms1),
|
||||
payouts = merge_payouts_terms(PayoutTerms0, PayoutTerms1)
|
||||
payouts = merge_payouts_terms(PayoutTerms0, PayoutTerms1),
|
||||
reports = merge_reports_terms(Reports0, Reports1)
|
||||
};
|
||||
merge_term_sets(TermSet1, TermSet0) ->
|
||||
hg_utils:select_defined(TermSet1, TermSet0).
|
||||
@ -459,6 +470,34 @@ merge_payouts_terms(
|
||||
merge_payouts_terms(Terms0, Terms1) ->
|
||||
hg_utils:select_defined(Terms1, Terms0).
|
||||
|
||||
merge_reports_terms(
|
||||
#domain_ReportsServiceTerms{
|
||||
acts = Acts0
|
||||
},
|
||||
#domain_ReportsServiceTerms{
|
||||
acts = Acts1
|
||||
}
|
||||
) ->
|
||||
#domain_ReportsServiceTerms{
|
||||
acts = merge_service_acceptance_acts_terms(Acts0, Acts1)
|
||||
};
|
||||
merge_reports_terms(Terms0, Terms1) ->
|
||||
hg_utils:select_defined(Terms1, Terms0).
|
||||
|
||||
merge_service_acceptance_acts_terms(
|
||||
#domain_ServiceAcceptanceActsTerms{
|
||||
schedules = Schedules0
|
||||
},
|
||||
#domain_ServiceAcceptanceActsTerms{
|
||||
schedules = Schedules1
|
||||
}
|
||||
) ->
|
||||
#domain_ServiceAcceptanceActsTerms{
|
||||
schedules = hg_utils:select_defined(Schedules1, Schedules0)
|
||||
};
|
||||
merge_service_acceptance_acts_terms(Terms0, Terms1) ->
|
||||
hg_utils:select_defined(Terms1, Terms0).
|
||||
|
||||
ensure_account(AccountID, #domain_Party{shops = Shops}) ->
|
||||
case find_shop_account(AccountID, maps:to_list(Shops)) of
|
||||
#domain_ShopAccount{} ->
|
||||
|
@ -783,7 +783,7 @@ get_template(TemplateRef, Revision) ->
|
||||
|
||||
%% TODO add transmutations for new international legal entities and bank accounts
|
||||
|
||||
-define(TOP_VERSION, 3).
|
||||
-define(TOP_VERSION, 4).
|
||||
|
||||
wrap_events(Events) ->
|
||||
[hg_party_marshalling:marshal([?TOP_VERSION, E]) || E <- Events].
|
||||
@ -823,7 +823,7 @@ transmute_change(V1, V2,
|
||||
CreatedAt,
|
||||
UpdatedAt
|
||||
))
|
||||
) when V1 =:= 1; V1 =:= 2 ->
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3 ->
|
||||
NewChangeset = [transmute_party_modification(V1, V2, M) || M <- Changeset],
|
||||
?claim_created(#payproc_Claim{
|
||||
id = ID,
|
||||
@ -835,15 +835,15 @@ transmute_change(V1, V2,
|
||||
});
|
||||
transmute_change(V1, V2,
|
||||
?legacy_claim_updated(ID, Changeset, ClaimRevision, Timestamp)
|
||||
) when V1 =:= 1; V1 =:= 2 ->
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3 ->
|
||||
NewChangeset = [transmute_party_modification(V1, V2, M) || M <- Changeset],
|
||||
?claim_updated(ID, NewChangeset, ClaimRevision, Timestamp);
|
||||
transmute_change(V1, V2,
|
||||
?claim_status_changed(ID, ?accepted(Effects), ClaimRevision, Timestamp)
|
||||
) when V1 =:= 1; V1 =:= 2 ->
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3 ->
|
||||
NewEffects = [transmute_claim_effect(V1, V2, E) || E <- Effects],
|
||||
?claim_status_changed(ID, ?accepted(NewEffects), ClaimRevision, Timestamp);
|
||||
transmute_change(V1, _, C) when V1 =:= 1; V1 =:= 2 ->
|
||||
transmute_change(V1, _, C) when V1 =:= 1; V1 =:= 2; V1 =:= 3 ->
|
||||
C.
|
||||
transmute_party_modification(1, 2,
|
||||
?legacy_contract_modification(ID, {creation, ?legacy_contract_params_v1(Contractor, TemplateRef)})
|
||||
@ -879,7 +879,26 @@ transmute_party_modification(V1, V2,
|
||||
tool_info = transmute_payout_tool_info(V1, V2, ToolInfo)
|
||||
},
|
||||
?contract_modification(ContractID, ?payout_tool_creation(ID, PayoutToolParams));
|
||||
transmute_party_modification(V1, _, C) when V1 =:= 1; V1 =:= 2 ->
|
||||
transmute_party_modification(3, 4,
|
||||
?legacy_contract_modification(
|
||||
ID,
|
||||
{legal_agreement_binding, 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 =:= 2; V1 =:= 3 ->
|
||||
C.
|
||||
|
||||
transmute_claim_effect(1, 2, ?legacy_contract_effect(
|
||||
@ -897,7 +916,7 @@ transmute_claim_effect(1, 2, ?legacy_contract_effect(
|
||||
LegalAgreement
|
||||
)}
|
||||
)) ->
|
||||
Contract = ?legacy_contract_v2(
|
||||
Contract = ?legacy_contract_v2_3(
|
||||
ID,
|
||||
transmute_contractor(1, 2, Contractor),
|
||||
undefined,
|
||||
@ -913,7 +932,7 @@ transmute_claim_effect(1, 2, ?legacy_contract_effect(
|
||||
?legacy_contract_effect(ID, {created, Contract});
|
||||
transmute_claim_effect(2, 3, ?legacy_contract_effect(
|
||||
ID,
|
||||
{created, ?legacy_contract_v2(
|
||||
{created, ?legacy_contract_v2_3(
|
||||
ID,
|
||||
Contractor,
|
||||
PaymentInstitutionRef,
|
||||
@ -941,6 +960,36 @@ transmute_claim_effect(2, 3, ?legacy_contract_effect(
|
||||
legal_agreement = LegalAgreement
|
||||
},
|
||||
?contract_effect(ID, {created, Contract});
|
||||
transmute_claim_effect(3, 4, ?legacy_contract_effect(
|
||||
ID,
|
||||
{created, ?legacy_contract_v2_3(
|
||||
ID,
|
||||
Contractor,
|
||||
PaymentInstitutionRef,
|
||||
CreatedAt,
|
||||
ValidSince,
|
||||
ValidUntil,
|
||||
Status,
|
||||
Terms,
|
||||
Adjustments,
|
||||
PayoutTools,
|
||||
LegalAgreement
|
||||
)}
|
||||
)) ->
|
||||
Contract = #domain_Contract{
|
||||
id = ID,
|
||||
contractor = Contractor,
|
||||
payment_institution = PaymentInstitutionRef,
|
||||
created_at = CreatedAt,
|
||||
valid_since = ValidSince,
|
||||
valid_until = ValidUntil,
|
||||
status = Status,
|
||||
terms = Terms,
|
||||
adjustments = Adjustments,
|
||||
payout_tools = PayoutTools,
|
||||
legal_agreement = transmute_legal_agreement(3, 4, LegalAgreement)
|
||||
},
|
||||
?contract_effect(ID, {created, Contract});
|
||||
transmute_claim_effect(V1, V2, ?legacy_contract_effect(
|
||||
ContractID,
|
||||
{payout_tool_created, PayoutTool}
|
||||
@ -949,9 +998,14 @@ transmute_claim_effect(V1, V2, ?legacy_contract_effect(
|
||||
ContractID,
|
||||
{payout_tool_created, transmute_payout_tool(V1, V2, PayoutTool)}
|
||||
);
|
||||
transmute_claim_effect(3, 4, ?legacy_contract_effect(
|
||||
ContractID,
|
||||
{legal_agreement_bound, LegalAgreement}
|
||||
)) ->
|
||||
?contract_effect(ContractID, {legal_agreement_bound, transmute_legal_agreement(3, 4, LegalAgreement)});
|
||||
transmute_claim_effect(2, 3, ?legacy_shop_effect(
|
||||
ID,
|
||||
{created, ?legacy_shop(
|
||||
{created, ?legacy_shop_v2(
|
||||
ID, CreatedAt, Blocking, Suspension, Details, Location, Category, Account, ContractID, PayoutToolID
|
||||
)}
|
||||
)) ->
|
||||
@ -968,7 +1022,44 @@ transmute_claim_effect(2, 3, ?legacy_shop_effect(
|
||||
payout_tool_id = PayoutToolID
|
||||
},
|
||||
?shop_effect(ID, {created, Shop});
|
||||
transmute_claim_effect(V1, _, C) when V1 =:= 1; V1 =:= 2 ->
|
||||
transmute_claim_effect(3, 4, ?legacy_shop_effect(
|
||||
ID,
|
||||
{created, ?legacy_shop_v3(
|
||||
ID,
|
||||
CreatedAt,
|
||||
Blocking,
|
||||
Suspension,
|
||||
Details,
|
||||
Location,
|
||||
Category,
|
||||
Account,
|
||||
ContractID,
|
||||
PayoutToolID,
|
||||
PayoutSchedule
|
||||
)}
|
||||
)) ->
|
||||
Shop = #domain_Shop{
|
||||
id = ID,
|
||||
created_at = CreatedAt,
|
||||
blocking = Blocking,
|
||||
suspension = Suspension,
|
||||
details = Details,
|
||||
location = Location,
|
||||
category = Category,
|
||||
account = Account,
|
||||
contract_id = ContractID,
|
||||
payout_tool_id = PayoutToolID,
|
||||
payout_schedule = transmute_payout_schedule_ref(3, 4, PayoutSchedule)
|
||||
},
|
||||
?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 =:= 2; V1 =:= 3 ->
|
||||
C.
|
||||
|
||||
transmute_contractor(1, 2,
|
||||
@ -1053,3 +1144,14 @@ transmute_bank_account(1, 2, ?legacy_bank_account(Account, BankName, BankPostAcc
|
||||
bank_post_account = BankPostAccount,
|
||||
bank_bik = BankBik
|
||||
}.
|
||||
|
||||
transmute_legal_agreement(3, 4, ?legacy_legal_agreement(SignedAt, LegalAgreementID)) ->
|
||||
#domain_LegalAgreement{
|
||||
signed_at = SignedAt,
|
||||
legal_agreement_id = LegalAgreementID
|
||||
}.
|
||||
|
||||
transmute_payout_schedule_ref(3, 4, ?legacy_payout_schedule_ref(ID)) ->
|
||||
#domain_BusinessScheduleRef{id = ID};
|
||||
transmute_payout_schedule_ref(3, 4, undefined) ->
|
||||
undefined.
|
||||
|
@ -20,6 +20,7 @@
|
||||
-define(insp(ID), #domain_InspectorRef{id = ID}).
|
||||
-define(pinst(ID), #domain_PaymentInstitutionRef{id = ID}).
|
||||
-define(binrange(ID), #domain_BankCardBINRangeRef{id = ID}).
|
||||
-define(bussched(ID), #domain_BusinessScheduleRef{id = ID}).
|
||||
|
||||
-define(cashrng(Lower, Upper),
|
||||
#domain_CashRange{lower = Lower, upper = Upper}).
|
||||
|
@ -22,6 +22,7 @@
|
||||
-export([construct_system_account_set/3]).
|
||||
-export([construct_external_account_set/1]).
|
||||
-export([construct_external_account_set/3]).
|
||||
-export([construct_business_schedule/1]).
|
||||
|
||||
%%
|
||||
|
||||
@ -37,6 +38,12 @@
|
||||
-type system_account_set() :: dmsl_domain_thrift:'SystemAccountSetRef'().
|
||||
-type external_account_set() :: dmsl_domain_thrift:'ExternalAccountSetRef'().
|
||||
|
||||
-type business_schedule() :: dmsl_domain_thrift:'BusinessScheduleRef'().
|
||||
|
||||
%%
|
||||
|
||||
-define(EVERY, {every, #'ScheduleEvery'{}}).
|
||||
|
||||
%%
|
||||
|
||||
-spec construct_currency(currency()) ->
|
||||
@ -233,3 +240,23 @@ construct_external_account_set(Ref, Name, ?cur(CurrencyCode)) ->
|
||||
}}
|
||||
}
|
||||
}}.
|
||||
|
||||
-spec construct_business_schedule(business_schedule()) ->
|
||||
{business_schedule, dmsl_domain_thrift:'BusinessScheduleObject'()}.
|
||||
|
||||
construct_business_schedule(Ref) ->
|
||||
{business_schedule, #domain_BusinessScheduleObject{
|
||||
ref = Ref,
|
||||
data = #domain_BusinessSchedule{
|
||||
name = <<"Every day at 7:40">>,
|
||||
schedule = #'Schedule'{
|
||||
year = ?EVERY,
|
||||
month = ?EVERY,
|
||||
day_of_month = ?EVERY,
|
||||
day_of_week = ?EVERY,
|
||||
hour = {on, [7]},
|
||||
minute = {on, [40]},
|
||||
second = {on, [0]}
|
||||
}
|
||||
}
|
||||
}}.
|
||||
|
@ -77,6 +77,7 @@
|
||||
-export([contract_already_terminated/1]).
|
||||
-export([contract_expiration/1]).
|
||||
-export([contract_legal_agreement_binding/1]).
|
||||
-export([contract_report_preferences_modification/1]).
|
||||
-export([contract_payout_tool_creation/1]).
|
||||
-export([contract_adjustment_creation/1]).
|
||||
-export([contract_adjustment_expiration/1]).
|
||||
@ -160,6 +161,7 @@ groups() ->
|
||||
contract_already_terminated,
|
||||
contract_expiration,
|
||||
contract_legal_agreement_binding,
|
||||
contract_report_preferences_modification,
|
||||
contract_payout_tool_creation,
|
||||
contract_adjustment_creation,
|
||||
contract_adjustment_expiration,
|
||||
@ -388,6 +390,7 @@ end_per_testcase(_Name, _C) ->
|
||||
-spec contract_already_terminated(config()) -> _ | no_return().
|
||||
-spec contract_expiration(config()) -> _ | no_return().
|
||||
-spec contract_legal_agreement_binding(config()) -> _ | no_return().
|
||||
-spec contract_report_preferences_modification(config()) -> _ | no_return().
|
||||
-spec contract_payout_tool_creation(config()) -> _ | no_return().
|
||||
-spec contract_adjustment_creation(config()) -> _ | no_return().
|
||||
-spec contract_adjustment_expiration(config()) -> _ | no_return().
|
||||
@ -541,6 +544,31 @@ contract_legal_agreement_binding(C) ->
|
||||
legal_agreement = LA
|
||||
} = hg_client_party:get_contract(ContractID, Client).
|
||||
|
||||
contract_report_preferences_modification(C) ->
|
||||
Client = cfg(client, C),
|
||||
ContractID = ?REAL_CONTRACT_ID,
|
||||
Pref1 = #domain_ReportPreferences{},
|
||||
Pref2 = #domain_ReportPreferences{
|
||||
service_acceptance_act_preferences = #domain_ServiceAcceptanceActPreferences{
|
||||
schedule = ?bussched(1),
|
||||
signer = #domain_Representative{
|
||||
position = <<"69">>,
|
||||
full_name = <<"Generic Name">>,
|
||||
document = {articles_of_association, #domain_ArticlesOfAssociation{}}
|
||||
}
|
||||
}
|
||||
},
|
||||
Changeset = [
|
||||
?contract_modification(ContractID, {report_preferences_modification, Pref1}),
|
||||
?contract_modification(ContractID, {report_preferences_modification, Pref2})
|
||||
],
|
||||
Claim = assert_claim_pending(hg_client_party:create_claim(Changeset, Client), Client),
|
||||
ok = accept_claim(Claim, Client),
|
||||
#domain_Contract{
|
||||
id = ContractID,
|
||||
report_preferences = Pref2
|
||||
} = hg_client_party:get_contract(ContractID, Client).
|
||||
|
||||
contract_payout_tool_creation(C) ->
|
||||
Client = cfg(client, C),
|
||||
ContractID = ?REAL_CONTRACT_ID,
|
||||
@ -1346,6 +1374,8 @@ construct_domain_fixture() ->
|
||||
hg_ct_fixture:construct_system_account_set(?sas(2)),
|
||||
hg_ct_fixture:construct_external_account_set(?eas(1)),
|
||||
|
||||
hg_ct_fixture:construct_business_schedule(?bussched(1)),
|
||||
|
||||
{payment_institution, #domain_PaymentInstitutionObject{
|
||||
ref = ?pinst(1),
|
||||
data = #domain_PaymentInstitution{
|
||||
|
@ -17,7 +17,7 @@ services:
|
||||
condition: service_healthy
|
||||
|
||||
dominant:
|
||||
image: dr.rbkmoney.com/rbkmoney/dominant:35bc8df7612cddbc1e8b0884311e2d62131f316f
|
||||
image: dr.rbkmoney.com/rbkmoney/dominant:1756bbac6999fa46fbe44a72c74c02e616eda0f6
|
||||
command: /opt/dominant/bin/dominant foreground
|
||||
depends_on:
|
||||
machinegun:
|
||||
|
@ -8,7 +8,7 @@
|
||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},2},
|
||||
{<<"dmsl">>,
|
||||
{git,"git@github.com:rbkmoney/damsel.git",
|
||||
{ref,"d9b97069250bcb0ef1feb95fecb859b0ac0e9249"}},
|
||||
{ref,"f7dff17fc8981e939e9e3778a3eccb13ca886fa5"}},
|
||||
0},
|
||||
{<<"dmt_client">>,
|
||||
{git,"git@github.com:rbkmoney/dmt_client.git",
|
||||
|
Loading…
Reference in New Issue
Block a user