/** * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer * * @return void */ public function recalculate(QuoteTransfer $quoteTransfer) { $totalsTransfer = $this->createTotalsTransfer(); $totalsTransfer->setTaxTotal($this->createTaxTotalsTransfer()); $totalsTransfer->setDiscountTotal(0); $totalsTransfer->setExpenseTotal(0); $quoteTransfer->setTotals($totalsTransfer); }
/** * @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; }
/** * @return \Generated\Shared\Transfer\QuoteTransfer */ private function getCheckoutRequestTransfer() { $itemTransfer = new ItemTransfer(); $itemTransfer->setSku('1234567890')->setQuantity(1)->setUnitGrossPriceWithProductOptions(10000)->setName('Socken'); $billingAddressTransfer = new AddressTransfer(); $billingAddressTransfer->setIso2Code('DE')->setEmail('*****@*****.**')->setFirstName('John')->setLastName('Doe')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623')->setCity('Berlin'); $shippingAddressTransfer = new AddressTransfer(); $shippingAddressTransfer->setIso2Code('DE')->setEmail('*****@*****.**')->setFirstName('John')->setLastName('Doe')->setAddress1('Fraunhoferstraße')->setAddress2('120')->setZipCode('80469')->setCity('München'); $paymentAddressTransfer = (new AddressTransfer())->setFirstName('John')->setLastName('Doe')->setSalutation('Mr')->setEmail('*****@*****.**')->setCity('Berlin')->setIso2Code('DE')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623'); $payolutionPaymentTransfer = (new PayolutionPaymentTransfer())->setGender('Male')->setDateOfBirth('1970-01-01')->setClientIp('127.0.0.1')->setAccountBrand(PayolutionConstants::BRAND_INVOICE)->setAddress($paymentAddressTransfer); $quoteTransfer = new QuoteTransfer(); $totalsTransfer = new TotalsTransfer(); $totalsTransfer->setGrandTotal(10000)->setSubtotal(10000); $quoteTransfer->setTotals($totalsTransfer); $paymentTransfer = new PaymentTransfer(); $paymentTransfer->setPaymentSelection('no_payment'); $paymentTransfer->setPayolution($payolutionPaymentTransfer); $quoteTransfer->setPayment($paymentTransfer); $quoteTransfer->setShippingAddress($shippingAddressTransfer)->setBillingAddress($billingAddressTransfer); return $quoteTransfer; }
/** * @return \Generated\Shared\Transfer\QuoteTransfer */ protected function getBaseQuoteTransfer() { $quoteTransfer = new QuoteTransfer(); $country = new SpyCountry(); $country->setIso2Code('xi')->save(); $productAbstract1 = new SpyProductAbstract(); $productAbstract1->setSku('AOSB1337')->setAttributes('{}'); $productConcrete1 = new SpyProduct(); $productConcrete1->setSku('OSB1337')->setAttributes('{}')->setSpyProductAbstract($productAbstract1)->save(); $productAbstract2 = new SpyProductAbstract(); $productAbstract2->setSku('AOSB1338')->setAttributes('{}'); $productConcrete2 = new SpyProduct(); $productConcrete2->setSku('OSB1338')->setSpyProductAbstract($productAbstract2)->setAttributes('{}')->save(); $stock = new SpyStock(); $stock->setName('testStock'); $stock1 = new SpyStockProduct(); $stock1->setQuantity(1)->setStock($stock)->setSpyProduct($productConcrete1)->save(); $stock2 = new SpyStockProduct(); $stock2->setQuantity(1)->setStock($stock)->setSpyProduct($productConcrete2)->save(); $item1 = new ItemTransfer(); $item1->setSku('OSB1337')->setQuantity(1)->setUnitGrossPrice(3000)->setName('Product1'); $item2 = new ItemTransfer(); $item2->setSku('OSB1338')->setQuantity(1)->setUnitGrossPrice(4000)->setName('Product2'); $quoteTransfer->addItem($item1); $quoteTransfer->addItem($item2); $totals = new TotalsTransfer(); $totals->setGrandTotal(1000)->setSubtotal(500); $quoteTransfer->setTotals($totals); $billingAddress = new AddressTransfer(); $shippingAddress = new AddressTransfer(); $billingAddress->setIso2Code('xi')->setEmail('*****@*****.**')->setFirstName('Max')->setLastName('Mustermann')->setAddress1('Straße')->setAddress2('82')->setZipCode('12345')->setCity('Entenhausen'); $shippingAddress->setIso2Code('xi')->setFirstName('Max')->setLastName('Mustermann')->setEmail('*****@*****.**')->setAddress1('Straße')->setAddress2('84')->setZipCode('12346')->setCity('Entenhausen2'); $quoteTransfer->setBillingAddress($billingAddress); $quoteTransfer->setShippingAddress($shippingAddress); $customerTransfer = new CustomerTransfer(); $customerTransfer->setIsGuest(false)->setEmail('*****@*****.**'); $quoteTransfer->setCustomer($customerTransfer); $shipment = new ShipmentTransfer(); $shipment->setMethod(new ShipmentMethodTransfer()); $quoteTransfer->setShipment($shipment); $paymentTransfer = new PaymentTransfer(); $paymentTransfer->setPaymentSelection('no_payment'); $quoteTransfer->setPayment($paymentTransfer); return $quoteTransfer; }
/** * @return \Generated\Shared\Transfer\QuoteTransfer */ protected function getQuoteTransferWithFixtureData() { $quoteTransfer = new QuoteTransfer(); $quoteTransfer->setTotals(new TotalsTransfer()); return $quoteTransfer; }
/** * @return void */ public function testPreCheckPayment() { $this->markTestSkipped('Payolution request is too slow'); $this->setBaseTestData(); $totalsTransfer = new TotalsTransfer(); $totalsTransfer->setGrandTotal(10000); $quoteTransfer = new QuoteTransfer(); $quoteTransfer->setTotals($totalsTransfer); $addressTransfer = (new AddressTransfer())->setCity('Berlin')->setZipCode('10623')->setAddress1('Straße des 17. Juni 135')->setFirstName('John')->setLastName('Doe')->setSalutation('Mr')->setEmail('*****@*****.**')->setIso2Code('DE'); $payolutionPaymentTransfer = (new PayolutionPaymentTransfer())->setGender('Male')->setDateOfBirth('1970-01-01')->setClientIp('127.0.0.1')->setAccountBrand(ApiConstants::BRAND_INVOICE)->setAddress($addressTransfer)->setLanguageIso2Code('DE')->setCurrencyIso3Code('EUR'); $paymentTransfer = new PaymentTransfer(); $paymentTransfer->setPayolution($payolutionPaymentTransfer); $quoteTransfer->setPayment($paymentTransfer); $facade = $this->payolutionFacade; $response = $facade->preCheckPayment($quoteTransfer); $this->assertInstanceOf(PayolutionTransactionResponseTransfer::class, $response); }