I tried a couple of things with no luck. Among them are;
1. Returning false in gateway::createRedirectionUrl() - this redirects me to the front page.
2. Returning the full URL to shop/checkout - this brings me to the page which reloads three times waiting for a response.
2. Keeping the full URL to shop/checkout and running the approve() method on the payment object created in gateway::createPaymentObject() before returning it. This seems to have the same effect as the previous solution.
The [gatewayname]gateway.php can be consider a workflow and you need to return workflow prefefined returns e.g. EZ_WORKFLOW_TYPE_STATUS_ACCEPTED, EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT
So I'd think your code in [gatewayname]gateway.php would look something like
...
function execute( &$process, $event )
{
if [shop account handler says no gateway]
return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
else
// Do your payment gateway here
}
...
Thanks for the tip, Bruce However, the coded I used as a basis (the PayPal gateway) does not contain the execute() method. Should I just include it? And if so, what should be the status if the gateway should be run?
Have had a look at the PayPal gateway and it extends the eZRedirectGateway class which does have the execute method. So assuming that your [gatewayname]gateway.php does the same thing you can copy the execute method from eZRedirectGateway to your gateway and wrap the exiting code in your check from the account handler.
In the example from my previous post the body of the eZRedirectGateway::excute would replace the "// Do your payment gateway here" bit.
Maybe not the most elegant solution but the because the excute method is whats called from the core checkout system it's the only way I can see for this to work without changing the core eZ code.
Thanks for helping out! Here's what I did specifically, for anyone else who might be interested.
1. Copied the entire execute() method from the eZRedirectGateway class and into my gateway class. 2. Inserted the following code near the top of the execute() method, after:
// get order id
$orderID = $processParameters['order_id'];
// get order
$order =& eZOrder::fetch( $orderID );
// get account information
$accountInfo = $order->accountInformation();
// fetch payment method from account info
$paymentMethod = $accountInfo['payment_method']
// if the user has not selected credit card as payment type
if($paymentMethod != 'credit_card')
{
// do not run payment gateway
return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
}
Very interesting.
Thank you Eirik for Only a question: where you set the 'credit_card' value when you seach it in the code?
// fetch payment method from account info
$paymentMethod = $accountInfo['payment_method']
// if the user has not selected credit card as payment type
if($paymentMethod != 'CREDIT_CARD')
So...
you add a, for example, select form inside the userregister form, and then pass the selection in a POST/GET way? I thinked it wasn't possible to make this kind of passages...