-
Notifications
You must be signed in to change notification settings - Fork 0
New routing 2 #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New routing 2 #201
Changes from all commits
ad3de6e
d5d5e54
f4c4dc7
402f7ca
0c12d44
9c91452
6549b7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,12 @@ | |
|
|
||
| -include_lib("damsel/include/dmsl_domain_thrift.hrl"). | ||
| -include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl"). | ||
| -include_lib("hellgate/include/domain.hrl"). | ||
|
|
||
| %% Party support functions | ||
|
|
||
| -export([get_route_payment_terms/3]). | ||
| -export([get_route_provision_terms/3]). | ||
| -export([get_party/1]). | ||
| -export([get_party_revision/0]). | ||
| -export([checkout/2]). | ||
|
|
@@ -21,9 +24,38 @@ | |
| -type party_config_ref() :: dmsl_domain_thrift:'PartyConfigRef'(). | ||
| -type shop() :: dmsl_domain_thrift:'ShopConfig'(). | ||
| -type shop_config_ref() :: dmsl_domain_thrift:'ShopConfigRef'(). | ||
| -type payment_terms() :: dmsl_domain_thrift:'PaymentsProvisionTerms'(). | ||
| -type provision_terms() :: dmsl_domain_thrift:'ProvisionTermSet'(). | ||
| -type varset() :: hg_varset:varset(). | ||
| -type revision() :: hg_domain:revision(). | ||
|
|
||
| %% Interface | ||
|
|
||
| -spec get_route_payment_terms(hg_route:payment_route(), varset(), revision()) -> payment_terms() | undefined. | ||
| get_route_payment_terms(Route, VS, Revision) -> | ||
| TermsSet = get_route_provision_terms(Route, VS, Revision), | ||
| TermsSet#domain_ProvisionTermSet.payments. | ||
|
|
||
| -spec get_route_provision_terms(hg_route:payment_route(), varset(), revision()) -> provision_terms() | undefined. | ||
| get_route_provision_terms(?route(ProviderRef, TerminalRef), VS, Revision) -> | ||
| PreparedVS = hg_varset:prepare_varset(VS), | ||
| {Client, Context} = get_party_client(), | ||
| {ok, TermsSet} = party_client_thrift:compute_provider_terminal_terms( | ||
| ProviderRef, | ||
| TerminalRef, | ||
| Revision, | ||
| PreparedVS, | ||
| Client, | ||
| Context | ||
| ), | ||
| TermsSet. | ||
|
Comment on lines
+34
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DRY. get_route_payment_terms может просто ходить в get_route_provision_terms |
||
|
|
||
| get_party_client() -> | ||
| HgContext = hg_context:load(), | ||
| Client = hg_context:get_party_client(HgContext), | ||
| Context = hg_context:get_party_client_context(HgContext), | ||
| {Client, Context}. | ||
|
|
||
| -spec get_party(party_config_ref()) -> {party_config_ref(), party()} | hg_domain:get_error(). | ||
| get_party(PartyConfigRef) -> | ||
| checkout(PartyConfigRef, get_party_revision()). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,9 +447,8 @@ payment_w_all_blacklisted(C) -> | |
| ?payment_ev(PaymentID, ?shop_limit_initiated()), | ||
| ?payment_ev(PaymentID, ?shop_limit_applied()), | ||
| ?payment_ev(PaymentID, ?risk_score_changed(_RiskScore)), | ||
| ?payment_ev(PaymentID, ?route_changed(_Route)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Как так получилось? Куда он делся?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. роутинг начал по другому работать - там теперь если у тебя после получения роутов пустой список то нет события с роутами, сразу идет фейл платежа |
||
| ?payment_ev(PaymentID, ?payment_rollback_started({failure, _Failure})) | ||
| ] = next_changes(InvoiceID, 6, Client), | ||
| ?payment_ev(PaymentID, ?payment_status_changed(?failed({failure, _Failure}))) | ||
| ] = next_changes(InvoiceID, 5, Client), | ||
| ?invoice_state( | ||
| ?invoice_w_status(?invoice_unpaid()), | ||
| [_PaymentSt] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы InvalidRequest ловил и игнорил тоже.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
там же issue_call ловит все {exception, Error} ->