amsgames / laravel-shop

Laravel shop package
MIT License
483 stars 166 forks source link

I just encountered a pretty unique error about Paypal Express transactions. #22

Open OzanKurt opened 8 years ago

OzanKurt commented 8 years ago

I will provide information as soon as I finish checkout part.

PS: Best package ever! :+1:

OzanKurt commented 8 years ago

There is this code in the docoumenation:

        // (1) - Set gateway
        Shop::setGateway('paypalExpress');

        // (2) - Call checkout / OPTIONAL
        // You can call this to keep a standard flow
        // Although this step for this gateway is not needed.
        Shop::checkout();

        // (3) - Create order
        $order = Shop::placeOrder();

        // (4) - Review order and redirect to payment
        if ($order->isPending) {

          // PayPal URL to redirect to proceed with payment
          $approvalUrl = Shop::gateway()->getApprovalUrl();

          // Redirect to url
          return redirect($approvalUrl);
        }

        // (5) - Callback
        // You don't have to do anything.
        // Laravel Shop will handle the callback and redirect the customer to the configured route.

There is a problem by this code. The 5th point is wrong. When there is an error about the transaction, there won't be any errors displayed to the user.

I had this following debug:

it places the order first https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2FxBluoh2.png&width=288&height=250

Then it calls onCharge method on it https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2F98jcUZ6.png&width=315&height=250

It gives an error here... which doesn't display any fucking shit on the screen https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2F62StQPE.png&width=490&height=250

But after i dumped it out. I saw that the only wrong thing was the currency in the settings folder https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2FkpVZlTU.png&width=853&height=234

Well the whole point of this was to show that the application doesn't throw exceptions after catching them.

amsgames commented 8 years ago

How is your item configuration looking? What type of currency are you using? On Dec 2, 2015 11:39 AM, "Ozan Kurt" notifications@github.com wrote:

There is this code in the docoumenation:

    // (1) - Set gateway        Shop::setGateway('paypalExpress');        // (2) - Call checkout / OPTIONAL        // You can call this to keep a standard flow        // Although this step for this gateway is not needed.        Shop::checkout();        // (3) - Create order        $order = Shop::placeOrder();        // (4) - Review order and redirect to payment        if ($order->isPending) {          // PayPal URL to redirect to proceed with payment          $approvalUrl = Shop::gateway()->getApprovalUrl();          // Redirect to url          return redirect($approvalUrl);        }        // (5) - Callback        // You don't have to do anything.        // Laravel Shop will handle the callback and redirect the customer to the configured route.

There is a problem by this code. The 5th point is wrong. When there is an error about the transaction, there won't be any errors displayed to the user.

I had this following debug:

it places the order first [image: https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2FxBluoh2.png&width=288&height=250] https://camo.githubusercontent.com/93f9131fac95198a53e9d550b47f695a4c7159d1/68747470733a2f2f736c61636b2d696d67732e636f6d2f3f75726c3d68747470253341253246253246692e696d6775722e636f6d25324678426c756f68322e706e672677696474683d323838266865696768743d323530

Then it calls onCharge method on it [image: https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2F98jcUZ6.png&width=315&height=250] https://camo.githubusercontent.com/9031c9848f22fa65129d4bb6a7380f026d76b3c6/68747470733a2f2f736c61636b2d696d67732e636f6d2f3f75726c3d68747470253341253246253246692e696d6775722e636f6d25324639386a63555a362e706e672677696474683d333135266865696768743d323530

It gives an error here... which doesn't display any fucking shit on the screen [image: https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2F62StQPE.png&width=490&height=250] https://camo.githubusercontent.com/cb6ecea0fa9f0bbe4f19192f1ecfd8fcf9b13917/68747470733a2f2f736c61636b2d696d67732e636f6d2f3f75726c3d68747470253341253246253246692e696d6775722e636f6d253246363253745150452e706e672677696474683d343930266865696768743d323530

But after i dumped it out. I saw that the only wrong thing was the currency in the settings folder [image: https://slack-imgs.com/?url=http%3A%2F%2Fi.imgur.com%2FkpVZlTU.png&width=853&height=234] https://camo.githubusercontent.com/5ab76009feb26a89304363aaebf189ec26dd2440/68747470733a2f2f736c61636b2d696d67732e636f6d2f3f75726c3d68747470253341253246253246692e696d6775722e636f6d2532466b70565a6c54552e706e672677696474683d383533266865696768743d323334

Well the whole point of this was to show that the application doesn't throw exceptions after catching them.

— Reply to this email directly or view it on GitHub https://github.com/amsgames/laravel-shop/issues/22#issuecomment-161376083 .

OzanKurt commented 8 years ago

I used to use a non existent currency (TL), then i fixed it. The point is that the developer doesn't see any errors even if you try to throw an exception.

amostajo commented 8 years ago

Have you seen if these errors are in the log file? On Dec 2, 2015 2:44 PM, "Ozan Kurt" notifications@github.com wrote:

I used to use a non existent currency (TL), then i fixed it. The point is that the developer doesn't see any errors even if you try to throw an exception.

— Reply to this email directly or view it on GitHub https://github.com/amsgames/laravel-shop/issues/22#issuecomment-161428897 .

OzanKurt commented 8 years ago

Sadly, no.

Ozan Kurt

On 2 Dec 2015, at 23:56, Alejandro Mostajo notifications@github.com wrote:

Have you seen if these errors are in the log file? On Dec 2, 2015 2:44 PM, "Ozan Kurt" notifications@github.com wrote:

I used to use a non existent currency (TL), then i fixed it. The point is that the developer doesn't see any errors even if you try to throw an exception.

— Reply to this email directly or view it on GitHub https://github.com/amsgames/laravel-shop/issues/22#issuecomment-161428897 .

— Reply to this email directly or view it on GitHub.