0

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
    );
}
Dan G
  • 1
  • what version of Payum do you use? – Maksim Kotlyar Feb 28 '15 at 20:27
  • Here are my dependencies: `"payum/payum-bundle": "0.12.0", "payum/offline": "*@stable", "payum/paypal-express-checkout-nvp": "~0.12", "omnipay/securepay": "~2.1", "payum/omnipay-bridge": "*@stable"` – Dan G Mar 01 '15 at 15:52
  • Ok, I will try the PaymentDetails object.. i am not getting any errors though with the current set up, just no comms with the gateway. Have you seen any good documentation anywhere? – Dan G Mar 01 '15 at 15:54
  • try to upgrade to 0.14 it is current stable, there maybe some bugs fixes in omnipay bridge. – Maksim Kotlyar Mar 01 '15 at 18:15
  • I've upgraded.. I don't think omnipay bridge is working with the new version 0.14.2. I can't find any documentation anywhere about implementation. This is very frustrating! – Dan G Mar 02 '15 at 19:28
  • Now the config isn't even valid... `payments: SecurePay_DirectPost: omnipay: xxx` with the error: `Unrecognized option "omnipay" under "payum.payments.SecurePay_DirectPost"` – Dan G Mar 02 '15 at 19:56
  • Try changing "contexts:" to "payments:" in your config - I believe it changed between versions – Geoff Mar 04 '15 at 04:28
  • you dont have to use order with this omnipay gateway, I dont think omnipay bridge supports Order model. You can use directly a payment details (an array). something like this https://github.com/Payum/Payum/tree/master/docs/symfony/custom-purchase-examples – Maksim Kotlyar Nov 20 '17 at 09:55

0 Answers0