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,27 +120,71 @@ 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();
}
}
// 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 }
)
// ],
// { cancelable: false }
// )
// }
// }
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) {
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 }
)
}
}
}
}
getRequestBody () {
return {
type: 11,
cvv: this.state.codeCVV,
id_wallet_user: this.state.wallet.id,
montant: this.state.montant,
password: this.state.password
}
}
renderDialogGetCommissionResponse = () => {
const { errorEnvoieWalletToCardGetCommission } = this.props;
@ -222,13 +266,7 @@ class RetraitCarteVersCashUser extends Component {
isModalConfirmVisible: false,
isDataSubmit: true
});
this.props.envoieUserWalletToCardAction({
type: 11,
cvv: this.state.codeCVV,
id_wallet_user: this.state.wallet.id,
montant: this.state.montant,
password: this.state.password
});
this.props.envoieUserWalletToCardAction(this.getRequestBody());
this.props.getCommissionUserWalletToCardReset();
}} />

View File

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