Author Topic: NewPayment Extension - Stuck with response handling  (Read 5062 times)

Offline donthecat

  • Newbie
  • *
  • Posts: 29
  • Karma: +2/-0
  • You aint Cool if you aint Green...
    • View Profile
NewPayment Extension - Stuck with response handling
« on: April 02, 2018, 05:36:36 PM »
I'm autonomously developing a new extension for the EaseBuzz payment gateway (India specific), which will be offered free to the AbanteCart community as soon as I sort out one issue that seems to be bugging me...

The extension installs and works perfectly both in Test and Live modes. The payment gateway transaction goes smoothly, both for Successful and Failed scenarios. I also tried a Live transaction,  the Card got debited and the PG dashboard shows it as a Successful transaction.

The Buyer's transaction response, the Buyer's Order Records, the Store Admin dashboard show "Failed" for all transactions. The stock gets reduced and a success mail get sent to the Buyer...

I realise that I'm sending a wrong response (or none) to the Storefront controller from the PG processing file. I've gone through the code, but I'm just not able to figure out where I'm going wrong. I'm not a JSON coder and I think I'm missing something... the error logs don't provide any warnings.

I've attached the php files for reference... Request help from someone to point out the error I'm doing.

Looking forward to offering AbanteCart, India's first free Payment Gateway extension.

Cheers

 
You aint Cool if you aint Green...

Save Earth ! It's the Only Planet with Chocolates !!

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: NewPayment Extension - Stuck with response handling
« Reply #1 on: April 05, 2018, 04:46:32 AM »
Hi.
It looks like you have issue the same as for pp_standart.
After pressing button "Confirm" on checkout/conform page your customer will be reditected to third-party site (in your case easyBuzz side).
Then, after payment, will be redirected back on checkout/success page. But connection server-server (i mean post-request from their API to your response/callback) will be after redirect. In this case checkout/success see that order status is zero (incomplete) and set it to "failed".

Please check our solution for paypal_standart extension. We created additional page with periodical ajax and asks response controller is payment confirmed (page for pending of api confirmation).
Logic of this:
1. create hook to checkout/success controller InitData() and check is order incomplete and payment method is easyBuzz. If true - redirect to "pending payment page".
2. This page asks every 5 seconds your response controller method is_confirmed() with timeout 30sec. If order status still 0 - returns false. if status greater 0(api asked callback and changed order status) - returns true. If "true" OR timeout exceed - redirect back to checkout/success page. In 1st case order will be completed correctly. Otherwise - failed

Please check this commit https://github.com/abantecart/abantecart-src/commit/0a5adf666a869393ee30f1d38689fb09b6fd1cbe
You can copy whole file with hooks, methods pending_payments() and is_confirmed(), and pending_ipn.tpl

Hope this hepls

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline donthecat

  • Newbie
  • *
  • Posts: 29
  • Karma: +2/-0
  • You aint Cool if you aint Green...
    • View Profile
Re: NewPayment Extension - Stuck with response handling
« Reply #2 on: April 10, 2018, 03:12:16 PM »
Thanks a mil, Abalabo....

Sorry, I was stuck in another webdev and couldn't check this earlier... I'm now testing it out...

will revret with notes ...
You aint Cool if you aint Green...

Save Earth ! It's the Only Planet with Chocolates !!

Offline donthecat

  • Newbie
  • *
  • Posts: 29
  • Karma: +2/-0
  • You aint Cool if you aint Green...
    • View Profile
Re: NewPayment Extension - Stuck with response handling
« Reply #3 on: April 21, 2018, 04:33:44 AM »
Hi Abalabo,

I took your advice and reworked on my code and added the hooks and other embellishments as suggested in the commit...

However, I'm still facing the same problem and I'm not able to figure out where I'm going wrong.

I'm not very familiar with JSON and I'm still in the process of understanding AbanteCart coding.

I've been stuck with this extension for a month now and we are unable to launch the Store till now  :-\ :-\

Any help will be wholesomely appreciated... Many Thanks !
You aint Cool if you aint Green...

Save Earth ! It's the Only Planet with Chocolates !!

Offline donthecat

  • Newbie
  • *
  • Posts: 29
  • Karma: +2/-0
  • You aint Cool if you aint Green...
    • View Profile
Re: NewPayment Extension - Stuck with response handling
« Reply #4 on: May 02, 2018, 04:32:18 PM »
Thanks....
We have completed the Extension and will be offering it FREE from tonight...
You aint Cool if you aint Green...

Save Earth ! It's the Only Planet with Chocolates !!

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: NewPayment Extension - Stuck with response handling
« Reply #5 on: May 03, 2018, 01:33:05 AM »
Thank you, donthecat
You are online already https://marketplace.abantecart.com/easebuzz

Offline donthecat

  • Newbie
  • *
  • Posts: 29
  • Karma: +2/-0
  • You aint Cool if you aint Green...
    • View Profile
Re: NewPayment Extension - Stuck with response handling
« Reply #6 on: May 03, 2018, 02:28:03 AM »
Many Thanks, Basara...

You aint Cool if you aint Green...

Save Earth ! It's the Only Planet with Chocolates !!

 

Powered by SMFPacks Social Login Mod