Re: Payment Gatway - PayFast
Perhaps I understand this the wrong way, but isn't that field a order status rather then a payment status? I mean that you are using it in a way the staus was not intended for. What happens when the payment is unsuccessful? I assume the status is not changed?
Also see here (and especially look at my third post): https://github.com/isotope/core/issues/612. I eventually asked to make an elaborate order history. It would allow to add payment states with a timestamp and have a chronological list that also will log that for example the customer went to the gateway but never returned, or returned successfully much later. Just whatever your module makes of it...
Re: Payment Gatway - PayFast
Yes. OK. That's true, but if for some reason the redirect back from PayFast is interrupted, then the transaction is not marked as complete (when you reach /checkout/complete), so no order is generated, however the payment could have been successful and the ITN which is called from the payment gateway to the isotope postsale(). The ITN is the ONLY way to really determine if the payment was successful, however if I never land on the checkout/complete, then the payment being complete, cannot change the order status.
Then I completely misunderstand the way payment gateways in isotope work. Since there is no dev documentation that I know of, I've had to puzzle it out from the other payment gateways.
So, basically I screwed myself here by saying yes to the client. Ugh. :roll:
Re: Payment Gatway - PayFast
To be honest I still haven't figured the entire process out. In many stores I am able to complete an order and from the client portal open any order to go to the payment gateway. That is something you would need, right? In that case you would always have your module report success, but set payment status to not complete. You would have to add an option to retry the payment for logged in clients. Not sure what else you need to look at (e-mails and all that are sent on completed orders)
More elaborate documentation would be nice...
Re: Payment Gatway - PayFast
I just set the payment gateway return url to point to step/complete to flag the order as complete. Then while busy making the payment, the ITN runs from the gateway – usually way before the checkout it complete, because is called immediately after payment and the gateway adds a few seconds before redirecting. Then I set the date_payed (old spelling error on older version) to the date, and I add another payment value of "status"=VALID. This can only be set by the payment gateway ITN script (which calls postsale.php&mod=xx&id=xx).
When I return to the checkout step complete. all the payment gateway does it flags the order as complete and the order e-mail is sent out. Then I have a writeOrder HOOK to run just before the order e-mail is sent. Getting this to automatically send out the voucher if the payment is valid, the order is complete and the date_payed is set.
Now I'm busy setting up a manual process for the voucher, just in case something went wrong, then the BE user can also send the voucher.
THIS is where I'm having lots of problems. To setup that e-mail info in the BE from an order is pretty nasty. The payment gateway (e.g. $objOrder->Payment ) doesn't use the order information in it's variable retrieval, it uses the Cart? Ugh. All I wanted to do was to render the same cart_html that the order e-mail uses, but I guess I'll have to skip that. just give a breakdown of the products and leave it like that (otherwise the surcharges are empty).