diff --git a/app/code/Magento/Paypal/Model/Hostedpro/Request.php b/app/code/Magento/Paypal/Model/Hostedpro/Request.php index a937ca36166fa..ba009c1416e74 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro/Request.php +++ b/app/code/Magento/Paypal/Model/Hostedpro/Request.php @@ -181,8 +181,11 @@ protected function getAmountData(Order $order) */ private function getNonTaxableAmount(Order $order) { + // PayPal denied transaction with 0 amount + $subtotal = $order->getBaseSubtotal() ? : $order->getPayment()->getBaseAmountAuthorized(); + return [ - 'subtotal' => $this->formatPrice($order->getBaseSubtotal()), + 'subtotal' => $this->formatPrice($subtotal), 'total' => $this->formatPrice($order->getPayment()->getBaseAmountAuthorized()), 'tax' => $this->formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->formatPrice($order->getBaseShippingAmount()), @@ -198,6 +201,7 @@ private function getNonTaxableAmount(Order $order) private function getTaxableAmount(Order $order) { $amount = $this->formatPrice($order->getPayment()->getBaseAmountAuthorized()); + return [ 'amount' => $amount, 'subtotal' => $amount // subtotal always is required diff --git a/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php b/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php index 649ff3bb09df3..74b127803198e 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/Hostedpro/RequestTest.php @@ -248,6 +248,63 @@ public function testSetAmountWithoutTax($total, $subtotal, $tax, $shipping, $dis static::assertEquals($expectation, $this->_model->getData()); } + /** + * @covers \Magento\Paypal\Model\Hostedpro\Request::setAmount() + * @param $total + * @param $subtotal + * @param $tax + * @param $shipping + * @param $discount + * @dataProvider amountWithoutTaxZeroSubtotalDataProvider + */ + public function testSetAmountWithoutTaxZeroSubtotal($total, $subtotal, $tax, $shipping, $discount) + { + $expectation = [ + 'subtotal' => $total, + 'total' => $total, + 'tax' => $tax, + 'shipping' => $shipping, + 'discount' => abs($discount) + ]; + + static::assertFalse($this->taxData->priceIncludesTax()); + + $payment = $this->getMockBuilder(Payment::class) + ->disableOriginalConstructor() + ->getMock(); + + $order = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->getMock(); + + $payment->expects(static::exactly(2)) + ->method('getBaseAmountAuthorized') + ->willReturn($total); + + $order->expects(static::exactly(2)) + ->method('getPayment') + ->willReturn($payment); + + $order->expects(static::once()) + ->method('getBaseDiscountAmount') + ->willReturn($discount); + + $order->expects(static::once()) + ->method('getBaseTaxAmount') + ->willReturn($tax); + + $order->expects(static::once()) + ->method('getBaseShippingAmount') + ->willReturn($shipping); + + $order->expects(static::once()) + ->method('getBaseSubtotal') + ->willReturn($subtotal); + $this->_model->setAmount($order); + + static::assertEquals($expectation, $this->_model->getData()); + } + /** * @covers \Magento\Paypal\Model\Hostedpro\Request::setAmount() */ @@ -313,4 +370,11 @@ public function amountWithoutTaxDataProvider() ['total' => 5.00, 'subtotal' => 10.00, 'tax' => 0.00, 'shipping' => 20.00, 'discount' => -25.00], ]; } + + public function amountWithoutTaxZeroSubtotalDataProvider() + { + return [ + ['total' => 10.00, 'subtotal' => 0.00, 'tax' => 0.00, 'shipping' => 20.00, 'discount' => 0.00], + ]; + } } diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php similarity index 82% rename from dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.php rename to dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php index 7b109b8947ea4..2560f8adecff1 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.php +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Authorizenet\Test\Block\Authorizenet\Form; +namespace Magento\Authorizenet\Test\Block\Form; use Magento\Payment\Test\Block\Form\Cc as CreditCard; diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml similarity index 85% rename from dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.xml rename to dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml index 338d574835d67..a85c77c0323a4 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Authorizenet/Form/Cc.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Block/Form/Cc.xml @@ -8,9 +8,6 @@ payment - - select - select diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml new file mode 100644 index 0000000000000..e2fc8e7fc6278 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Fixture/CreditCardAuthorizenet.xml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml index 4cb7f35f6329c..b10acbef32bb4 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml @@ -8,43 +8,55 @@ - + payment 1 Yes 1 - + payment 1 PAYMENT_AUTHORIZENET_LOGIN - + payment 1 PAYMENT_AUTHORIZENET_TRANS_KEY - + + payment + 1 + + PAYMENT_AUTHORIZENET_TRANS_MD5 + + payment 1 No 0 - + payment 1 https://test.authorize.net/gateway/transact.dll - + + payment + 1 + + https://apitest.authorize.net/xml/v1/request.api + + payment 1 Yes 1 - + payment 1 Yes @@ -52,7 +64,7 @@ - + payment 1 No diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml index 8e2b942b48d1f..217d5725f50a5 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/CreditCard.xml @@ -6,12 +6,11 @@ */ --> - + - Visa - 4007000000027 + 4111111111111111 01 - January - 2016 + 2020 123 diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml index 545a21785129e..faed94ea167d3 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml @@ -16,16 +16,19 @@ Flat Rate Fixed - 156.81 + 145.98 - authorizenet - visa_default + credit_card_authorizenet + authorizenet_directpost + visa_authorizenet authorizenet - test_type:3rd_party_test + Processing + test_type:3rd_party_test_deprecated - + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php new file mode 100644 index 0000000000000..be7fada0f9b6c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.php @@ -0,0 +1,46 @@ + "#braintree-hosted-field-number", + "credit_card_exp_month" => "#braintree-hosted-field-expirationMonth", + "credit_card_exp_year" => "#braintree-hosted-field-expirationYear", + "cvv" => "#braintree-hosted-field-cvv", + ]; + + public function fill(FixtureInterface $fixture, SimpleElement $element = null) + { + $mapping = $this->dataMapping($fixture->getData()); + foreach ($this->braintreeForm as $field => $iframe) { + $this->browser->switchToFrame(new Locator($iframe)); + $element = $this->browser->find('body'); + $this->_fill([$mapping[$field]], $element); + $this->browser->switchToFrame(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml new file mode 100644 index 0000000000000..014b18608c7f2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Form/Cc.xml @@ -0,0 +1,23 @@ + + + + + + #credit-card-number + + + #expiration-month + + + #expiration-year + + + #cvv + + + \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml new file mode 100644 index 0000000000000..3b1732342ee17 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/CreditCardBraintree.xml @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/CheckoutOnepage.xml new file mode 100644 index 0000000000000..4b885217858a1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Page/CheckoutOnepage.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000..080906f33d860 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/ConfigData.xml @@ -0,0 +1,115 @@ + + + + + + + payment + 1 + + PAYMENT_BRAINTREETWO_MERCHANT_ID + + + payment + 1 + + PAYMENT_PAYMENT_BRAINTREETWO_PUBLIC_KEY + + + payment + 1 + + PAYMENT_BRAINTREETWO_PRIVATE_KEY + + + payment + 1 + Yes + PAYMENT_BRAINTREETWO_MERCHANT_ACCOUNT_ID + + + payment + 1 + Authorize + authorize + + + payment + 1 + Yes + 1 + + + payment + 1 + Yes + 1 + + + + + payment + 1 + Yes + 0 + + + + + payment + 1 + + PAYMENT_BRAINTREETWO_MERCHANT_ID + + + payment + 1 + + PAYMENT_PAYMENT_BRAINTREETWO_PUBLIC_KEY + + + payment + 1 + + PAYMENT_BRAINTREETWO_PRIVATE_KEY + + + payment + 1 + Yes + PAYMENT_BRAINTREETWO_MERCHANT_ACCOUNT_ID + + + payment + 1 + Authorize and Capture + authorize_capture + + + payment + 1 + Yes + 1 + + + payment + 1 + Yes + 1 + + + + + payment + 1 + Yes + 0 + + + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml new file mode 100644 index 0000000000000..855fc144880db --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/CreditCard.xml @@ -0,0 +1,17 @@ + + + + + + 4111111111111111 + 01 + 2020 + 123 + + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml new file mode 100644 index 0000000000000..69191edc4a164 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml @@ -0,0 +1,63 @@ + + + + + + Create order in Admin using Fixed shipping method and Braintree payment method + catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product + default + us_ca_ny_rule + US_address_1_without_email + No + Flat Rate + Fixed + + 145.98 + + braintreetwo + credit_card_braintree + visa_braintree + braintreetwo + Processing + Back, Cancel, Send Email, Hold, Invoice, Ship + test_type:3rd_party_test + + + + + + + + + Create order in Admin using Fixed shipping method and Braintree payment method + catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product + default + us_ca_ny_rule + US_address_1_without_email + No + Flat Rate + Fixed + + 145.98 + + braintreetwo + credit_card_braintree + visa_braintree + braintreetwo_sale + Processing + Back, Send Email, Hold, Ship + test_type:3rd_party_test + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000..da4ae5559fb2f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,57 @@ + + + + + + Create order using Fixed shipping method and Braintree payment method + catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product + default + us_ca_ny_rule + US_address_1 + guest + Flat Rate + Fixed + + 145.98 + + braintreetwo + credit_card_braintree + visa_braintree + braintreetwo + Processing + test_type:3rd_party_test + + + + + + + Create order using Fixed shipping method and Braintree payment method with Payment action = Authorize and Capture + catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product + default + us_ca_ny_rule + US_address_1 + guest + Flat Rate + Fixed + + 145.98 + + braintreetwo + credit_card_braintree + visa_braintree + braintreetwo_sale + Processing + test_type:3rd_party_test + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php index 744e5d27fad77..e101d911c0a84 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment.php @@ -7,6 +7,7 @@ namespace Magento\Checkout\Test\Block\Onepage; use Magento\Mtf\Block\Block; +use Magento\Mtf\Fixture\InjectableFixture; use Magento\Payment\Test\Fixture\CreditCard; /** @@ -75,11 +76,11 @@ class Payment extends Block * Select payment method. * * @param array $payment - * @param CreditCard|null $creditCard + * @param InjectableFixture|null $creditCard * @throws \Exception * @return void */ - public function selectPaymentMethod(array $payment, CreditCard $creditCard = null) + public function selectPaymentMethod(array $payment, InjectableFixture $creditCard = null) { $paymentSelector = sprintf($this->paymentMethodInput, $payment['method']); $paymentLabelSelector = sprintf($this->paymentMethodLabel, $payment['method']); @@ -99,9 +100,11 @@ public function selectPaymentMethod(array $payment, CreditCard $creditCard = nul $this->_rootElement->find($this->purchaseOrderNumber)->setValue($payment['po_number']); } if ($creditCard !== null) { + $class = explode('\\', get_class($creditCard)); + $module = $class[1]; /** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */ $formBlock = $this->blockFactory->create( - '\\Magento\\Payment\\Test\\Block\\Form\\Cc', + "\\Magento\\{$module}\\Test\\Block\\Form\\Cc", ['element' => $this->_rootElement->find('#payment_form_' . $payment['method'])] ); $formBlock->fill($creditCard); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php index 2cf070ac15b39..753528ba18503 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertGrandTotalOrderReview.php @@ -26,9 +26,9 @@ public function processAssert(CheckoutOnepage $checkoutOnepage, $grandTotal) $checkoutReviewGrandTotal = $checkoutOnepage->getReviewBlock()->getGrandTotal(); \PHPUnit_Framework_Assert::assertEquals( - $checkoutReviewGrandTotal, number_format($grandTotal, 2), - "Grand Total price: $checkoutReviewGrandTotal not equals with price from data set: " . $grandTotal + $checkoutReviewGrandTotal, + "Grand Total price: $checkoutReviewGrandTotal not equals with price from data set: $grandTotal" ); } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php index b0674973ad2ce..430bd516ac4bd 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectPaymentMethodStep.php @@ -7,6 +7,7 @@ namespace Magento\Checkout\Test\TestStep; use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; use Magento\Payment\Test\Fixture\CreditCard; @@ -41,16 +42,22 @@ class SelectPaymentMethodStep implements TestStepInterface * @constructor * @param CheckoutOnepage $checkoutOnepage * @param array $payment - * @param CreditCard|null $creditCard + * @param FixtureFactory $fixtureFactory + * @param string $creditCardClass + * @param array|CreditCard|null $creditCard */ public function __construct( CheckoutOnepage $checkoutOnepage, array $payment, - CreditCard $creditCard = null + FixtureFactory $fixtureFactory, + $creditCardClass = 'credit_card', + $creditCard = null ) { $this->checkoutOnepage = $checkoutOnepage; $this->payment = $payment; - $this->creditCard = $creditCard; + if (isset($creditCard['dataset'])) { + $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); + } } /** diff --git a/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml index 6c921d21a2e5c..a80267af0182c 100644 --- a/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml @@ -18,7 +18,7 @@ Express worldwide checkmo checkmo, dhl_eu, shipping_origin_CH, config_base_currency_ch - test_type:3rd_party_test + test_type:3rd_party_test_deprecated diff --git a/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml index 92b074830b9f7..50847d559c54d 100644 --- a/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml @@ -18,7 +18,7 @@ International Economy checkmo checkmo, fedex, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated @@ -35,7 +35,7 @@ Ground checkmo checkmo, fedex, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml index 338d574835d67..652e00245a450 100644 --- a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> - + payment diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.xml index 83dfe5e439a23..8e350da1f844f 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromProductPageTest.xml @@ -27,11 +27,11 @@ paypal_express paypal_express, freeshipping - test_type:3rd_party_test + test_type:3rd_party_test_deprecated - + diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.xml index f47a4c9635a1d..02837e1ecbbfa 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutFromShoppingCartTest.xml @@ -26,11 +26,11 @@ 156.81 payflowpro - test_type:3rd_party_test + test_type:3rd_party_test_deprecated - + diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.xml index 8677d2de93c2b..93be1975b7418 100644 --- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/ExpressCheckoutOnePageTest.xml @@ -28,11 +28,11 @@ paypal_express paypal_express - test_type:3rd_party_test + test_type:3rd_party_test_deprecated - + catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option, bundleProduct::fixed_100_dollar_with_required_options @@ -56,11 +56,11 @@ paypal_express payflowlink - test_type:3rd_party_test + test_type:3rd_party_test_deprecated - + catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option, bundleProduct::fixed_100_dollar_with_required_options @@ -84,11 +84,11 @@ paypal_express paypal_express - test_type:3rd_party_test + test_type:3rd_party_test_deprecated - + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php index 785a067481a57..7eeadf4916a32 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php @@ -9,6 +9,7 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Fixture\InjectableFixture; /** * Adminhtml sales order create block. @@ -309,13 +310,13 @@ public function selectShippingMethod(array $shippingMethod) * Select payment method. * * @param array $paymentCode - * @return void + * @param InjectableFixture|null $creditCard */ - public function selectPaymentMethod(array $paymentCode) + public function selectPaymentMethod(array $paymentCode, InjectableFixture $creditCard = null) { $this->getTemplateBlock()->waitLoader(); $this->_rootElement->find($this->orderMethodsSelector)->click(); - $this->getBillingMethodBlock()->selectPaymentMethod($paymentCode); + $this->getBillingMethodBlock()->selectPaymentMethod($paymentCode, $creditCard); $this->getTemplateBlock()->waitLoader(); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php index f50e510941e02..7b1aa4fec9672 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Billing/Method.php @@ -7,6 +7,7 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Create\Billing; use Magento\Mtf\Block\Block; +use Magento\Mtf\Fixture\InjectableFixture; /** * Adminhtml sales order create payment method block. @@ -28,7 +29,14 @@ class Method extends Block protected $purchaseOrderNumber = '#po_number'; /** - * Magento loader selctor. + * Payment form. + * + * @var string + */ + protected $paymentForm = '#payment_form_%s'; + + /** + * Magento loader selector. * * @var string */ @@ -38,17 +46,27 @@ class Method extends Block * Select payment method. * * @param array $paymentCode - * @return void + * @param InjectableFixture|null $creditCard */ - public function selectPaymentMethod(array $paymentCode) + public function selectPaymentMethod(array $paymentCode, InjectableFixture $creditCard = null) { $paymentInput = $this->_rootElement->find(sprintf($this->paymentMethod, $paymentCode['method'])); if ($paymentInput->isVisible()) { $paymentInput->click(); $this->waitForElementNotVisible($this->loader); } - if (isset($paymentCode['po_number']) && $paymentCode['po_number'] !== "-") { + if (isset($paymentCode['po_number'])) { $this->_rootElement->find($this->purchaseOrderNumber)->setValue($paymentCode['po_number']); } + if ($creditCard !== null) { + $class = explode('\\', get_class($creditCard)); + $module = $class[1]; + /** @var \Magento\Payment\Test\Block\Form\Cc $formBlock */ + $formBlock = $this->blockFactory->create( + "\\Magento\\{$module}\\Test\\Block\\Form\\Cc", + ['element' => $this->_rootElement->find('#payment_form_' . $paymentCode['method'])] + ); + $formBlock->fill($creditCard); + } } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php similarity index 83% rename from dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php rename to dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php index 2e88c267f38b0..2147cfcffb0b0 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistory.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php @@ -11,9 +11,9 @@ use Magento\Mtf\Constraint\AbstractConstraint; /** - * Assert that comment about authorized amount exist in Comments History section on order page in backend. + * Assert that comment about authorized amount exists in Comments History section on order page in Admin. */ -class AssertOrderCommentsHistory extends AbstractConstraint +class AssertAuthorizationInCommentsHistory extends AbstractConstraint { /** * Message about authorized amount in order. @@ -21,7 +21,7 @@ class AssertOrderCommentsHistory extends AbstractConstraint const AUTHORIZED_AMOUNT = 'Authorized amount of $'; /** - * Assert that comment about authorized amount exist in Comments History section on order page in backend. + * Assert that comment about authorized amount exist in Comments History section on order page in Admin. * * @param SalesOrderView $salesOrderView * @param OrderIndex $salesOrder diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php new file mode 100644 index 0000000000000..3c56ce05d439b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php @@ -0,0 +1,59 @@ +open(); + $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]); + + $actualCapturedAmount = $salesOrderView->getOrderHistoryBlock()->getCommentsHistory(); + + \PHPUnit_Framework_Assert::assertContains( + self::CAPTURED_AMOUNT . $prices['grandTotal'], + $actualCapturedAmount, + 'Incorrect captured amount value for the order #' . $orderId + ); + } + + /** + * Returns string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Message about captured amount is available in Comments History section."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php index b5329ca2860ac..dc6e4fa9c678c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php @@ -35,7 +35,7 @@ class CreateOrderBackendTest extends Scenario /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; - const TEST_TYPE = 'acceptance_test'; + const TEST_TYPE = 'acceptance_test, 3rd_party_test'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml index a073396e9136d..e89bc416d0354 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -7,143 +7,143 @@ --> - - Create order with simple product for registered US customer using Fixed shipping method and Cash on Delivery payment method - catalogProductSimple::default - default - US_address_1_without_email - No - Flat Rate - Fixed - - 565.00 - - cashondelivery - Pending - Back, Reorder, Cancel, Send Email, Hold, Invoice, Ship, Edit - cashondelivery - - - - - - - - Create order with virtual product for registered UK customer using Check/Money Order payment method - catalogProductVirtual::default - default - UK_address_without_email - false - - 10.00 - - checkmo - Pending - Back, Cancel, Send Email, Hold, Invoice, Edit - checkmo_specificcountry_gb - - - - - - - - Create order with simple product for registered US customer using Fixed shipping method and Bank Transfer payment method - catalogProductSimple::default - default - US_address_1_without_email - No - Flat Rate - Fixed - - 565.00 - - banktransfer - Pending - Back, Cancel, Send Email, Hold, Reorder, Invoice, Edit - banktransfer - - - - - - - - Create order with virtual product for registered UK customer using Bank Transfer payment method - catalogProductVirtual::default - default - UK_address_without_email - No - false - - 10.00 - - banktransfer - Pending - Back, Cancel, Send Email, Hold, Invoice, Edit - freeshipping_specificcountry_gb, banktransfer - - - - - - - - Create order with simple product for registered US customer using Fixed shipping method and Purchase Order payment method - catalogProductSimple::default - default - No - US_address_1_without_email - Flat Rate - Fixed - - 565.00 - - purchaseorder - 123456 - Pending - Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit - purchaseorder - - - - - - - - catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option - us_ca_ny_rule - default - No - login - US_address_1_without_email - Flat Rate - Fixed - - 21.91 - - checkmo - test_type:acceptance_test - - - - - test_type:acceptance_test - catalogProductSimple::simple_10_dollar, configurableProduct::with_one_option - us_ca_ny_rule - default - Yes - register - US_address_1_without_email - Flat Rate - Fixed - - 21.91 - - checkmo - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php index 73b774cb7c3d7..299f6ba7cdd6f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SelectPaymentMethodForOrderStep.php @@ -6,38 +6,57 @@ namespace Magento\Sales\Test\TestStep; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex; use Magento\Mtf\TestStep\TestStepInterface; +use Magento\Payment\Test\Fixture\CreditCard; /** - * Class SelectPaymentMethodForOrderStep - * Fill Payment Data Step + * Fill Payment Data Step. */ class SelectPaymentMethodForOrderStep implements TestStepInterface { /** - * Sales order create index page + * Sales order create index page. * * @var OrderCreateIndex */ protected $orderCreateIndex; /** - * Payment + * Payment information. * * @var array */ protected $payment; + /** + * Credit card information. + * + * @var CreditCard + */ + private $creditCard; + /** * @constructor * @param OrderCreateIndex $orderCreateIndex * @param array $payment + * @param FixtureFactory $fixtureFactory + * @param string $creditCardClass + * @param array|CreditCard|null $creditCard */ - public function __construct(OrderCreateIndex $orderCreateIndex, array $payment) - { + public function __construct( + OrderCreateIndex $orderCreateIndex, + array $payment, + FixtureFactory $fixtureFactory, + $creditCardClass = 'credit_card', + array $creditCard = null + ) { $this->orderCreateIndex = $orderCreateIndex; $this->payment = $payment; + if (isset($creditCard['dataset'])) { + $this->creditCard = $fixtureFactory->createByCode($creditCardClass, ['dataset' => $creditCard['dataset']]); + } } /** @@ -47,6 +66,6 @@ public function __construct(OrderCreateIndex $orderCreateIndex, array $payment) */ public function run() { - $this->orderCreateIndex->getCreateBlock()->selectPaymentMethod($this->payment); + $this->orderCreateIndex->getCreateBlock()->selectPaymentMethod($this->payment, $this->creditCard); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml index 502ef8488167a..ab0ab474de1e3 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/di.xml @@ -26,7 +26,12 @@ high - + + + high + + + high diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index a8e5340050134..6c5b7cdd1b66a 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -28,9 +28,9 @@ - - - + + + diff --git a/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml index 31a1bc9a90a1e..ed85963cb4e9e 100644 --- a/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml @@ -17,7 +17,7 @@ UPS Ground checkmo checkmo, ups, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated @@ -34,7 +34,7 @@ UPS Worldwide Expedited checkmo checkmo, ups, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated diff --git a/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml index e89cd863ae4aa..637888ec041ed 100644 --- a/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml @@ -17,7 +17,7 @@ Priority Mail 1-Day checkmo checkmo, usps, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated @@ -34,7 +34,7 @@ Priority Mail International checkmo checkmo, usps, shipping_origin_US_CA - test_type:3rd_party_test + test_type:3rd_party_test_deprecated