Problem
I am successfully posting to a remote payment website, but at the same time I need to save details of the order into the database
Form
This is the form that submits the data, most of which is stored in the configuration.
echo $this->Form->create(null, array('url' => Configure::read('Payment.strPurchaseURL'))); ?>
echo $this->Form->hidden('navigate', array(
'name' => 'navigate',
'value' => ''
));
echo $this->Form->hidden('VPSProtocol', array(
'name' => 'VPSProtocol',
'value' => Configure::read('Payment.strProtocol')
));
echo $this->Form->hidden('TxType', array(
'name' => 'TxType',
'value' => Configure::read('Payment.strTransactionType')
));
echo $this->Form->hidden('Vendor', array(
'name' => 'Vendor',
'value' => Configure::read('Payment.strVendorName')
));
echo $this->Form->hidden('Crypt', array(
'name' => 'Crypt',
'value' => $encrypted
));
echo $this->Form->end(__('Proceed to payment'));
Controller
The rest of the controller for the view does its job correctly, but this if statement never gets called, because the action of the post takes it away from the controller. $post_data
is data from the session, generated by a previous form.
if ($this->request->is('post')) {
$this->Order->create();
if ($this->Order->save($post_data)) {
...
Logic is flawed
I know my logic is flawed, but from my research you can't post from the controller, so I either end up with a working save button or a working remote post.
I need to do both, but I haven't stumbled upon a good way yet, hopefully one of you fine people can set me straight.
Many thanks.