/**
  * @return void
  */
 public function testAddPaymentToQuoteShouldReturnQuoteTransfer()
 {
     $paymentHandler = new PayolutionHandler($this->getPayolutionClientMock(), CurrencyManager::getInstance());
     $request = Request::createFromGlobals();
     $quoteTransfer = new QuoteTransfer();
     $billingAddress = new AddressTransfer();
     $billingAddress->setSalutation('Mr');
     $billingAddress->setIso2Code('iso2Code');
     $quoteTransfer->setBillingAddress($billingAddress);
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setEmail('*****@*****.**');
     $quoteTransfer->setCustomer($customerTransfer);
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('payolutionInvoice');
     $payolutionPaymentTransfer = new PayolutionPaymentTransfer();
     $paymentTransfer->setPayolutionInvoice($payolutionPaymentTransfer);
     $quoteTransfer->setPayment($paymentTransfer);
     $result = $paymentHandler->addPaymentToQuote($request, $quoteTransfer);
     $this->assertInstanceOf(QuoteTransfer::class, $result);
 }
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getValidBaseQuoteTransfer()
 {
     $country = new SpyCountry();
     $country->setIso2Code('ix');
     $country->save();
     $quoteTransfer = new QuoteTransfer();
     $billingAddress = new AddressTransfer();
     $billingAddress->setIso2Code('ix')->setAddress1('address-1-1-test')->setFirstName('Max')->setLastName('Mustermann')->setZipCode('1337')->setCity('SpryHome');
     $shippingAddress = new AddressTransfer();
     $shippingAddress->setIso2Code('ix')->setAddress1('address-1-2-test')->setFirstName('Max')->setLastName('Mustermann')->setZipCode('1337')->setCity('SpryHome');
     $totals = new TotalsTransfer();
     $totals->setGrandTotal(1337)->setSubtotal(337);
     $quoteTransfer->setShippingAddress($shippingAddress)->setBillingAddress($billingAddress)->setTotals($totals);
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setEmail('*****@*****.**');
     $customerTransfer->setFirstName('Max');
     $customerTransfer->setLastName('Mustermann');
     $quoteTransfer->setCustomer($customerTransfer);
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentTransfer->setMethod(new ShipmentMethodTransfer());
     $quoteTransfer->setShipment($shipmentTransfer);
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setUnitGrossPrice(1)->setQuantity(1)->setName('test-name')->setSku('sku-test');
     $quoteTransfer->addItem($itemTransfer);
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('dummyPaymentInvoice');
     $quoteTransfer->setPayment($paymentTransfer);
     return $quoteTransfer;
 }
示例#3
0
 /**
  * @return void
  */
 public function testRestorePasswordNonExistent()
 {
     $customerTransfer = new CustomerTransfer();
     $customerTransfer->setEmail(self::TESTER_NON_EXISTING_EMAIL);
     $customerResponseTransfer = $this->customerFacade->sendPasswordRestoreMail($customerTransfer);
     $this->assertTrue($customerResponseTransfer->getIsSuccess());
 }
示例#4
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
  *
  * @return void
  */
 protected function hydrateCustomerTransfer(QuoteTransfer $quoteTransfer, CustomerTransfer $customerTransfer)
 {
     $customerTransfer->setFirstName($quoteTransfer->getBillingAddress()->getFirstName());
     $customerTransfer->setLastName($quoteTransfer->getBillingAddress()->getLastName());
     if ($customerTransfer->getEmail() === null) {
         $customerTransfer->setEmail($quoteTransfer->getBillingAddress()->getEmail());
     }
 }
示例#5
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;
 }