Skip to content

BG-834: Recurrent cascade#200

Open
ndiezel0 wants to merge 2 commits intomasterfrom
BG-834/customers
Open

BG-834: Recurrent cascade#200
ndiezel0 wants to merge 2 commits intomasterfrom
BG-834/customers

Conversation

@ndiezel0
Copy link
Contributor

No description provided.

@ndiezel0 ndiezel0 requested a review from WWWcool March 19, 2026 21:59
Copy link
Contributor

@WWWcool WWWcool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понял в какой момент происходит добавление реккурентного токена к карте/кастумеру - это по идее на получение от провайдера должно работать, но кода нет. Тестов мало, нужен тесты на каскад и подтверждением работы

adjustments = [] :: [hg_invoice_payment:adjustment()],
recurrent_token :: undefined | dmsl_domain_thrift:'Token'(),
cascade_recurrent_tokens ::
undefined | #{dmsl_customer_thrift:'ProviderTerminalKey'() => dmsl_domain_thrift:'Token'()},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
undefined | #{dmsl_customer_thrift:'ProviderTerminalKey'() => dmsl_domain_thrift:'Token'()},
undefined | hg_customer_client:cascade_tokens(),

init_per_testcase(Name, C) ->
init_per_testcase(default, Name, C).

init_per_testcase(default, Name, C) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишнее?

CustomerID = <<"test-customer-42">>,
RecurrentParent = ?recurrent_parent(Invoice1ID, Payment1ID),
BaseParams = make_recurrent_payment_params(true, RecurrentParent, ?pmt_sys(<<"visa-ref">>)),
Payment2Params = BaseParams#payproc_InvoicePaymentParams{customer_id = CustomerID},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а если не передать парент реккурент - сохранится?

%% Second recurrent payment: hellgate queries cubasty, gets token for ?prv(1)/?trm(1)
Invoice2ID = start_invoice(<<"rubberduck">>, make_due_date(10), 42000, C),
RecurrentParent = ?recurrent_parent(Invoice1ID, Payment1ID),
Payment2Params = make_recurrent_payment_params(true, RecurrentParent, ?pmt_sys(<<"visa-ref">>)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

при этом здесь у тебя нет указания кастумера - что то я теряюсь в том что происходит, пойду дальше код платежа смотреть)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

будем коммитить?

{genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.1"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {tag, "v2.2.27"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "BG-834/customer_payment"}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не забыть

end,
Events = [?payment_started(Payment2)],
{collapse_changes(Events, undefined, #{}), {Events, hg_machine_action:instant()}}.
InitSt = #st{activity = {payment, new}, cascade_recurrent_tokens = CascadeTokens},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

то есть в событиях это не летит и нельзя будет понять откуда ноги растут - логов у клиента тоже нет


filter_routes_by_recurrent_tokens(Ctx, #st{cascade_recurrent_tokens = undefined}) ->
Ctx;
filter_routes_by_recurrent_tokens(Ctx, #st{cascade_recurrent_tokens = Tokens}) when map_size(Tokens) =:= 0 ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ты же там сверху на ините проверяешь что их больше 0, тут может быть такой клаус?

-spec process_routing(action(), st()) -> machine_result().
process_routing(Action, St) ->
{PaymentInstitution, VS, Revision} = route_args(St),
Ctx0 = hg_routing_ctx:with_guard(build_routing_context(PaymentInstitution, VS, Revision, St)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот тут он у тебя выберет 1 роут из родительского реккурента и никакого каскада не будет

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants