I currently have PayPal working fine via Payum in Symfony2 and am now trying to configure SecurePay (via Omnipay), however it does not even seem to be connecting to SecurePay and there is no documentation to support it, so I am very stuck.
In the logs there does not seem to be any external communication. In SecurePay there is no record of my payment.
Thank you very much in advance for any help,
Dan
Here's an example of the payment_order database record:
{"amount":45,"currency":"AUD","description":"Payment for #96","clientIp":"127.0.0.1","card":{},"_reference":null,"_status":"failed","_status_code":null,"_status_message":null}
Here is my configuration:
payum:
security:
token_storage:
XX\PaymentBundle\Entity\PaymentToken: { doctrine: orm }
storages:
XX\PaymentBundle\Entity\Order: { doctrine: orm }
contexts:
SecurePay_DirectPost:
omnipay:
type: 'SecurePay_DirectPost'
options:
merchantId: ABC0001
transactionPassword: abc123
testMode: true
And my capture Method:
/**
* @Route("/{id}/cardcapture", name = "card_payment_capture")
* @Template()
*/
public function captureSecurePayAction(Collection $collection) {
$paymentName = 'SecurePay_DirectPost';
$storage = $this->get('payum')->getStorage('XX\PaymentBundle\Entity\Order');
$order = $storage->createModel();
$paymentDetails['amount'] = 10;
$paymentDetails['card'] = new SensitiveValue(array(
'number' => $_POST['card-number'],
'cvv' => $_POST['cvv'],
'expiryMonth' => $_POST['exp-month'],
'expiryYear' => $_POST['exp-year'],
'firstName' => $_POST['card-name'],
'lastName' => '',
));
$order->setNumber($collection->getId());
$order->setCurrencyCode('AUD');
$order->setTotalAmount($collection->getAmount()."00");
$order->setDescription('Payment for #' . $collection->getId());
$order->setClientId($collection->getId());
$order->setClientEmail($collection->getEmail());
$storage->updateModel($order);
$captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
$paymentName,
$order,
'payment_complete'
);
return $this->redirect($captureToken->getTargetUrl());
}
And finally my complete action:
/**
* @Route("/complete", name = "payment_complete")
* @Template()
*/
public function completeAction()
{
$token = $this->get('payum.security.http_request_verifier')->verify($this->request);
$payment = $this->get('payum')->getPayment($token->getPaymentName());
$payment->execute($status = new GetHumanStatus($token));
$model = $status->getModel();
$id = explode("#", $model['description']);
$collection = $this->em->getRepository('XXCollectionBundle:Collection')->find($id[1]);
if ($status->isCaptured()) {
$collection->setStatus("PAID");
$collection->setAmountPaid($model['PAYMENTREQUEST_0_AMT']);
$collection->setIsActive(true);
} else if ($status->isPending()) {
$collection->setStatus("PAYMENT PENDING");
} else {
$collection->setStatus("PAYMENT FAILED");
}
$this->em->persist($collection);
$this->em->flush();
$this->sendReceiptEmail($collection, $status);
return array(
'status' => $status,
'collection' => $collection
);
}