Пример #1
0
 /**
  * @param \Generated\Shared\Transfer\PayolutionPaymentTransfer $paymentTransfer
  * @param int $idSalesOrder
  *
  * @return \Orm\Zed\Payolution\Persistence\SpyPaymentPayolution
  */
 protected function savePaymentForOrder(PayolutionPaymentTransfer $paymentTransfer, $idSalesOrder)
 {
     $paymentEntity = new SpyPaymentPayolution();
     $addressTransfer = $paymentTransfer->getAddress();
     $formattedStreet = trim(sprintf('%s %s %s', $addressTransfer->getAddress1(), $addressTransfer->getAddress2(), $addressTransfer->getAddress3()));
     $paymentEntity->fromArray($addressTransfer->toArray());
     $paymentEntity->fromArray($paymentTransfer->toArray());
     $paymentEntity->setStreet($formattedStreet)->setCountryIso2Code($addressTransfer->getIso2Code())->setFkSalesOrder($idSalesOrder);
     $paymentEntity->save();
     return $paymentEntity;
 }
Пример #2
0
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getQuoteTransfer()
 {
     $quoteTransfer = new QuoteTransfer();
     $totalsTransfer = new TotalsTransfer();
     $totalsTransfer->setGrandTotal(10000)->setSubtotal(10000);
     $quoteTransfer->setTotals($totalsTransfer);
     $addressTransfer = new AddressTransfer();
     $addressTransfer->setFirstName('John')->setLastName('Doe')->setSalutation('Mr')->setCity('Berlin')->setIso2Code('DE')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623');
     $quoteTransfer->setBillingAddress($addressTransfer);
     $paymentTransfer = new PayolutionPaymentTransfer();
     $paymentTransfer->setGender('Male')->setDateOfBirth('1970-01-01')->setClientIp('127.0.0.1')->setAccountBrand(ApiConstants::BRAND_INVOICE)->setAddress($addressTransfer);
     $payment = new PaymentTransfer();
     $payment->setPayolution($paymentTransfer);
     $quoteTransfer->setPayment($payment);
     return $quoteTransfer;
 }
 /**
  * Test the saveOrderPayment() method of PayolutionFacade
  *
  * @return void
  */
 public function testSaveOrderPayment()
 {
     $this->markTestSkipped('Payolution request is too slow');
     $this->setBaseTestData();
     $addressTransfer = (new AddressTransfer())->setCity('Berlin')->setZipCode('10623')->setAddress1('Straße des 17. Juni 135')->setFirstName('Jane')->setLastName('Doe')->setEmail('*****@*****.**')->setIso2Code('DE')->setSalutation(SpyCustomerTableMap::COL_SALUTATION_MR);
     $payolutionPaymentTransfer = new PayolutionPaymentTransfer();
     $payolutionPaymentTransfer->setAccountBrand(ApiConstants::BRAND_INVOICE)->setClientIp('127.0.0.1')->setDateOfBirth('1970-01-02')->setGender(SpyCustomerTableMap::COL_GENDER_MALE)->setAddress($addressTransfer)->setAccountBrand(ApiConstants::BRAND_INVOICE)->setLanguageIso2Code('DE')->setCurrencyIso3Code('EUR')->setEmail($addressTransfer->getEmail());
     // PayolutionCheckoutConnector-HydrateOrderPlugin emulation
     $quoteTransfer = new QuoteTransfer();
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPayolution($payolutionPaymentTransfer);
     $quoteTransfer->setPayment($paymentTransfer);
     $checkoutResponseTransfer = new CheckoutResponseTransfer();
     $saveOrderTransfer = new SaveOrderTransfer();
     $saveOrderTransfer->setIdSalesOrder($this->orderEntity->getIdSalesOrder());
     $checkoutResponseTransfer->setSaveOrder($saveOrderTransfer);
     $facade = $this->payolutionFacade;
     $facade->saveOrderPayment($quoteTransfer, $checkoutResponseTransfer);
     $paymentEntity = $this->orderEntity->getSpyPaymentPayolutions()->getFirst();
     $this->assertInstanceOf(SpyPaymentPayolution::class, $paymentEntity);
     $this->assertEquals(ApiConstants::BRAND_INVOICE, $paymentEntity->getAccountBrand());
     $this->assertEquals('127.0.0.1', $paymentEntity->getClientIp());
 }
Пример #4
0
 /**
  * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
  *
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getQuoteTransfer(CheckoutResponseTransfer $checkoutResponseTransfer)
 {
     $orderEntity = $this->createOrderEntity();
     $paymentAddressTransfer = new AddressTransfer();
     $email = '*****@*****.**';
     $paymentAddressTransfer->setIso2Code('DE')->setEmail($email)->setFirstName('John')->setLastName('Doe')->setCellPhone('+40 175 0815')->setPhone('+30 0815')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623')->setSalutation(SpyPaymentPayolutionTableMap::COL_SALUTATION_MR)->setCity('Berlin');
     $payolutionPaymentTransfer = new PayolutionPaymentTransfer();
     $payolutionPaymentTransfer->setEmail($email)->setGender(SpyPaymentPayolutionTableMap::COL_GENDER_MALE)->setDateOfBirth('1970-01-02')->setClientIp('127.0.0.1')->setAccountBrand(PayolutionConstants::BRAND_INVOICE)->setLanguageIso2Code('DE')->setCurrencyIso3Code('EUR')->setAddress($paymentAddressTransfer);
     $quoteTransfer = new QuoteTransfer();
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setEmail($email);
     $customerTransfer->setIsGuest(true);
     $quoteTransfer->setCustomer($customerTransfer);
     $checkoutResponseTransfer->getSaveOrder()->setIdSalesOrder($orderEntity->getIdSalesOrder());
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPayolution($payolutionPaymentTransfer);
     $quoteTransfer->setPayment($paymentTransfer);
     foreach ($orderEntity->getItems() as $orderItemEntity) {
         $itemTransfer = new ItemTransfer();
         $itemTransfer->setName($orderItemEntity->getName())->setQuantity($orderItemEntity->getQuantity())->setUnitGrossPrice($orderItemEntity->getGrossPrice())->setFkSalesOrder($orderItemEntity->getFkSalesOrder())->setIdSalesOrderItem($orderItemEntity->getIdSalesOrderItem());
         $checkoutResponseTransfer->getSaveOrder()->addOrderItem($itemTransfer);
     }
     return $quoteTransfer;
 }
Пример #5
0
 /**
  * @param \Generated\Shared\Transfer\PayolutionPaymentTransfer $payolutionPaymentTransfer
  *
  * @return void
  */
 protected function setPayolutionInstallmentPayment(PayolutionPaymentTransfer $payolutionPaymentTransfer)
 {
     if ($this->payolutionClient->hasInstallmentPaymentsInSession() === false) {
         return;
     }
     $payolutionCalculationResponseTransfer = $this->payolutionClient->getInstallmentPaymentsFromSession();
     $installmentPaymentDetail = $payolutionCalculationResponseTransfer->getPaymentDetails()[$payolutionPaymentTransfer->getInstallmentPaymentDetailIndex()];
     $payolutionPaymentTransfer->setInstallmentCalculationId($payolutionCalculationResponseTransfer->getIdentificationUniqueid())->setInstallmentAmount($installmentPaymentDetail->getInstallments()[0]->getAmount())->setInstallmentDuration($installmentPaymentDetail->getDuration());
 }