mirror of
https://github.com/valitydev/hellgate.git
synced 2024-11-06 10:55:22 +00:00
HG-494: add claim committer (#357)
* HG-494: add claim committer * HG-494: review fixes * Replace boilerplate with macroses * More macros * More macroses * More macroces - 2 * More macroses - 3 * More macroses - 4 * More macroses - 5 * More macroses - 6 * Rename funcions * Remove contractor_identity_documents_modification (will be removed from proto) * More fixes * Remove identity docs from claimant management proto
This commit is contained in:
parent
d6c6cfdf3c
commit
4420f93174
151
apps/hellgate/include/claim_management.hrl
Normal file
151
apps/hellgate/include/claim_management.hrl
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
-ifndef(__hellgate_claim_management__).
|
||||||
|
-define(__hellgate_claim_management__, included).
|
||||||
|
|
||||||
|
-include_lib("damsel/include/dmsl_claim_management_thrift.hrl").
|
||||||
|
|
||||||
|
-define(cm_modification_unit(ModID, Timestamp, Mod), #claim_management_ModificationUnit{
|
||||||
|
modification_id = ModID,
|
||||||
|
created_at = Timestamp,
|
||||||
|
modification = Mod
|
||||||
|
}).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_party_modification(ModID, Timestamp, Mod),
|
||||||
|
?cm_modification_unit(ModID, Timestamp, {party_modification, Mod})
|
||||||
|
).
|
||||||
|
|
||||||
|
%%% Contractor
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contractor_modification(ContractorID, Mod),
|
||||||
|
{contractor_modification, #claim_management_ContractorModificationUnit{
|
||||||
|
id = ContractorID,
|
||||||
|
modification = Mod
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contractor_creation(ContractorID, Contractor),
|
||||||
|
?cm_contractor_modification(ContractorID, {creation, Contractor})
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_identity_documents_modification(Documents),
|
||||||
|
{
|
||||||
|
identity_documents_modification,
|
||||||
|
#claim_management_ContractorIdentityDocumentsModification{
|
||||||
|
identity_documents = Documents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contractor_identity_documents_modification(ContractorID, Documents),
|
||||||
|
?cm_contractor_modification(ContractorID, ?cm_identity_documents_modification(Documents))
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contractor_identification_level_modification(ContractorID, Level),
|
||||||
|
?cm_contractor_modification(ContractorID, {identification_level_modification, Level})
|
||||||
|
).
|
||||||
|
|
||||||
|
%%% Contract
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contract_modification(ContractID, Mod),
|
||||||
|
{contract_modification, #claim_management_ContractModificationUnit{
|
||||||
|
id = ContractID,
|
||||||
|
modification = Mod
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_contract_creation(ContractID, ContractParams),
|
||||||
|
?cm_contract_modification(ContractID, {creation, ContractParams})
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(cm_contract_termination(Reason),
|
||||||
|
{termination, #claim_management_ContractTermination{reason = Reason}}).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_payout_tool_modification(PayoutToolID, Mod),
|
||||||
|
{payout_tool_modification, #claim_management_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, #claim_management_ScheduleModification{
|
||||||
|
schedule = BusinessScheduleRef
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_adjustment_modification(ContractAdjustmentID, Mod),
|
||||||
|
{adjustment_modification, #claim_management_ContractAdjustmentModificationUnit{
|
||||||
|
adjustment_id = ContractAdjustmentID,
|
||||||
|
modification = Mod
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_adjustment_creation(ContractAdjustmentID, ContractTemplateRef),
|
||||||
|
?cm_adjustment_modification(
|
||||||
|
ContractAdjustmentID,
|
||||||
|
{creation, #claim_management_ContractAdjustmentParams{
|
||||||
|
template = ContractTemplateRef
|
||||||
|
}}
|
||||||
|
)
|
||||||
|
).
|
||||||
|
|
||||||
|
%%% Shop
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_shop_modification(ShopID, Mod),
|
||||||
|
{shop_modification, #claim_management_ShopModificationUnit{
|
||||||
|
id = ShopID,
|
||||||
|
modification = Mod
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_shop_contract_modification(ContractID, PayoutToolID),
|
||||||
|
{contract_modification, #claim_management_ShopContractModification{
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_shop_creation(ShopID, ShopParams),
|
||||||
|
?cm_shop_modification(ShopID, {creation, ShopParams})
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_shop_account_creation_params(CurrencyRef),
|
||||||
|
{shop_account_creation, #claim_management_ShopAccountParams{
|
||||||
|
currency = CurrencyRef
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
cm_shop_account_creation(ShopID, CurrencyRef),
|
||||||
|
?cm_shop_modification(
|
||||||
|
ShopID,
|
||||||
|
?cm_shop_account_creation_params(CurrencyRef)
|
||||||
|
)
|
||||||
|
).
|
||||||
|
|
||||||
|
-endif.
|
@ -79,6 +79,13 @@
|
|||||||
-define(shop_contract_modification(ContractID, PayoutToolID),
|
-define(shop_contract_modification(ContractID, PayoutToolID),
|
||||||
{contract_modification, #payproc_ShopContractModification{contract_id = ContractID, payout_tool_id = PayoutToolID}}).
|
{contract_modification, #payproc_ShopContractModification{contract_id = ContractID, payout_tool_id = PayoutToolID}}).
|
||||||
|
|
||||||
|
-define(
|
||||||
|
shop_account_creation_params(CurrencyRef),
|
||||||
|
{shop_account_creation, #payproc_ShopAccountParams{
|
||||||
|
currency = CurrencyRef
|
||||||
|
}}
|
||||||
|
).
|
||||||
|
|
||||||
-define(proxy_modification(Proxy),
|
-define(proxy_modification(Proxy),
|
||||||
{proxy_modification, #payproc_ProxyModification{proxy = Proxy}}).
|
{proxy_modification, #payproc_ProxyModification{proxy = Proxy}}).
|
||||||
|
|
||||||
|
@ -71,13 +71,14 @@ get_api_child_spec(MachineHandlers, Opts) ->
|
|||||||
protocol_opts => genlib_app:env(?MODULE, protocol_opts, #{}),
|
protocol_opts => genlib_app:env(?MODULE, protocol_opts, #{}),
|
||||||
event_handler => scoper_woody_event_handler,
|
event_handler => scoper_woody_event_handler,
|
||||||
handlers => hg_machine:get_service_handlers(MachineHandlers, Opts) ++ [
|
handlers => hg_machine:get_service_handlers(MachineHandlers, Opts) ++ [
|
||||||
construct_service_handler(party_management , hg_party_woody_handler, Opts),
|
construct_service_handler(claim_committer , hg_claim_committer_handler, Opts),
|
||||||
|
construct_service_handler(party_management , hg_party_woody_handler , Opts),
|
||||||
construct_service_handler(invoicing , hg_invoice , Opts),
|
construct_service_handler(invoicing , hg_invoice , Opts),
|
||||||
construct_service_handler(invoice_templating , hg_invoice_template , Opts),
|
construct_service_handler(invoice_templating , hg_invoice_template , Opts),
|
||||||
construct_service_handler(customer_management , hg_customer , Opts),
|
construct_service_handler(customer_management , hg_customer , Opts),
|
||||||
construct_service_handler(recurrent_paytool , hg_recurrent_paytool , Opts),
|
construct_service_handler(recurrent_paytool , hg_recurrent_paytool , Opts),
|
||||||
construct_service_handler(recurrent_paytool_eventsink , hg_recurrent_paytool , Opts),
|
construct_service_handler(recurrent_paytool_eventsink , hg_recurrent_paytool , Opts),
|
||||||
construct_service_handler(proxy_host_provider , hg_proxy_host_provider, Opts),
|
construct_service_handler(proxy_host_provider , hg_proxy_host_provider , Opts),
|
||||||
construct_service_handler(payment_processing_eventsink , hg_event_sink_handler , Opts)
|
construct_service_handler(payment_processing_eventsink , hg_event_sink_handler , Opts)
|
||||||
],
|
],
|
||||||
additional_routes => HealthRoutes,
|
additional_routes => HealthRoutes,
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
-export([assert_revision/2]).
|
-export([assert_revision/2]).
|
||||||
-export([assert_pending/1]).
|
-export([assert_pending/1]).
|
||||||
|
-export([assert_applicable/4]).
|
||||||
|
-export([assert_acceptable/4]).
|
||||||
-export([raise_invalid_changeset/1]).
|
-export([raise_invalid_changeset/1]).
|
||||||
|
|
||||||
%% Types
|
%% Types
|
||||||
@ -87,7 +89,7 @@ update_changeset(NewChangeset, NewRevision, Timestamp, #payproc_Claim{changeset
|
|||||||
claim() | no_return().
|
claim() | no_return().
|
||||||
|
|
||||||
accept(Timestamp, DomainRevision, Party, Claim) ->
|
accept(Timestamp, DomainRevision, Party, Claim) ->
|
||||||
ok = assert_changeset_acceptable(get_changeset(Claim), Timestamp, DomainRevision, Party),
|
ok = assert_acceptable(Claim, Timestamp, DomainRevision, Party),
|
||||||
Effects = make_effects(Timestamp, DomainRevision, Claim),
|
Effects = make_effects(Timestamp, DomainRevision, Claim),
|
||||||
set_status(?accepted(Effects), get_next_revision(Claim), Timestamp, Claim).
|
set_status(?accepted(Effects), get_next_revision(Claim), Timestamp, Claim).
|
||||||
|
|
||||||
@ -379,7 +381,9 @@ update_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) ->
|
||||||
Contract#domain_Contract{report_preferences = ReportPreferences}.
|
Contract#domain_Contract{report_preferences = ReportPreferences};
|
||||||
|
update_contract({contractor_changed, ContractorID}, Contract) ->
|
||||||
|
Contract#domain_Contract{contractor_id = ContractorID}.
|
||||||
|
|
||||||
apply_shop_effect(_, {created, Shop}, Party) ->
|
apply_shop_effect(_, {created, Shop}, Party) ->
|
||||||
hg_party:set_shop(Shop, Party);
|
hg_party:set_shop(Shop, Party);
|
||||||
@ -439,6 +443,15 @@ assert_pending(#payproc_Claim{status = ?pending()}) ->
|
|||||||
assert_pending(#payproc_Claim{status = Status}) ->
|
assert_pending(#payproc_Claim{status = Status}) ->
|
||||||
throw(#payproc_InvalidClaimStatus{status = Status}).
|
throw(#payproc_InvalidClaimStatus{status = Status}).
|
||||||
|
|
||||||
|
-spec assert_applicable(claim(), timestamp(), revision(), party()) ->
|
||||||
|
ok | no_return().
|
||||||
|
|
||||||
|
assert_applicable(Claim, Timestamp, Revision, Party) ->
|
||||||
|
assert_changeset_applicable(get_changeset(Claim), Timestamp, Revision, Party).
|
||||||
|
|
||||||
|
-spec assert_changeset_applicable(changeset(), timestamp(), revision(), party()) ->
|
||||||
|
ok | no_return().
|
||||||
|
|
||||||
assert_changeset_applicable([Change | Others], Timestamp, Revision, Party) ->
|
assert_changeset_applicable([Change | Others], Timestamp, Revision, Party) ->
|
||||||
case Change of
|
case Change of
|
||||||
?contract_modification(ID, Modification) ->
|
?contract_modification(ID, Modification) ->
|
||||||
@ -572,7 +585,11 @@ get_payment_institution_realm(Ref, Revision, ContractID) ->
|
|||||||
raise_invalid_payment_institution(ContractID, Ref)
|
raise_invalid_payment_institution(ContractID, Ref)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
assert_changeset_acceptable(Changeset, Timestamp, Revision, Party0) ->
|
-spec assert_acceptable(claim(), timestamp(), revision(), party()) ->
|
||||||
|
ok | no_return().
|
||||||
|
|
||||||
|
assert_acceptable(Claim, Timestamp, Revision, Party0) ->
|
||||||
|
Changeset = get_changeset(Claim),
|
||||||
Effects = make_changeset_safe_effects(Changeset, Timestamp, Revision),
|
Effects = make_changeset_safe_effects(Changeset, Timestamp, Revision),
|
||||||
Party = apply_effects(Effects, Timestamp, Party0),
|
Party = apply_effects(Effects, Timestamp, Party0),
|
||||||
hg_party:assert_party_objects_valid(Timestamp, Revision, Party).
|
hg_party:assert_party_objects_valid(Timestamp, Revision, Party).
|
||||||
|
118
apps/hellgate/src/hg_claim_committer.erl
Normal file
118
apps/hellgate/src/hg_claim_committer.erl
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
-module(hg_claim_committer).
|
||||||
|
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
|
||||||
|
-include_lib("damsel/include/dmsl_claim_management_thrift.hrl").
|
||||||
|
-include("claim_management.hrl").
|
||||||
|
-include("party_events.hrl").
|
||||||
|
|
||||||
|
-export([from_claim_mgmt/1]).
|
||||||
|
|
||||||
|
-spec from_claim_mgmt(dmsl_claim_management_thrift:'Claim'()) ->
|
||||||
|
dmsl_payment_processing_thrift:'Claim'().
|
||||||
|
|
||||||
|
from_claim_mgmt(#claim_management_Claim{
|
||||||
|
id = ID,
|
||||||
|
changeset = Changeset,
|
||||||
|
revision = Revision,
|
||||||
|
created_at = CreatedAt,
|
||||||
|
updated_at = UpdatedAt
|
||||||
|
}) ->
|
||||||
|
#payproc_Claim{
|
||||||
|
id = ID,
|
||||||
|
status = ?pending(),
|
||||||
|
changeset = from_cm_changeset(Changeset),
|
||||||
|
revision = Revision,
|
||||||
|
created_at = CreatedAt,
|
||||||
|
updated_at = UpdatedAt
|
||||||
|
}.
|
||||||
|
|
||||||
|
%%% Internal functions
|
||||||
|
|
||||||
|
from_cm_changeset(Changeset) ->
|
||||||
|
[from_cm_party_mod(PartyMod) ||
|
||||||
|
#claim_management_ModificationUnit{
|
||||||
|
modification = {party_modification, PartyMod}
|
||||||
|
} <- Changeset].
|
||||||
|
|
||||||
|
from_cm_party_mod(?cm_contractor_modification(ContractorID, ContractorModification)) ->
|
||||||
|
?contractor_modification(ContractorID, ContractorModification);
|
||||||
|
from_cm_party_mod(?cm_contract_modification(ContractID, ContractModification)) ->
|
||||||
|
?contract_modification(
|
||||||
|
ContractID,
|
||||||
|
from_cm_contract_modification(ContractModification)
|
||||||
|
);
|
||||||
|
from_cm_party_mod(?cm_shop_modification(ShopID, ShopModification)) ->
|
||||||
|
?shop_modification(
|
||||||
|
ShopID,
|
||||||
|
from_cm_shop_modification(ShopModification)
|
||||||
|
).
|
||||||
|
|
||||||
|
from_cm_contract_modification(
|
||||||
|
{creation, #claim_management_ContractParams{
|
||||||
|
contractor_id = ContractorID,
|
||||||
|
template = ContractTemplateRef,
|
||||||
|
payment_institution = PaymentInstitutionRef
|
||||||
|
}}
|
||||||
|
) ->
|
||||||
|
{creation, #payproc_ContractParams{
|
||||||
|
contractor_id = ContractorID,
|
||||||
|
template = ContractTemplateRef,
|
||||||
|
payment_institution = PaymentInstitutionRef
|
||||||
|
}};
|
||||||
|
from_cm_contract_modification(?cm_contract_termination(Reason)) ->
|
||||||
|
?contract_termination(Reason);
|
||||||
|
from_cm_contract_modification(?cm_adjustment_creation(ContractAdjustmentID, ContractTemplateRef)
|
||||||
|
) ->
|
||||||
|
?adjustment_creation(
|
||||||
|
ContractAdjustmentID,
|
||||||
|
#payproc_ContractAdjustmentParams{template = ContractTemplateRef}
|
||||||
|
);
|
||||||
|
from_cm_contract_modification(
|
||||||
|
?cm_payout_tool_creation(PayoutToolID, #claim_management_PayoutToolParams{
|
||||||
|
currency = CurrencyRef,
|
||||||
|
tool_info = PayoutToolInfo
|
||||||
|
})
|
||||||
|
) ->
|
||||||
|
?payout_tool_creation(PayoutToolID, #payproc_PayoutToolParams{
|
||||||
|
currency = CurrencyRef,
|
||||||
|
tool_info = PayoutToolInfo
|
||||||
|
});
|
||||||
|
from_cm_contract_modification(
|
||||||
|
?cm_payout_tool_info_modification(PayoutToolID, PayoutToolModification)
|
||||||
|
) ->
|
||||||
|
?payout_tool_info_modification(PayoutToolID, PayoutToolModification);
|
||||||
|
from_cm_contract_modification({legal_agreement_binding, _LegalAgreement} = LegalAgreementBinding) ->
|
||||||
|
LegalAgreementBinding;
|
||||||
|
from_cm_contract_modification({report_preferences_modification, _ReportPreferences} = ReportPreferencesModification) ->
|
||||||
|
ReportPreferencesModification;
|
||||||
|
from_cm_contract_modification({contractor_modification, _ContractorID} = ContractorModification) ->
|
||||||
|
ContractorModification.
|
||||||
|
|
||||||
|
from_cm_shop_modification({creation, ShopParams}) ->
|
||||||
|
#claim_management_ShopParams{
|
||||||
|
category = CategoryRef,
|
||||||
|
location = ShopLocation,
|
||||||
|
details = ShopDetails,
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID
|
||||||
|
} = ShopParams,
|
||||||
|
{creation, #payproc_ShopParams{
|
||||||
|
category = CategoryRef,
|
||||||
|
location = ShopLocation,
|
||||||
|
details = ShopDetails,
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID
|
||||||
|
}};
|
||||||
|
from_cm_shop_modification({category_modification, _CategoryRef} = CategoryModification) ->
|
||||||
|
CategoryModification;
|
||||||
|
from_cm_shop_modification({details_modification, _ShopDetails} = DetailsModification) ->
|
||||||
|
DetailsModification;
|
||||||
|
from_cm_shop_modification(?cm_shop_contract_modification(ContractID, PayoutToolID)) ->
|
||||||
|
?shop_contract_modification(ContractID, PayoutToolID);
|
||||||
|
from_cm_shop_modification({payout_tool_modification, _PayoutToolID} = PayoutToolModification) ->
|
||||||
|
PayoutToolModification;
|
||||||
|
from_cm_shop_modification({location_modification, _ShopLocation} = LocationModification) ->
|
||||||
|
LocationModification;
|
||||||
|
from_cm_shop_modification(?cm_shop_account_creation_params(CurrencyRef)) ->
|
||||||
|
?shop_account_creation_params(CurrencyRef);
|
||||||
|
from_cm_shop_modification(?cm_payout_schedule_modification(BusinessScheduleRef)) ->
|
||||||
|
?payout_schedule_modification(BusinessScheduleRef).
|
30
apps/hellgate/src/hg_claim_committer_handler.erl
Normal file
30
apps/hellgate/src/hg_claim_committer_handler.erl
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
-module(hg_claim_committer_handler).
|
||||||
|
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
|
||||||
|
-include_lib("damsel/include/dmsl_claim_management_thrift.hrl").
|
||||||
|
|
||||||
|
-behaviour(hg_woody_wrapper).
|
||||||
|
|
||||||
|
-export([handle_function/3]).
|
||||||
|
|
||||||
|
-spec handle_function(woody:func(), woody:args(), hg_woody_wrapper:handler_opts()) ->
|
||||||
|
term()| no_return().
|
||||||
|
|
||||||
|
handle_function(Func, Args, Opts) ->
|
||||||
|
scoper:scope(claimmgmt,
|
||||||
|
fun() -> handle_function_(Func, Args, Opts) end
|
||||||
|
).
|
||||||
|
|
||||||
|
-spec handle_function_(woody:func(), woody:args(), hg_woody_wrapper:handler_opts()) ->
|
||||||
|
term() | no_return().
|
||||||
|
|
||||||
|
handle_function_(Fun, [PartyID, _Claim] = Args, _Opts) when Fun == 'Accept'; Fun == 'Commit' ->
|
||||||
|
call(PartyID, Fun, Args).
|
||||||
|
|
||||||
|
call(PartyID, FunctionName, Args) ->
|
||||||
|
ok = scoper:add_meta(#{party_id => PartyID}),
|
||||||
|
try
|
||||||
|
hg_party_machine:call(PartyID, claim_committer, {'ClaimCommitter', FunctionName}, Args)
|
||||||
|
catch
|
||||||
|
throw:#payproc_PartyNotFound{} ->
|
||||||
|
erlang:throw(#claim_management_PartyNotFound{})
|
||||||
|
end.
|
@ -84,7 +84,9 @@ 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) ->
|
||||||
_ = assert_report_schedule_valid(ID, ReportPreferences, Revision),
|
_ = assert_report_schedule_valid(ID, ReportPreferences, Revision),
|
||||||
{report_preferences_changed, ReportPreferences}.
|
{report_preferences_changed, ReportPreferences};
|
||||||
|
make_contract_effect(_, {contractor_modification, ContractorID}, _, _) ->
|
||||||
|
{contractor_changed, ContractorID}.
|
||||||
|
|
||||||
make_shop_effect(ID, {creation, ShopParams}, Timestamp, _) ->
|
make_shop_effect(ID, {creation, ShopParams}, Timestamp, _) ->
|
||||||
{created, hg_party:create_shop(ID, ShopParams, Timestamp)};
|
{created, hg_party:create_shop(ID, ShopParams, Timestamp)};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
-include("party_events.hrl").
|
-include("party_events.hrl").
|
||||||
-include("legacy_party_structures.hrl").
|
-include("legacy_party_structures.hrl").
|
||||||
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
|
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
|
||||||
|
-include_lib("damsel/include/dmsl_claim_management_thrift.hrl").
|
||||||
|
|
||||||
%% Machine callbacks
|
%% Machine callbacks
|
||||||
|
|
||||||
@ -131,6 +132,12 @@ process_signal({repair, _}, _Machine) ->
|
|||||||
|
|
||||||
process_call({{'PartyManagement', Fun}, FunArgs}, Machine) ->
|
process_call({{'PartyManagement', Fun}, FunArgs}, Machine) ->
|
||||||
[_UserInfo, PartyID | Args] = FunArgs,
|
[_UserInfo, PartyID | Args] = FunArgs,
|
||||||
|
process_call_(PartyID, Fun, Args, Machine);
|
||||||
|
process_call({{'ClaimCommitter', Fun}, FunArgs}, Machine) ->
|
||||||
|
[PartyID | Args] = FunArgs,
|
||||||
|
process_call_(PartyID, Fun, Args, Machine).
|
||||||
|
|
||||||
|
process_call_(PartyID, Fun, Args, Machine) ->
|
||||||
#{id := PartyID, history := History, aux_state := WrappedAuxSt} = Machine,
|
#{id := PartyID, history := History, aux_state := WrappedAuxSt} = Machine,
|
||||||
try
|
try
|
||||||
scoper:scope(
|
scoper:scope(
|
||||||
@ -257,6 +264,51 @@ handle_call('RevokeClaim', [ID, ClaimRevision, Reason], AuxSt, St) ->
|
|||||||
[finalize_claim(Claim, Timestamp)],
|
[finalize_claim(Claim, Timestamp)],
|
||||||
AuxSt,
|
AuxSt,
|
||||||
St
|
St
|
||||||
|
);
|
||||||
|
|
||||||
|
%% ClaimCommitter
|
||||||
|
|
||||||
|
handle_call('Accept', [Claim], AuxSt, St) ->
|
||||||
|
#claim_management_Claim{
|
||||||
|
changeset = Changeset
|
||||||
|
} = Claim,
|
||||||
|
PayprocClaim = hg_claim_committer:from_claim_mgmt(Claim),
|
||||||
|
Timestamp = hg_datetime:format_now(),
|
||||||
|
Revision = hg_domain:head(),
|
||||||
|
Party = get_st_party(St),
|
||||||
|
try
|
||||||
|
ok = hg_claim:assert_applicable(PayprocClaim, Timestamp, Revision, Party),
|
||||||
|
ok = hg_claim:assert_acceptable(PayprocClaim, Timestamp, Revision, Party),
|
||||||
|
respond(
|
||||||
|
ok,
|
||||||
|
[],
|
||||||
|
AuxSt,
|
||||||
|
St
|
||||||
|
)
|
||||||
|
catch
|
||||||
|
throw:#payproc_InvalidChangeset{reason = Reason0} ->
|
||||||
|
Reason1 = io_lib:format("~0tp", [Reason0]),
|
||||||
|
Reason2 = unicode:characters_to_binary(Reason1),
|
||||||
|
erlang:throw(#claim_management_InvalidChangeset{reason = Reason2, invalid_changeset = Changeset})
|
||||||
|
end;
|
||||||
|
|
||||||
|
handle_call('Commit', [CmClaim], AuxSt, St) ->
|
||||||
|
PayprocClaim = hg_claim_committer:from_claim_mgmt(CmClaim),
|
||||||
|
Timestamp = hg_datetime:format_now(),
|
||||||
|
Revision = hg_domain:head(),
|
||||||
|
Party = get_st_party(St),
|
||||||
|
AcceptedClaim = hg_claim:accept(Timestamp, Revision, Party, PayprocClaim),
|
||||||
|
PartyRevision = get_next_party_revision(St),
|
||||||
|
Changes = [
|
||||||
|
?claim_created(PayprocClaim),
|
||||||
|
finalize_claim(AcceptedClaim, Timestamp),
|
||||||
|
?revision_changed(Timestamp, PartyRevision)
|
||||||
|
],
|
||||||
|
respond(
|
||||||
|
ok,
|
||||||
|
Changes,
|
||||||
|
AuxSt,
|
||||||
|
St
|
||||||
).
|
).
|
||||||
|
|
||||||
%% Generic handlers
|
%% Generic handlers
|
||||||
|
770
apps/hellgate/test/hg_claim_committer_SUITE.erl
Normal file
770
apps/hellgate/test/hg_claim_committer_SUITE.erl
Normal file
@ -0,0 +1,770 @@
|
|||||||
|
-module(hg_claim_committer_SUITE).
|
||||||
|
|
||||||
|
-include("claim_management.hrl").
|
||||||
|
-include("hg_ct_domain.hrl").
|
||||||
|
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
|
||||||
|
|
||||||
|
-export([all/0]).
|
||||||
|
-export([init_per_suite/1]).
|
||||||
|
-export([end_per_suite/1]).
|
||||||
|
|
||||||
|
-export([party_creation/1]).
|
||||||
|
-export([contractor_one_creation/1]).
|
||||||
|
-export([contractor_two_creation/1]).
|
||||||
|
-export([contractor_modification/1]).
|
||||||
|
-export([contract_one_creation/1]).
|
||||||
|
-export([contract_two_creation/1]).
|
||||||
|
-export([contract_contractor_modification/1]).
|
||||||
|
-export([contract_adjustment_creation/1]).
|
||||||
|
-export([contract_legal_agreement_binding/1]).
|
||||||
|
-export([contract_report_preferences_modification/1]).
|
||||||
|
-export([shop_creation/1]).
|
||||||
|
-export([shop_complex_modification/1]).
|
||||||
|
-export([shop_contract_modification/1]).
|
||||||
|
-export([contract_termination/1]).
|
||||||
|
-export([contractor_already_exists/1]).
|
||||||
|
-export([contract_already_exists/1]).
|
||||||
|
-export([contract_already_terminated/1]).
|
||||||
|
-export([shop_already_exists/1]).
|
||||||
|
|
||||||
|
-type config() :: hg_ct_helper:config().
|
||||||
|
-type test_case_name() :: hg_ct_helper:test_case_name().
|
||||||
|
|
||||||
|
-define(REAL_CONTRACTOR_ID1, <<"CONTRACTOR2">>).
|
||||||
|
-define(REAL_CONTRACTOR_ID2, <<"CONTRACTOR3">>).
|
||||||
|
-define(REAL_CONTRACT_ID1, <<"CONTRACT2">>).
|
||||||
|
-define(REAL_CONTRACT_ID2, <<"CONTRACT3">>).
|
||||||
|
-define(REAL_PAYOUT_TOOL_ID1, <<"PAYOUTTOOL2">>).
|
||||||
|
-define(REAL_PAYOUT_TOOL_ID2, <<"PAYOUTTOOL3">>).
|
||||||
|
-define(REAL_SHOP_ID, <<"SHOP2">>).
|
||||||
|
|
||||||
|
%%% CT
|
||||||
|
|
||||||
|
-spec all() -> [test_case_name()].
|
||||||
|
|
||||||
|
all() ->
|
||||||
|
[
|
||||||
|
party_creation,
|
||||||
|
contractor_one_creation,
|
||||||
|
contractor_two_creation,
|
||||||
|
contractor_modification,
|
||||||
|
contract_one_creation,
|
||||||
|
contract_two_creation,
|
||||||
|
contract_contractor_modification,
|
||||||
|
contract_adjustment_creation,
|
||||||
|
contract_legal_agreement_binding,
|
||||||
|
contract_report_preferences_modification,
|
||||||
|
shop_creation,
|
||||||
|
shop_complex_modification,
|
||||||
|
shop_contract_modification,
|
||||||
|
contract_termination,
|
||||||
|
contractor_already_exists,
|
||||||
|
contract_already_exists,
|
||||||
|
contract_already_terminated,
|
||||||
|
shop_already_exists
|
||||||
|
].
|
||||||
|
|
||||||
|
-spec init_per_suite(config()) -> config().
|
||||||
|
|
||||||
|
init_per_suite(C) ->
|
||||||
|
{Apps, Ret} = hg_ct_helper:start_apps([woody, scoper, dmt_client, party_client, hellgate]),
|
||||||
|
RootUrl = maps:get(hellgate_root_url, Ret),
|
||||||
|
ok = hg_domain:insert(construct_domain_fixture()),
|
||||||
|
PartyID = erlang:list_to_binary([?MODULE_STRING, ".", erlang:integer_to_list(erlang:system_time())]),
|
||||||
|
ApiClient = hg_ct_helper:create_client(RootUrl, PartyID),
|
||||||
|
[{root_url, RootUrl}, {apps, Apps}, {party_id, PartyID}, {api_client, ApiClient} | C].
|
||||||
|
|
||||||
|
-spec end_per_suite(config()) -> _.
|
||||||
|
|
||||||
|
end_per_suite(C) ->
|
||||||
|
ok = hg_domain:cleanup(),
|
||||||
|
[application:stop(App) || App <- cfg(apps, C)].
|
||||||
|
|
||||||
|
%%% Tests
|
||||||
|
|
||||||
|
-spec party_creation(config()) -> _.
|
||||||
|
|
||||||
|
party_creation(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContactInfo = #domain_PartyContactInfo{email = <<?MODULE_STRING>>},
|
||||||
|
ok = create_party(PartyID, ContactInfo, C),
|
||||||
|
{ok, Party} = get_party(PartyID, C),
|
||||||
|
#domain_Party{
|
||||||
|
id = PartyID,
|
||||||
|
contact_info = ContactInfo,
|
||||||
|
blocking = {unblocked, #domain_Unblocked{}},
|
||||||
|
suspension = {active, #domain_Active{}},
|
||||||
|
shops = Shops,
|
||||||
|
contracts = Contracts
|
||||||
|
} = Party,
|
||||||
|
0 = maps:size(Shops),
|
||||||
|
0 = maps:size(Contracts).
|
||||||
|
|
||||||
|
-spec contractor_one_creation(config()) -> _.
|
||||||
|
|
||||||
|
contractor_one_creation(C) ->
|
||||||
|
ContractorParams = hg_ct_helper:make_battle_ready_contractor(),
|
||||||
|
ContractorID = ?REAL_CONTRACTOR_ID1,
|
||||||
|
Modifications = [
|
||||||
|
?cm_contractor_creation(ContractorID, ContractorParams)
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{ok, Party} = get_party(PartyID, C),
|
||||||
|
#domain_PartyContractor{} = hg_party:get_contractor(ContractorID, Party).
|
||||||
|
|
||||||
|
-spec contractor_two_creation(config()) -> _.
|
||||||
|
|
||||||
|
contractor_two_creation(C) ->
|
||||||
|
ContractorParams = hg_ct_helper:make_battle_ready_contractor(),
|
||||||
|
ContractorID = ?REAL_CONTRACTOR_ID2,
|
||||||
|
Modifications = [
|
||||||
|
?cm_contractor_creation(ContractorID, ContractorParams)
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{ok, Party} = get_party(PartyID, C),
|
||||||
|
#domain_PartyContractor{} = hg_party:get_contractor(ContractorID, Party).
|
||||||
|
|
||||||
|
-spec contractor_modification(config()) -> _.
|
||||||
|
|
||||||
|
contractor_modification(C) ->
|
||||||
|
ContractorID = ?REAL_CONTRACTOR_ID1,
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{ok, Party1} = get_party(PartyID, C),
|
||||||
|
#domain_PartyContractor{} = C1 = hg_party:get_contractor(ContractorID, Party1),
|
||||||
|
Modifications = [
|
||||||
|
?cm_contractor_identification_level_modification(ContractorID, full)
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, Party2} = get_party(PartyID, C),
|
||||||
|
#domain_PartyContractor{} = C2 = hg_party:get_contractor(ContractorID, Party2),
|
||||||
|
C1 /= C2 orelse error(same_contractor).
|
||||||
|
|
||||||
|
-spec contract_one_creation(config()) -> _.
|
||||||
|
|
||||||
|
contract_one_creation(C) ->
|
||||||
|
ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1),
|
||||||
|
PayoutToolParams = make_payout_tool_params(),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
|
||||||
|
PayoutToolID2 = ?REAL_PAYOUT_TOOL_ID2,
|
||||||
|
Modifications = [
|
||||||
|
?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))
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
payout_tools = PayoutTools
|
||||||
|
}} = 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()) -> _.
|
||||||
|
|
||||||
|
contract_two_creation(C) ->
|
||||||
|
ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1),
|
||||||
|
PayoutToolParams = make_payout_tool_params(),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID2,
|
||||||
|
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
|
||||||
|
Modifications = [
|
||||||
|
?cm_contract_creation(ContractID, ContractParams),
|
||||||
|
?cm_contract_modification(ContractID, ?cm_payout_tool_creation(PayoutToolID1, PayoutToolParams))
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
payout_tools = PayoutTools
|
||||||
|
}} = get_contract(PartyID, ContractID, C),
|
||||||
|
true = lists:keymember(PayoutToolID1, #domain_PayoutTool.id, PayoutTools).
|
||||||
|
|
||||||
|
-spec contract_contractor_modification(config()) -> _.
|
||||||
|
|
||||||
|
contract_contractor_modification(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID2,
|
||||||
|
NewContractor = ?REAL_CONTRACTOR_ID2,
|
||||||
|
Modifications = [
|
||||||
|
?cm_contract_modification(ContractID, {contractor_modification, NewContractor})
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
contractor_id = NewContractor
|
||||||
|
}} = get_contract(PartyID, ContractID, C).
|
||||||
|
|
||||||
|
-spec contract_adjustment_creation(config()) -> _.
|
||||||
|
|
||||||
|
contract_adjustment_creation(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
ID = <<"ADJ1">>,
|
||||||
|
AdjustmentTemplate = #domain_ContractTemplateRef{id = 2},
|
||||||
|
Modifications = [?cm_contract_modification(ContractID, ?cm_adjustment_creation(ID, AdjustmentTemplate))],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
adjustments = Adjustments
|
||||||
|
}} = get_contract(PartyID, ContractID, C),
|
||||||
|
true = lists:keymember(ID, #domain_ContractAdjustment.id, Adjustments).
|
||||||
|
|
||||||
|
-spec contract_legal_agreement_binding(config()) -> _.
|
||||||
|
|
||||||
|
contract_legal_agreement_binding(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
LA = #domain_LegalAgreement{
|
||||||
|
signed_at = hg_datetime:format_now(),
|
||||||
|
legal_agreement_id = <<"20160123-0031235-OGM/GDM">>
|
||||||
|
},
|
||||||
|
Changeset = [?cm_contract_modification(ContractID, {legal_agreement_binding, LA})],
|
||||||
|
Claim = claim(Changeset),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
legal_agreement = LA
|
||||||
|
}} = get_contract(PartyID, ContractID, C).
|
||||||
|
|
||||||
|
-spec contract_report_preferences_modification(config()) -> _.
|
||||||
|
|
||||||
|
contract_report_preferences_modification(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
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{}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Modifications = [
|
||||||
|
?cm_contract_modification(ContractID, {report_preferences_modification, Pref1}),
|
||||||
|
?cm_contract_modification(ContractID, {report_preferences_modification, Pref2})
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
report_preferences = Pref2
|
||||||
|
}} = get_contract(PartyID, ContractID, C).
|
||||||
|
|
||||||
|
-spec shop_creation(config()) -> _.
|
||||||
|
|
||||||
|
shop_creation(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_ID,
|
||||||
|
PayoutToolID1 = ?REAL_PAYOUT_TOOL_ID1,
|
||||||
|
ShopParams = #claim_management_ShopParams{
|
||||||
|
category = Category,
|
||||||
|
location = Location,
|
||||||
|
details = Details,
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID1
|
||||||
|
},
|
||||||
|
Schedule = ?bussched(1),
|
||||||
|
ScheduleParams = #claim_management_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),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Shop{
|
||||||
|
id = ShopID,
|
||||||
|
details = Details,
|
||||||
|
location = Location,
|
||||||
|
category = Category,
|
||||||
|
account = #domain_ShopAccount{currency = ?cur(<<"RUB">>)},
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID1,
|
||||||
|
payout_schedule = Schedule
|
||||||
|
}} = get_shop(PartyID, ShopID, C).
|
||||||
|
|
||||||
|
-spec shop_complex_modification(config()) -> _.
|
||||||
|
|
||||||
|
shop_complex_modification(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ShopID = ?REAL_SHOP_ID,
|
||||||
|
NewCategory = ?cat(3),
|
||||||
|
NewDetails = #domain_ShopDetails{
|
||||||
|
name = <<"UPDATED SHOP NAME">>,
|
||||||
|
description = <<"Updated shop description.">>
|
||||||
|
},
|
||||||
|
NewLocation = {url, <<"http://localhost">>},
|
||||||
|
PayoutToolID2 = ?REAL_PAYOUT_TOOL_ID2,
|
||||||
|
Schedule = ?bussched(2),
|
||||||
|
ScheduleParams = #claim_management_ScheduleModification{schedule = Schedule},
|
||||||
|
Modifications = [
|
||||||
|
?cm_shop_modification(ShopID, {category_modification, NewCategory}),
|
||||||
|
?cm_shop_modification(ShopID, {details_modification, NewDetails}),
|
||||||
|
?cm_shop_modification(ShopID, {location_modification, NewLocation}),
|
||||||
|
?cm_shop_modification(ShopID, {payout_tool_modification, PayoutToolID2}),
|
||||||
|
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Shop{
|
||||||
|
category = NewCategory,
|
||||||
|
details = NewDetails,
|
||||||
|
location = NewLocation,
|
||||||
|
payout_tool_id = PayoutToolID2,
|
||||||
|
payout_schedule = Schedule
|
||||||
|
}} = get_shop(PartyID, ShopID, C).
|
||||||
|
|
||||||
|
-spec shop_contract_modification(config()) -> _.
|
||||||
|
|
||||||
|
shop_contract_modification(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ShopID = ?REAL_SHOP_ID,
|
||||||
|
ContractID = ?REAL_CONTRACT_ID2,
|
||||||
|
PayoutToolID = ?REAL_PAYOUT_TOOL_ID1,
|
||||||
|
ShopContractParams = #claim_management_ShopContractModification{
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID
|
||||||
|
},
|
||||||
|
Modifications = [?cm_shop_modification(ShopID, {contract_modification, ShopContractParams})],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Shop{
|
||||||
|
contract_id = ContractID,
|
||||||
|
payout_tool_id = PayoutToolID
|
||||||
|
}} = get_shop(PartyID, ShopID, C).
|
||||||
|
|
||||||
|
-spec contract_termination(config()) -> _.
|
||||||
|
|
||||||
|
contract_termination(C) ->
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
Reason = #claim_management_ContractTermination{reason = <<"Because!">>},
|
||||||
|
Modifications = [?cm_contract_modification(ContractID, {termination, Reason})],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ok = accept_claim(Claim, C),
|
||||||
|
ok = commit_claim(Claim, C),
|
||||||
|
{ok, #domain_Contract{
|
||||||
|
id = ContractID,
|
||||||
|
status = {terminated, _}
|
||||||
|
}} = get_contract(PartyID, ContractID, C).
|
||||||
|
|
||||||
|
-spec contractor_already_exists(config()) -> _.
|
||||||
|
|
||||||
|
contractor_already_exists(C) ->
|
||||||
|
ContractorParams = hg_ct_helper:make_battle_ready_contractor(),
|
||||||
|
ContractorID = ?REAL_CONTRACTOR_ID1,
|
||||||
|
Modifications = [?cm_contractor_creation(ContractorID, ContractorParams)],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
Reason = <<"{invalid_contractor,{payproc_InvalidContractor,<<\"", ContractorID/binary,
|
||||||
|
"\">>,{already_exists,<<\"", ContractorID/binary, "\">>}}}">>,
|
||||||
|
{exception, #claim_management_InvalidChangeset{
|
||||||
|
reason = Reason
|
||||||
|
}} = accept_claim(Claim, C).
|
||||||
|
|
||||||
|
-spec contract_already_exists(config()) -> _.
|
||||||
|
|
||||||
|
contract_already_exists(C) ->
|
||||||
|
ContractParams = make_contract_params(?REAL_CONTRACTOR_ID1),
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
Modifications = [?cm_contract_creation(ContractID, ContractParams)],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
Reason = <<"{invalid_contract,{payproc_InvalidContract,<<\"", ContractID/binary,
|
||||||
|
"\">>,{already_exists,<<\"", ContractID/binary, "\">>}}}">>,
|
||||||
|
{exception, #claim_management_InvalidChangeset{
|
||||||
|
reason = Reason
|
||||||
|
}} = accept_claim(Claim, C).
|
||||||
|
|
||||||
|
-spec contract_already_terminated(config()) -> _.
|
||||||
|
|
||||||
|
contract_already_terminated(C) ->
|
||||||
|
ContractID = ?REAL_CONTRACT_ID1,
|
||||||
|
Reason = #claim_management_ContractTermination{reason = <<"Because!">>},
|
||||||
|
Modifications = [?cm_contract_modification(ContractID, {termination, Reason})],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
ErrorReason = <<"{invalid_contract,{payproc_InvalidContract,<<\"", ContractID/binary,
|
||||||
|
"\">>,{invalid_status,{terminated,{domain_ContractTerminated">>,
|
||||||
|
ErrorReasonSize = erlang:byte_size(ErrorReason),
|
||||||
|
{exception, #claim_management_InvalidChangeset{
|
||||||
|
reason = <<ErrorReason:ErrorReasonSize/binary, _/binary>>
|
||||||
|
}} = accept_claim(Claim, C).
|
||||||
|
|
||||||
|
-spec shop_already_exists(config()) -> _.
|
||||||
|
|
||||||
|
shop_already_exists(C) ->
|
||||||
|
Details = #domain_ShopDetails{
|
||||||
|
name = <<"SOME SHOP NAME">>,
|
||||||
|
description = <<"Very meaningfull description of the shop.">>
|
||||||
|
},
|
||||||
|
ShopID = ?REAL_SHOP_ID,
|
||||||
|
ShopParams = #claim_management_ShopParams{
|
||||||
|
category = ?cat(2),
|
||||||
|
location = {url, <<"https://example.com">>},
|
||||||
|
details = Details,
|
||||||
|
contract_id = ?REAL_CONTRACT_ID1,
|
||||||
|
payout_tool_id = ?REAL_PAYOUT_TOOL_ID1
|
||||||
|
},
|
||||||
|
ScheduleParams = #claim_management_ScheduleModification{schedule = ?bussched(1)},
|
||||||
|
Modifications = [
|
||||||
|
?cm_shop_creation(ShopID, ShopParams),
|
||||||
|
?cm_shop_account_creation(ShopID, ?cur(<<"RUB">>)),
|
||||||
|
?cm_shop_modification(ShopID, {payout_schedule_modification, ScheduleParams})
|
||||||
|
],
|
||||||
|
Claim = claim(Modifications),
|
||||||
|
Reason = <<"{invalid_shop,{payproc_InvalidShop,<<\"", ShopID/binary,
|
||||||
|
"\">>,{already_exists,<<\"", ShopID/binary, "\">>}}}">>,
|
||||||
|
{exception, #claim_management_InvalidChangeset{
|
||||||
|
reason = Reason
|
||||||
|
}} = accept_claim(Claim, C).
|
||||||
|
|
||||||
|
%%% Internal functions
|
||||||
|
|
||||||
|
claim(PartyModifications) ->
|
||||||
|
#claim_management_Claim{
|
||||||
|
id = id(),
|
||||||
|
status = {pending, #claim_management_ClaimPending{}},
|
||||||
|
changeset = [?cm_party_modification(id(), ts(), Mod) || Mod <- PartyModifications],
|
||||||
|
revision = 1,
|
||||||
|
created_at = ts()
|
||||||
|
}.
|
||||||
|
|
||||||
|
id() ->
|
||||||
|
erlang:unique_integer([positive, monotonic]).
|
||||||
|
|
||||||
|
ts() ->
|
||||||
|
hg_datetime:format_now().
|
||||||
|
|
||||||
|
cfg(Key, C) ->
|
||||||
|
hg_ct_helper:cfg(Key, C).
|
||||||
|
|
||||||
|
call(Function, Args, C) ->
|
||||||
|
ApiClient = cfg(api_client, C),
|
||||||
|
PartyID = cfg(party_id, C),
|
||||||
|
{Result, _} = hg_client_api:call(claim_committer, Function, [PartyID | Args], ApiClient),
|
||||||
|
map_call_result(Result).
|
||||||
|
|
||||||
|
accept_claim(Claim, C) ->
|
||||||
|
call('Accept', [Claim], C).
|
||||||
|
|
||||||
|
commit_claim(Claim, C) ->
|
||||||
|
call('Commit', [Claim], C).
|
||||||
|
|
||||||
|
map_call_result({ok, ok}) ->
|
||||||
|
ok;
|
||||||
|
map_call_result(Other) ->
|
||||||
|
Other.
|
||||||
|
|
||||||
|
call_pm(Fun, Args, C) ->
|
||||||
|
ApiClient = cfg(api_client, C),
|
||||||
|
{Result, _} = hg_client_api:call(party_management, Fun, [undefined | Args], ApiClient),
|
||||||
|
map_call_result(Result).
|
||||||
|
|
||||||
|
create_party(PartyID, ContactInfo, C) ->
|
||||||
|
Params = #payproc_PartyParams{contact_info = ContactInfo},
|
||||||
|
call_pm('Create', [PartyID, Params], C).
|
||||||
|
|
||||||
|
get_party(PartyID, C) ->
|
||||||
|
call_pm('Get', [PartyID], C).
|
||||||
|
|
||||||
|
get_contract(PartyID, ContractID, C) ->
|
||||||
|
call_pm('GetContract', [PartyID, ContractID], C).
|
||||||
|
|
||||||
|
get_shop(PartyID, ShopID, C) ->
|
||||||
|
call_pm('GetShop', [PartyID, ShopID], C).
|
||||||
|
|
||||||
|
make_contract_params(ContractorID) ->
|
||||||
|
make_contract_params(ContractorID, undefined).
|
||||||
|
|
||||||
|
make_contract_params(ContractorID, TemplateRef) ->
|
||||||
|
make_contract_params(ContractorID, TemplateRef, ?pinst(2)).
|
||||||
|
|
||||||
|
make_contract_params(ContractorID, TemplateRef, PaymentInstitutionRef) ->
|
||||||
|
#claim_management_ContractParams{
|
||||||
|
contractor_id = ContractorID,
|
||||||
|
template = TemplateRef,
|
||||||
|
payment_institution = PaymentInstitutionRef
|
||||||
|
}.
|
||||||
|
|
||||||
|
make_payout_tool_params() ->
|
||||||
|
#claim_management_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() -> [hg_domain:object()].
|
||||||
|
|
||||||
|
construct_domain_fixture() ->
|
||||||
|
TestTermSet = #domain_TermSet{
|
||||||
|
payments = #domain_PaymentsServiceTerms{
|
||||||
|
currencies = {value, ordsets:from_list([?cur(<<"RUB">>)])},
|
||||||
|
categories = {value, ordsets:from_list([?cat(1)])}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DefaultTermSet = #domain_TermSet{
|
||||||
|
payments = #domain_PaymentsServiceTerms{
|
||||||
|
currencies = {value, ordsets:from_list([
|
||||||
|
?cur(<<"RUB">>),
|
||||||
|
?cur(<<"USD">>)
|
||||||
|
])},
|
||||||
|
categories = {value, ordsets:from_list([
|
||||||
|
?cat(2),
|
||||||
|
?cat(3)
|
||||||
|
])},
|
||||||
|
payment_methods = {value, ordsets:from_list([
|
||||||
|
?pmt(bank_card, visa)
|
||||||
|
])}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
TermSet = #domain_TermSet{
|
||||||
|
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 = {value, [
|
||||||
|
?cfpost(
|
||||||
|
{merchant, settlement},
|
||||||
|
{system, settlement},
|
||||||
|
?share(45, 1000, operation_amount)
|
||||||
|
)
|
||||||
|
]}
|
||||||
|
},
|
||||||
|
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{
|
||||||
|
currencies = {value, ordsets:from_list([?cur(<<"RUB">>)])}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[
|
||||||
|
hg_ct_fixture:construct_currency(?cur(<<"RUB">>)),
|
||||||
|
hg_ct_fixture:construct_currency(?cur(<<"USD">>)),
|
||||||
|
|
||||||
|
hg_ct_fixture:construct_category(?cat(1), <<"Test category">>, test),
|
||||||
|
hg_ct_fixture:construct_category(?cat(2), <<"Generic Store">>, live),
|
||||||
|
hg_ct_fixture:construct_category(?cat(3), <<"Guns & Booze">>, live),
|
||||||
|
|
||||||
|
hg_ct_fixture:construct_payment_method(?pmt(bank_card, visa)),
|
||||||
|
hg_ct_fixture:construct_payment_method(?pmt(bank_card, mastercard)),
|
||||||
|
hg_ct_fixture:construct_payment_method(?pmt(bank_card, maestro)),
|
||||||
|
hg_ct_fixture:construct_payment_method(?pmt(payment_terminal, euroset)),
|
||||||
|
hg_ct_fixture:construct_payment_method(?pmt(empty_cvv_bank_card, visa)),
|
||||||
|
|
||||||
|
hg_ct_fixture:construct_payout_method(?pomt(russian_bank_account)),
|
||||||
|
hg_ct_fixture:construct_payout_method(?pomt(international_bank_account)),
|
||||||
|
|
||||||
|
hg_ct_fixture:construct_proxy(?prx(1), <<"Dummy proxy">>),
|
||||||
|
hg_ct_fixture:construct_inspector(?insp(1), <<"Dummy Inspector">>, ?prx(1)),
|
||||||
|
hg_ct_fixture:construct_system_account_set(?sas(1)),
|
||||||
|
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)),
|
||||||
|
hg_ct_fixture:construct_business_schedule(?bussched(2)),
|
||||||
|
|
||||||
|
{payment_institution, #domain_PaymentInstitutionObject{
|
||||||
|
ref = ?pinst(1),
|
||||||
|
data = #domain_PaymentInstitution{
|
||||||
|
name = <<"Test Inc.">>,
|
||||||
|
system_account_set = {value, ?sas(1)},
|
||||||
|
default_contract_template = {value, ?tmpl(1)},
|
||||||
|
providers = {value, ?ordset([])},
|
||||||
|
inspector = {value, ?insp(1)},
|
||||||
|
residences = [],
|
||||||
|
realm = test
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
|
||||||
|
{payment_institution, #domain_PaymentInstitutionObject{
|
||||||
|
ref = ?pinst(2),
|
||||||
|
data = #domain_PaymentInstitution{
|
||||||
|
name = <<"Chetky Payments Inc.">>,
|
||||||
|
system_account_set = {value, ?sas(2)},
|
||||||
|
default_contract_template = {value, ?tmpl(2)},
|
||||||
|
providers = {value, ?ordset([])},
|
||||||
|
inspector = {value, ?insp(1)},
|
||||||
|
residences = [],
|
||||||
|
realm = live
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
|
||||||
|
{payment_institution, #domain_PaymentInstitutionObject{
|
||||||
|
ref = ?pinst(3),
|
||||||
|
data = #domain_PaymentInstitution{
|
||||||
|
name = <<"Chetky Payments Inc.">>,
|
||||||
|
system_account_set = {value, ?sas(2)},
|
||||||
|
default_contract_template = {value, ?tmpl(2)},
|
||||||
|
providers = {value, ?ordset([])},
|
||||||
|
inspector = {value, ?insp(1)},
|
||||||
|
residences = [],
|
||||||
|
realm = live
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
|
||||||
|
{globals, #domain_GlobalsObject{
|
||||||
|
ref = #domain_GlobalsRef{},
|
||||||
|
data = #domain_Globals{
|
||||||
|
external_account_set = {value, ?eas(1)},
|
||||||
|
payment_institutions = ?ordset([?pinst(1), ?pinst(2)])
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
hg_ct_fixture:construct_contract_template(
|
||||||
|
?tmpl(1),
|
||||||
|
?trms(1)
|
||||||
|
),
|
||||||
|
hg_ct_fixture:construct_contract_template(
|
||||||
|
?tmpl(2),
|
||||||
|
?trms(3)
|
||||||
|
),
|
||||||
|
hg_ct_fixture:construct_contract_template(
|
||||||
|
?tmpl(3),
|
||||||
|
?trms(2),
|
||||||
|
{interval, #domain_LifetimeInterval{years = -1}},
|
||||||
|
{interval, #domain_LifetimeInterval{days = -1}}
|
||||||
|
),
|
||||||
|
hg_ct_fixture:construct_contract_template(
|
||||||
|
?tmpl(4),
|
||||||
|
?trms(1),
|
||||||
|
undefined,
|
||||||
|
{interval, #domain_LifetimeInterval{months = 1}}
|
||||||
|
),
|
||||||
|
hg_ct_fixture:construct_contract_template(
|
||||||
|
?tmpl(5),
|
||||||
|
?trms(4)
|
||||||
|
),
|
||||||
|
{term_set_hierarchy, #domain_TermSetHierarchyObject{
|
||||||
|
ref = ?trms(1),
|
||||||
|
data = #domain_TermSetHierarchy{
|
||||||
|
parent_terms = undefined,
|
||||||
|
term_sets = [#domain_TimedTermSet{
|
||||||
|
action_time = #'TimestampInterval'{},
|
||||||
|
terms = TestTermSet
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{term_set_hierarchy, #domain_TermSetHierarchyObject{
|
||||||
|
ref = ?trms(2),
|
||||||
|
data = #domain_TermSetHierarchy{
|
||||||
|
parent_terms = undefined,
|
||||||
|
term_sets = [#domain_TimedTermSet{
|
||||||
|
action_time = #'TimestampInterval'{},
|
||||||
|
terms = DefaultTermSet
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{term_set_hierarchy, #domain_TermSetHierarchyObject{
|
||||||
|
ref = ?trms(3),
|
||||||
|
data = #domain_TermSetHierarchy{
|
||||||
|
parent_terms = ?trms(2),
|
||||||
|
term_sets = [#domain_TimedTermSet{
|
||||||
|
action_time = #'TimestampInterval'{},
|
||||||
|
terms = TermSet
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{term_set_hierarchy, #domain_TermSetHierarchyObject{
|
||||||
|
ref = ?trms(4),
|
||||||
|
data = #domain_TermSetHierarchy{
|
||||||
|
parent_terms = ?trms(3),
|
||||||
|
term_sets = [#domain_TimedTermSet{
|
||||||
|
action_time = #'TimestampInterval'{},
|
||||||
|
terms = #domain_TermSet{
|
||||||
|
payments = #domain_PaymentsServiceTerms{
|
||||||
|
currencies = {value, ordsets:from_list([
|
||||||
|
?cur(<<"RUB">>)
|
||||||
|
])},
|
||||||
|
categories = {value, ordsets:from_list([
|
||||||
|
?cat(2)
|
||||||
|
])},
|
||||||
|
payment_methods = {value, ordsets:from_list([
|
||||||
|
?pmt(bank_card, visa)
|
||||||
|
])}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{bank, #domain_BankObject{
|
||||||
|
ref = ?bank(1),
|
||||||
|
data = #domain_Bank {
|
||||||
|
name = <<"Test BIN range">>,
|
||||||
|
description = <<"Test BIN range">>,
|
||||||
|
bins = ordsets:from_list([<<"1234">>, <<"5678">>])
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
].
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
-spec get_service(Name :: atom()) -> service().
|
-spec get_service(Name :: atom()) -> service().
|
||||||
|
|
||||||
|
get_service(claim_committer) ->
|
||||||
|
{dmsl_claim_management_thrift, 'ClaimCommitter'};
|
||||||
get_service(party_management) ->
|
get_service(party_management) ->
|
||||||
{dmsl_payment_processing_thrift, 'PartyManagement'};
|
{dmsl_payment_processing_thrift, 'PartyManagement'};
|
||||||
get_service(invoicing) ->
|
get_service(invoicing) ->
|
||||||
@ -55,6 +57,8 @@ get_service_spec(Name) ->
|
|||||||
|
|
||||||
-spec get_service_spec(Name :: atom(), Opts :: #{namespace => binary()}) -> service_spec().
|
-spec get_service_spec(Name :: atom(), Opts :: #{namespace => binary()}) -> service_spec().
|
||||||
|
|
||||||
|
get_service_spec(Name = claim_committer, #{}) ->
|
||||||
|
{?VERSION_PREFIX ++ "/processing/claim_committer", get_service(Name)};
|
||||||
get_service_spec(Name = party_management, #{}) ->
|
get_service_spec(Name = party_management, #{}) ->
|
||||||
{?VERSION_PREFIX ++ "/processing/partymgmt", get_service(Name)};
|
{?VERSION_PREFIX ++ "/processing/partymgmt", get_service(Name)};
|
||||||
get_service_spec(Name = invoicing, #{}) ->
|
get_service_spec(Name = invoicing, #{}) ->
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.6.0">>},2},
|
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.6.0">>},2},
|
||||||
{<<"damsel">>,
|
{<<"damsel">>,
|
||||||
{git,"git@github.com:rbkmoney/damsel.git",
|
{git,"git@github.com:rbkmoney/damsel.git",
|
||||||
{ref,"d9a1406df22992ba52fb153b9d39ac1e619f0d61"}},
|
{ref,"1526bbb22e170e5188bf9c98e554e55b001e484a"}},
|
||||||
0},
|
0},
|
||||||
{<<"dmt_client">>,
|
{<<"dmt_client">>,
|
||||||
{git,"git@github.com:rbkmoney/dmt_client.git",
|
{git,"git@github.com:rbkmoney/dmt_client.git",
|
||||||
|
Loading…
Reference in New Issue
Block a user