Skip to content

Commit

Permalink
fix: 🐛 Farzin/Aum/WEBREL-1102/pa-withdrawal-redirection-fix (binary-c…
Browse files Browse the repository at this point in the history
…om#9759)

* fix: fixed pa_withdrawal page issue

* Merge branch 'master' into pr/aum-deriv/9759

---------

Co-authored-by: Farzin Mirzaie <farzin@deriv.com>
  • Loading branch information
aum-deriv and Farzin Mirzaie committed Aug 21, 2023
1 parent 09733d0 commit bc8882d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,10 @@ const PaymentAgentContainer = observer(({ is_deposit }: TPaymentAgentContainer)
is_withdraw_successful,
onChangePaymentMethod,
filtered_list: payment_agent_list,
resetPaymentAgent,
selected_bank,
supported_banks,
} = payment_agent_store;

React.useEffect(() => {
return () => {
if (!is_deposit) {
resetPaymentAgent();
}
};
}, [is_deposit, resetPaymentAgent]);

React.useEffect(() => {
return () => {
onChangePaymentMethod({ target: { value: '0' } });
Expand Down
4 changes: 4 additions & 0 deletions packages/cashier/src/stores/general-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export default class GeneralStore extends BaseStore {
}

setActiveTab(container: typeof this.active_container): void {
if (this.active_container === 'payment_agent' && container !== 'payment_agent') {
this.root_store.modules.cashier.payment_agent.resetPaymentAgent();
}

this.active_container = container;
}

Expand Down
11 changes: 6 additions & 5 deletions packages/cashier/src/stores/payment-agent-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export default class PaymentAgentStore {
}

setActiveTab(index: number) {
if (this.active_tab_index === 1 && index === 0) {
this.resetPaymentAgent();
}

this.setActiveTabIndex(index);
}

Expand Down Expand Up @@ -362,11 +366,8 @@ export default class PaymentAgentStore {
}

resetPaymentAgent = () => {
const { client, modules } = this.root_store;
const { active_container } = modules.cashier.general_store;
const container = Constants.map_action[active_container as 'withdraw' | 'payment_agent'];

client.setVerificationCode('', container);
const { client } = this.root_store;
client.setVerificationCode('', 'payment_agent_withdraw');
this.error.setErrorMessage({ code: '', message: '' });
this.setIsWithdraw(false);
this.setIsWithdrawSuccessful(false);
Expand Down

0 comments on commit bc8882d

Please sign in to comment.