Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
123 stars 134 forks source link

Wrong SecureModeReturnURL and SecureModeRedirectURL when apply 3DS #509

Closed duykhanh91 closed 3 years ago

duykhanh91 commented 3 years ago

hello guys, I get two issue when apply 3DS. This is my code when call payin

$idCollect = DB::table('collects')->max('id') + 2501;
        $payInSender = new \MangoPay\PayIn();
        $payInSender->AuthorId = $authorId;
        $payInSender->Tag = 'CRAFTMAN PAYS COLLECT';
        $payInSender->CreditedUserId = $creditedUserId;
        $payInSender->DebitedFunds = new \MangoPay\Money();
        $payInSender->DebitedFunds->Currency = 'EUR';
        $payInSender->DebitedFunds->Amount = $money;
        $payInSender->Fees = new \MangoPay\Money();
        $payInSender->Fees->Currency = 'EUR';
        $payInSender->Fees->Amount = $fee;
        $payInSender->CreditedWalletId = $creditedWalletId;

        $payInSender->PaymentDetails = new \MangoPay\PayInPaymentDetailsCard();
        $payInSender->PaymentDetails->CardId = $cardId;
        $payInSender->PaymentDetails->StatementDescriptor = 'BDC' . str_pad($idCollect, 7, '0', STR_PAD_LEFT);
        $payInSender->PaymentDetails->IpAddress = $dataHeader->IpAddress;
        $payInSender->PaymentDetails->BrowserInfo = $dataHeader->BrowserInfo;

        $payInSender->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
        $payInSender->ExecutionDetails->SecureModeReturnURL = 'https://xxx/#/app/craftsmen/3ds-process';
        $payInSender->ExecutionDetails->Requested3DSVersion = "V2_1";
        return $this->mangopay->PayIns->Create($payInSender);

And get response

SecureModeRedirectURL: "https://api.sandbox.mangopay.com:443/Redirect/ACSWithValidation?token=1be7c2bbc941413c874548aaf83fc58c&mgpsecureid=1be7c2bbc941413c874548aaf83fc58c"
SecureModeReturnURL: "https://xxx?transactionId=113324094#/app/craftsmen/3ds-process"
H4wKs commented 3 years ago

Hi @duykhanh91,

I would make a quick test and replace 'https://xxx/#/app/craftsmen/3ds-process' by 'https://xxx/app/craftsmen/3ds-process' and see if that generate the URL correctly. When I click your SecureModeRedirectURL, it works just fine on my side and I got redirected to your site https://eco****.apac.****.tech/uat/ecodrop/?transactionId=113324094#/app/craftsmen/deposite/create So the problem is limited to the wrong formatting of the returnURL and I bet the '/#/' is what make it go wrong.

duykhanh91 commented 3 years ago

Hi @duykhanh91,

I would make a quick test and replace 'https://xxx/#/app/craftsmen/3ds-process' by 'https://xxx/app/craftsmen/3ds-process' and see if that generate the URL correctly. When I click your SecureModeRedirectURL, it works just fine on my side and I got redirected to your site https://eco****.apac.****.tech/uat/ecodrop/?transactionId=113324094#/app/craftsmen/deposite/create So the problem is limited to the wrong formatting of the returnURL and I bet the '/#/' is what make it go wrong.

Why we get this issue? because on the last checking it is ok but now it is wrong ?

H4wKs commented 3 years ago

@duykhanh91 I don't know, I am just another user of this SDK, trying to help you figure out what and where the problem is. Once the problem is identified, either you did something wrong and you can fix it, either the SDK is broken and any contributor out here can help, either the API is broken and someone from Mango need to fix it. My suggestion is only to help identify the problem, not a fix.

duykhanh91 commented 3 years ago

@duykhanh91 I don't know, I am just another user of this SDK, trying to help you figure out what and where the problem is. Once the problem is identified, either you did something wrong and you can fix it, either the SDK is broken and any contributor out here can help, either the API is broken and someone from Mango need to fix it. My suggestion is only to help identify the problem, not a fix.

thanks @H4wKs. I will contact with Mangopay support

Thithip commented 3 years ago

Hi @duykhanh91,

We have the same issue, with a different SDK language, and it's seems that the # in the URL was not properly interpreted by the MangoPay API.

Did you solve your issue?

duykhanh91 commented 3 years ago

Hi @duykhanh91,

We have the same issue, with a different SDK language, and it's seems that the # in the URL was not properly interpreted by the MangoPay API.

Did you solve your issue?

i change to use Hooks

Thithip commented 3 years ago

Ok thanks 👌