0

私は現在、Symfony2 の Payum 経由で PayPal を正常に動作させており、(Omnipay 経由で) SecurePay を構成しようとしていますが、SecurePay に接続しているようにも見えず、それをサポートするドキュメントがないため、非常に行き詰まっています。

ログには、外部通信はないようです。SecurePay には支払いの記録がありません。

どうぞよろしくお願いいたします。

ダン

payment_order データベース レコードの例を次に示します。

{"amount":45,"currency":"AUD","description":"Payment for #96","clientIp":"127.0.0.1","card":{},"_reference":null,"_status":"failed","_status_code":null,"_status_message":null}

これが私の構成です:

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

そして私のキャプチャ方法:

 /**
 * @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());
}

そして最後に私の完全な行動:

  /**
 * @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
    );
}
4

0 に答える 0