Beispiel #1
0
 /**
  * Import direct payment results to payment
  *
  * @param \Magento\Paypal\Model\Api\Nvp $api
  * @param Payment $payment
  * @return void
  */
 protected function _importResultToPayment($api, $payment)
 {
     $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0);
     $this->_pro->importPaymentInfo($api, $payment);
 }
Beispiel #2
0
 /**
  * Place an order with authorization or capture action
  *
  * @param Payment $payment
  * @param float $amount
  * @return $this
  */
 protected function _placeOrder(Payment $payment, $amount)
 {
     $order = $payment->getOrder();
     /** @var \Magento\Paypal\Model\Billing\Agreement $billingAgreement */
     $billingAgreement = $this->_agreementFactory->create()->load($payment->getAdditionalInformation(\Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID));
     $cart = $this->_cartFactory->create(array('salesModel' => $order));
     $proConfig = $this->_pro->getConfig();
     $api = $this->_pro->getApi()->setReferenceId($billingAgreement->getReferenceId())->setPaymentAction($proConfig->getConfigValue('paymentAction'))->setAmount($amount)->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())->setNotifyUrl($this->_urlBuilder->getUrl('paypal/ipn/'))->setPaypalCart($cart)->setIsLineItemsEnabled($proConfig->getConfigValue('lineItemsEnabled'))->setInvNum($order->getIncrementId());
     // call api and import transaction and other payment information
     $api->callDoReferenceTransaction();
     $this->_pro->importPaymentInfo($api, $payment);
     $api->callGetTransactionDetails();
     $this->_pro->importPaymentInfo($api, $payment);
     $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0);
     if ($api->getBillingAgreementId()) {
         $order->addRelatedObject($billingAgreement);
         $billingAgreement->setIsObjectChanged(true);
         $billingAgreement->addOrderRelation($order);
     }
     return $this;
 }
Beispiel #3
0
 /**
  * Import payment info to payment
  *
  * @param Nvp $api
  * @param Payment $payment
  * @return void
  */
 protected function _importToPayment($api, $payment)
 {
     $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)->setAdditionalInformation(ExpressCheckout::PAYMENT_INFO_TRANSPORT_REDIRECT, $api->getRedirectRequired());
     if ($api->getBillingAgreementId()) {
         $payment->setBillingAgreementData(['billing_agreement_id' => $api->getBillingAgreementId(), 'method_code' => \Magento\Paypal\Model\Config::METHOD_BILLING_AGREEMENT]);
     }
     $this->_pro->importPaymentInfo($api, $payment);
 }