Пример #1
0
 /**
  * Make a payment
  *
  * @param Payment $payment
  *
  * @return MakePaymentResponse
  * @throws ApiException
  */
 public function makePayment(Payment $payment)
 {
     $service = new MakePayment();
     $customerInfo = $payment->getAccountLookup()->getCustomerInfos()[0];
     $customerInfo->setCustomAttributes([]);
     $customerInfo->setPhoneNumbers([]);
     $customerInfo->setProductInfos([]);
     $customerInfo->setLastPaymentMade(0);
     $service->setCustomerInfo($customerInfo);
     $service->setProviderId($payment->getAccountLookup()->getProviderId());
     $service->setPaymentMethod(0);
     $paymentInput = new PaymentInput();
     $paymentInput->setProductId($payment->getProductInfo()->getProductId());
     $paymentInput->setInputs($payment->getInputs());
     $service->setPaymentInputs([$paymentInput]);
     $productPayment = new ProductPayment();
     $productPayment->setProductId($paymentInput->getProductId());
     $productPayment->setFee($payment->getFee());
     $productPayment->setPaymentAmount($payment->getAmount());
     $productPayment->setPOSTransactionId($payment->getCorrelationId());
     $productPayment->setSalesTax(null);
     $service->setProductPayments([$productPayment]);
     /** @var MakePaymentResponse $response */
     return $this->process($service);
 }