/** * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer * * @throws \Spryker\Zed\Sales\Business\Exception\InvalidSalesOrderException * * @return \Orm\Zed\Sales\Persistence\SpySalesOrder */ protected function getOrderEntity(OrderTransfer $orderTransfer) { $orderTransfer->requireIdSalesOrder()->requireFkCustomer(); $orderEntity = $this->queryContainer->querySalesOrderDetails($orderTransfer->getIdSalesOrder())->filterByFkCustomer($orderTransfer->getFkCustomer())->findOne(); if ($orderEntity === null) { throw new InvalidSalesOrderException(sprintf('Order could not be found for ID %s and customer ID %s', $orderTransfer->getIdSalesOrder(), $orderTransfer->getFkCustomer())); } return $orderEntity; }
/** * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer * @param string $paymentCode * @param string $expectedStatusReasonCode * * @return bool */ private function hasTransactionLogStatus(OrderTransfer $orderTransfer, $paymentCode, $expectedStatusReasonCode) { $idSalesOrder = $orderTransfer->getIdSalesOrder(); $logEntity = $this->queryContainer->queryTransactionStatusLogBySalesOrderIdAndPaymentCodeLatestFirst($idSalesOrder, $paymentCode)->findOne(); if (!$logEntity) { return false; } $expectedProcessingCode = $paymentCode . '.' . $expectedStatusReasonCode; return $expectedProcessingCode === $logEntity->getProcessingCode(); }
/** * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer * * @return \Generated\Shared\Transfer\PayonePaymentTransfer */ protected function getPayment(OrderTransfer $orderTransfer) { $payment = $this->queryContainer->getPaymentByOrderId($orderTransfer->getIdSalesOrder())->findOne(); $paymentDetail = $payment->getSpyPaymentPayoneDetail(); $paymentDetailTransfer = new PaymentDetailTransfer(); $paymentDetailTransfer->fromArray($paymentDetail->toArray(), true); $paymentTransfer = new PayonePaymentTransfer(); $paymentTransfer->fromArray($payment->toArray(), true); $paymentTransfer->setPaymentDetail($paymentDetailTransfer); return $paymentTransfer; }
/** * @param \Generated\Shared\Transfer\OrderTransfer $order * * @return \Generated\Shared\Transfer\RefundTransfer */ protected function createRefundTransfer(OrderTransfer $order) { $refund = new RefundTransfer(); $refund->setFkSalesOrder($order->getIdSalesOrder()); return $refund; }
/** * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer * @param \Orm\Zed\Payolution\Persistence\SpyPaymentPayolution $paymentEntity * @param string $paymentCode * @param string $uniqueId * * @return array */ protected function getBaseTransactionRequestForPayment(OrderTransfer $orderTransfer, SpyPaymentPayolution $paymentEntity, $paymentCode, $uniqueId) { $requestData = $this->getBaseTransactionRequest($orderTransfer->getTotals()->getGrandTotal(), $paymentEntity->getCurrencyIso3Code(), $orderTransfer->getIdSalesOrder()); $this->addRequestData($requestData, [ApiConstants::TRANSACTION_CHANNEL => $this->getTransactionChannel(), ApiConstants::PAYMENT_CODE => $paymentCode, ApiConstants::IDENTIFICATION_REFERENCEID => $uniqueId]); return $requestData; }
/** * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer * * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayone */ protected function findPaymentByOrder(OrderTransfer $orderTransfer) { return $this->queryContainer->getPaymentByOrderId($orderTransfer->getIdSalesOrder())->findOne(); }