Skip to content

Commit 6440a47

Browse files
authored
EMP-327: Allows to reopen all chargebacks (not only rejected ones) (#155)
* Allows to reopen all chargebacks (not only rejected ones) * Retires `iosetopts`
1 parent 4162d69 commit 6440a47

File tree

4 files changed

+3
-39
lines changed

4 files changed

+3
-39
lines changed

.github/workflows/erlang-checks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
thrift-version: ${{ steps.thrift-version.outputs.version }}
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222
- run: grep -v '^#' .env >> $GITHUB_ENV
2323
- id: otp-version
2424
run: echo "::set-output name=version::$OTP_VERSION"
@@ -30,7 +30,7 @@ jobs:
3030
run:
3131
name: Run checks
3232
needs: setup
33-
uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.17
33+
uses: valitydev/erlang-workflows/.github/workflows/erlang-parallel-build.yml@v1.0.18
3434
with:
3535
otp-version: ${{ needs.setup.outputs.otp-version }}
3636
rebar-version: ${{ needs.setup.outputs.rebar-version }}

apps/hellgate/src/hg_invoice_payment_chargeback.erl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ do_accept(State, PaymentState, AcceptParams = ?accept_params(Levy, Body)) ->
329329

330330
-spec do_reopen(state(), payment_state(), reopen_params()) -> {ok, result()} | no_return().
331331
do_reopen(State, PaymentState, ReopenParams = ?reopen_params(Levy, Body)) ->
332-
_ = validate_chargeback_is_rejected(State),
333332
_ = validate_not_arbitration(State),
334333
_ = validate_currency(Body, hg_invoice_payment:get_payment(PaymentState)),
335334
_ = validate_currency(Levy, hg_invoice_payment:get_payment(PaymentState)),
@@ -597,13 +596,6 @@ validate_not_arbitration(#domain_InvoicePaymentChargeback{stage = ?chargeback_st
597596
validate_not_arbitration(#domain_InvoicePaymentChargeback{}) ->
598597
ok.
599598

600-
validate_chargeback_is_rejected(#chargeback_st{chargeback = Chargeback}) ->
601-
validate_chargeback_is_rejected(Chargeback);
602-
validate_chargeback_is_rejected(#domain_InvoicePaymentChargeback{status = ?chargeback_status_rejected()}) ->
603-
ok;
604-
validate_chargeback_is_rejected(#domain_InvoicePaymentChargeback{status = Status}) ->
605-
throw(#payproc_InvoicePaymentChargebackInvalidStatus{status = Status}).
606-
607599
validate_chargeback_is_pending(#chargeback_st{chargeback = Chargeback}) ->
608600
validate_chargeback_is_pending(Chargeback);
609601
validate_chargeback_is_pending(#domain_InvoicePaymentChargeback{status = ?chargeback_status_pending()}) ->

apps/hellgate/test/hg_invoice_tests_SUITE.erl

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
-export([accept_payment_chargeback_twice/1]).
129129
-export([accept_payment_chargeback_new_body/1]).
130130
-export([accept_payment_chargeback_new_levy/1]).
131-
-export([reopen_accepted_payment_chargeback_fails/1]).
132131
-export([reopen_payment_chargeback_inconsistent/1]).
133132
-export([reopen_payment_chargeback_exceeded/1]).
134133
-export([reopen_payment_chargeback_cancel/1]).
@@ -389,7 +388,6 @@ groups() ->
389388
accept_payment_chargeback_twice,
390389
accept_payment_chargeback_new_body,
391390
accept_payment_chargeback_new_levy,
392-
reopen_accepted_payment_chargeback_fails,
393391
reopen_payment_chargeback_inconsistent,
394392
reopen_payment_chargeback_exceeded,
395393
reopen_payment_chargeback_cancel,
@@ -4064,30 +4062,6 @@ accept_payment_chargeback_new_levy(C) ->
40644062
?assertEqual(Paid - Cost - NewLevyAmount, maps:get(min_available_amount, Settlement1)),
40654063
?assertEqual(Paid - Cost - NewLevyAmount, maps:get(max_available_amount, Settlement1)).
40664064

4067-
-spec reopen_accepted_payment_chargeback_fails(config()) -> _ | no_return().
4068-
reopen_accepted_payment_chargeback_fails(C) ->
4069-
Client = cfg(client, C),
4070-
Cost = 42000,
4071-
LevyAmount = 5000,
4072-
Levy = ?cash(LevyAmount, <<"RUB">>),
4073-
CBParams = make_chargeback_params(Levy),
4074-
{IID, PID, _SID, CB} = start_chargeback(C, Cost, CBParams, make_payment_params(?pmt_sys(<<"visa-ref">>))),
4075-
CBID = CB#domain_InvoicePaymentChargeback.id,
4076-
[
4077-
?payment_ev(PID, ?chargeback_ev(CBID, ?chargeback_created(CB))),
4078-
?payment_ev(PID, ?chargeback_ev(CBID, ?chargeback_cash_flow_changed(_)))
4079-
] = next_changes(IID, 2, Client),
4080-
AcceptParams = make_chargeback_accept_params(),
4081-
ok = hg_client_invoicing:accept_chargeback(IID, PID, CBID, AcceptParams, Client),
4082-
[
4083-
?payment_ev(PID, ?chargeback_ev(CBID, ?chargeback_target_status_changed(?chargeback_status_accepted()))),
4084-
?payment_ev(PID, ?chargeback_ev(CBID, ?chargeback_status_changed(?chargeback_status_accepted()))),
4085-
?payment_ev(PID, ?payment_status_changed(?charged_back()))
4086-
] = next_changes(IID, 3, Client),
4087-
ReopenParams = make_chargeback_reopen_params(Levy),
4088-
Error = hg_client_invoicing:reopen_chargeback(IID, PID, CBID, ReopenParams, Client),
4089-
?assertMatch(?invalid_chargeback_status(_), Error).
4090-
40914065
-spec reopen_payment_chargeback_inconsistent(config()) -> _ | no_return().
40924066
reopen_payment_chargeback_inconsistent(C) ->
40934067
Client = cfg(client, C),

rebar.config

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@
7777
% for introspection on production
7878
{recon, "2.5.2"},
7979
{logger_logstash_formatter,
80-
{git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}},
81-
{iosetopts, {git, "https://github.com/valitydev/iosetopts.git", {ref, "edb445c"}}}
80+
{git, "https://github.com/valitydev/logger_logstash_formatter.git", {ref, "08a66a6"}}}
8281
]},
8382
{relx, [
8483
{release, {hellgate, "0.1"}, [
85-
iosetopts,
8684
{recon, load},
8785
{runtime_tools, load},
8886
{tools, load},

0 commit comments

Comments
 (0)