public function execute(\Magento\Framework\Event\Observer $observer)
 {
     /** @var \Magento\Sales\Model\Order $order */
     $payment = $observer->getData(self::DATA_PAYMENT);
     assert($payment instanceof \Magento\Sales\Model\Order\Payment);
     $order = $payment->getOrder();
     $quoteId = $order->getQuoteId();
     $regQuote = $this->_repoPartialQuote->getById($quoteId);
     if ($regQuote) {
         $orderId = $order->getId();
         $customerId = $order->getCustomerId();
         $amount = $regQuote->getBasePartialAmount();
         $req = new \Praxigento\Wallet\Service\Operation\Request\PayForSaleOrder();
         $req->setOrderId($orderId);
         $req->setCustomerId($customerId);
         $req->setBaseAmountToPay($amount);
         $this->_callOperation->payForSaleOrder($req);
     }
 }
Ejemplo n.º 2
0
 public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
 {
     parent::capture($payment, $amount);
     /* collect data */
     assert($payment instanceof \Magento\Sales\Model\Order\Payment);
     /** @var \Magento\Sales\Model\Order $order */
     $order = $payment->getOrder();
     $orderId = $order->getId();
     $customerId = $order->getCustomerId();
     /* perform payment */
     $req = new \Praxigento\Wallet\Service\Operation\Request\PayForSaleOrder();
     $req->setCustomerId($customerId);
     $req->setOrderId($orderId);
     $req->setBaseAmountToPay($amount);
     $resp = $this->callOperation->payForSaleOrder($req);
     /* TODO: add transaction ID to payment */
     $operId = $resp->getOperationId();
     $payment->setTransactionId($operId);
     return $this;
 }