retrait de carte vers cash redirection vers la webView

This commit is contained in:
Novic-Djef 2023-06-22 19:48:39 +01:00
parent d004571ee7
commit 9d3609a4a2
2 changed files with 62 additions and 25 deletions

View File

@ -120,7 +120,40 @@ class RetraitCarteVersCashUser extends Component {
} }
} }
// if (resultEnvoieWalletToCard !== null) {
// if (resultEnvoieWalletToCard.response !== null) {
// Alert.alert(
// I18n.t("WITHDRAWAL_SUCCESS"),
// resultEnvoieWalletToCard.response,
// [
// {
// text: I18n.t("OK"), onPress: () => {
// this.props.envoieUserWalletToCardReset();
// IlinkEmitter.emit("refreshWallet");
// this.props.navigation.pop();
// }
// }
// ],
// { cancelable: false }
// )
// }
// }
if (resultEnvoieWalletToCard !== null) { if (resultEnvoieWalletToCard !== null) {
if (resultEnvoieWalletToCard.status === 301) {
this.props.envoieUserWalletToCardReset();
try{
this.props.navigation.push('webviewScreen', {
url: resultEnvoieWalletToCard.response.payment_url,
requestBody: this.getRequestBody()
});
} catch(error) {
console.log('error', error);
}
}
if (resultEnvoieWalletToCard.status === 200) {
if (resultEnvoieWalletToCard.response !== null) { if (resultEnvoieWalletToCard.response !== null) {
Alert.alert( Alert.alert(
I18n.t("WITHDRAWAL_SUCCESS"), I18n.t("WITHDRAWAL_SUCCESS"),
@ -140,6 +173,17 @@ class RetraitCarteVersCashUser extends Component {
} }
} }
} }
}
getRequestBody () {
return {
type: 11,
cvv: this.state.codeCVV,
id_wallet_user: this.state.wallet.id,
montant: this.state.montant,
password: this.state.password
}
}
renderDialogGetCommissionResponse = () => { renderDialogGetCommissionResponse = () => {
@ -222,13 +266,7 @@ class RetraitCarteVersCashUser extends Component {
isModalConfirmVisible: false, isModalConfirmVisible: false,
isDataSubmit: true isDataSubmit: true
}); });
this.props.envoieUserWalletToCardAction({ this.props.envoieUserWalletToCardAction(this.getRequestBody());
type: 11,
cvv: this.state.codeCVV,
id_wallet_user: this.state.wallet.id,
montant: this.state.montant,
password: this.state.password
});
this.props.getCommissionUserWalletToCardReset(); this.props.getCommissionUserWalletToCardReset();
}} /> }} />

View File

@ -115,7 +115,6 @@ class RetraitCarteVersWalletUser extends Component {
if (errorEnvoieWalletToCard !== null) { if (errorEnvoieWalletToCard !== null) {
if (typeof errorEnvoieWalletToCard.data !== 'undefined') { if (typeof errorEnvoieWalletToCard.data !== 'undefined') {
console.warn("errorEnvoieWalletToCard.data: ", errorEnvoieWalletToCard.data)
Alert.alert( Alert.alert(
I18n.t("WITHDRAWAL_ERROR"), I18n.t("WITHDRAWAL_ERROR"),
errorEnvoieWalletToCard.data.error, errorEnvoieWalletToCard.data.error,