Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-10-2021 09:21:04

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1679

utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Sorry Nick, another project I need a pointer on!

Sagepay(Now called Opayo) offer a Pay By Link desktop application whereby you can create a link in the application, copy it into an email and send it to customer. Customer clicks link and it takes them directly to Sagepay Payment page. I suppose it is similar in some ways to paypal express or creating a pay now button in your paypal account.

Anyway, i have expanded this method and included a Pay Now link in ordersummaryxhml.php. When I send customer a quote, it includes a Pay Now link which takes them direct to Sagepay payment payment preloaded with all the relevant information including order ID and success url's.

When payment is made, customer is redirected to utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK&crypt=@d6479393.............. , exactly the same as if they had paid through sagepay form method on website.

Problem is, the order doesn't get processed and marked as paid. I assume it is because the order isn't enabled as this stage as it is only a quote.

When returned to site, the error is:
The following error occurred while attempting to process your transaction: The order number transmitted by the online processor was invalid. The referring processor is not listed as the processor for the order.

So question is, where does the success url goto to update the order status.
I may be able to override this error if I know where this check is made.


- Euorpacart 8

Offline

 

#2 05-11-2021 09:28:48

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19722
Website

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Try changing the processing method for the order to SagePage prior to sending the link to the order to the customer.  You have a mismatch there.  You really want this order to be a SagePage order prior to the customer paying for it.

In early versions of K9, you will have to edit the procgwresp() function in {private}/apps/ecom/ECOM_OLP/ECOM_OLP.php in order to remove the 30 minute time limit on processing relayed orders.  That check was removed in version 9.0.1 (I think).


Nick Hendler

Offline

 

#3 05-11-2021 12:19:37

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1679

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Thanks Nick

I have progressed through that issue by changing the $order[0]['paymethod'] to protxform in procgwresp().
This overcomes the gateway ID check and returns to a success page.

However, the Order confirmation page displays the Quote confirmation. The order status isn't updated to paid/pending shipment.

I assume this is later on in procgwresp() and I will need to force the status to be updated and mark the order as paid.

I will try changing the $gateway['postorder'] to 1 as the Quote gateway is obviously 0.

What is an "instant payment notification (IPN) type request" and $session_simulated??
Not sure if that is something I could use.


- Euorpacart 8

Offline

 

#4 05-12-2021 08:51:36

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19722
Website

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

You're changing the paymethod very late in the process if you're doing it using the procgwresp() function.  I assumed you would change the payment method in K9 using the management interface prior to sending the pay link to the customer.  What you're running into is when the order is loaded by orderlookup() a little later on in the code, the ecom_order.paymethod (stored in the database, not in the order array you've manipulated) is used to pull data from ecom_gateway to populate the 'gateway' key in the order array.

I assume you have:

Code:

$order[0]['paymethod'] = 'protxform';

What you need is:

Code:

$order[0]['paymethod'] = 'protxform';
$sql = 'UPDATE ecom_orders SET paymethod=' . $this->CORE_DB->quote('protxform') . ' WHERE id=' . $this->CORE_DB->quote($order[0]['id']);
$this->CORE_DB->sql_do(array('table' => 'ecom_orders', 'sql' => $sql));

If you do that prior to the orderlookup() call, when orderlookup() builds the order array, it will pull the right info into the gateway key.


Nick Hendler

Offline

 

#5 05-12-2021 09:04:35

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1679

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Got it. Change the order paymethod in the DB as well so the processing functions are run for the protxform payment gateway, thus overriding the Quote gateway processes which don't mark it as paid.

I didn't want to change the paymethod or anything until a successful payment had been made, hence the reason for the change in procgwresp() when the success url was hit.
This way we can send quotes and they will remain unpaid until the customer decides to make payment.


- Euorpacart 8

Offline

 

#6 05-13-2021 04:25:36

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1679

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Just to complete this for future reference, I used

Code:

 $sql = 'UPDATE ecom_orders SET paymethod=' . $this->CORE_DB->quote('protxform') . ', status=' . $this->CORE_DB->quote('P') . ' WHERE id=' . $this->CORE_DB->quote($order[0]['id']);

Needed to change the status to P once an authorised payment was returned in procgwresp().
Order is then marked as Pending Shipment and all order emails are sent correctly.

Thanks for your help as always Nick.


- Euorpacart 8

Offline

 

#7 05-13-2021 08:11:03

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19722
Website

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Nice.  I forgot the status would have been NS after the customer processed the quote - so good catch there.


Nick Hendler

Offline

 

#8 05-22-2021 03:13:18

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1679

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

Just checking and I think I know the answer, but....

Does CCP have any built in method to pay multiple orders in one transaction and then carry out the successful payment tasks?

CCP sends automated statements to account customers every month and they now have a link to pay outstanding balances which takes them direct to sagepay payment page.
Successful payment redirects back to website with payment accepted message.

It won't be difficult for the $gateway['fieldon'] to return multiple order numbers in order1|order2|order3 format and then loop through each order to process the payment.

Just checking there isn't anything built in to accomplish this already.


- Euorpacart 8

Offline

 

#9 05-24-2021 09:15:29

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19722
Website

Re: utilities/ecomrelay.php?PROTXtrans=999999&PROTXresp=OK Question

No, there is no built-in way to do that.  However, you can easily build a relay (add script to {public}/utilities) that relayed to a namespace (add namespace to core_namespaces and function to a file like {private}/apps/ecom/ECOM_OLP/ECOM_OLP.php) based on the current ecomrelay namespace that would handle the multiple order numbers and loop and would produce a proper confirm (probably the account order list or a listing of order summary links for orders just processed).


Nick Hendler

Offline

 

Board footer