Skip to content

Commit 29e6c2e

Browse files
committed
MAGETWO-60572: [GitHub] PayPal.js error on checkout downloadable product #7000
1 parent fa0ed96 commit 29e6c2e

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-1
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ define([
296296
getShippingAddress: function () {
297297
var address = quote.shippingAddress();
298298

299-
if (address.postcode === null) {
299+
if (_.isNull(address.postcode) || _.isUndefined(address.postcode)) {
300300

301301
return {};
302302
}

dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,21 @@
5050
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
5151
<constraint name="Magento\Sales\Test\Constraint\AssertCaptureInCommentsHistory" />
5252
</variation>
53+
<variation name="OnePageCheckoutWithBraintreePaypalTestVariation3" summary="Guest Checkout virtual quote with Braintree PayPal from Cart" ticketId="MAGETWO-41559">
54+
<data name="products/0" xsi:type="string">catalogProductVirtual::product_50_dollar</data>
55+
<data name="customer/dataset" xsi:type="string">default</data>
56+
<data name="checkoutMethod" xsi:type="string">guest</data>
57+
<data name="prices" xsi:type="array">
58+
<item name="grandTotal" xsi:type="string">50.00</item>
59+
</data>
60+
<data name="payment/method" xsi:type="string">braintree_paypal</data>
61+
<data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data>
62+
<data name="status" xsi:type="string">Processing</data>
63+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</data>
64+
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
65+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
66+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
67+
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
68+
</variation>
5369
</testCase>
5470
</config>

dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
namespace Magento\Braintree\Test\TestStep;
77

88
use Magento\Checkout\Test\Constraint\AssertGrandTotalOrderReview;
9+
use Magento\Checkout\Test\Constraint\AssertBillingAddressAbsentInPayment;
910
use Magento\Checkout\Test\Page\CheckoutOnepage;
1011
use Magento\Checkout\Test\Page\CheckoutOnepageSuccess;
1112
use Magento\Mtf\Fixture\FixtureFactory;
13+
use Magento\Customer\Test\Fixture\Customer;
1214
use Magento\Mtf\TestStep\TestStepInterface;
1315

1416
/**
@@ -26,6 +28,11 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
2628
*/
2729
private $assertGrandTotalOrderReview;
2830

31+
/**
32+
* @var AssertBillingAddressAbsentInPayment
33+
*/
34+
private $assertBillingAddressAbsentInPayment;
35+
2936
/**
3037
* @var CheckoutOnepageSuccess
3138
*/
@@ -46,26 +53,50 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
4653
*/
4754
private $products;
4855

56+
/**
57+
* Customer fixture.
58+
*
59+
* @var Customer
60+
*/
61+
protected $customer;
62+
63+
/**
64+
* Checkout method.
65+
*
66+
* @var string
67+
*/
68+
protected $checkoutMethod;
69+
4970
/**
5071
* @param CheckoutOnepage $checkoutOnepage
5172
* @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview
73+
* @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment
5274
* @param CheckoutOnepageSuccess $checkoutOnepageSuccess
5375
* @param FixtureFactory $fixtureFactory
76+
* @param Customer $customer
77+
* @param string $checkoutMethod
5478
* @param array $products
5579
* @param array $prices
5680
*/
5781
public function __construct(
5882
CheckoutOnepage $checkoutOnepage,
5983
AssertGrandTotalOrderReview $assertGrandTotalOrderReview,
84+
AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment,
6085
CheckoutOnepageSuccess $checkoutOnepageSuccess,
6186
FixtureFactory $fixtureFactory,
87+
Customer $customer = null,
88+
$checkoutMethod,
89+
6290
array $products,
6391
array $prices = []
6492
) {
6593
$this->checkoutOnepage = $checkoutOnepage;
6694
$this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview;
95+
$this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment;
6796
$this->checkoutOnepageSuccess = $checkoutOnepageSuccess;
6897
$this->fixtureFactory = $fixtureFactory;
98+
$this->customer = $customer;
99+
$this->checkoutMethod = $checkoutMethod;
69100
$this->products = $products;
70101
$this->prices = $prices;
71102
}
@@ -78,6 +109,13 @@ public function run()
78109
if (isset($this->prices['grandTotal'])) {
79110
$this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']);
80111
}
112+
113+
$this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage);
114+
115+
if ($this->checkoutMethod === 'guest') {
116+
$this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer);
117+
}
118+
81119
$parentWindow = $this->checkoutOnepage->getPaymentBlock()
82120
->getSelectedPaymentMethodBlock()
83121
->clickPayWithPaypal();

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ public function loginCustomer(FixtureInterface $customer)
9090
$this->waitForElementNotVisible($this->loadingMask);
9191
}
9292

93+
/**
94+
* Fill required fields for guest checkout.
95+
*
96+
* @param FixtureInterface $customer
97+
* @return void
98+
*/
99+
public function fillGuestFields(FixtureInterface $customer)
100+
{
101+
$mapping = $this->dataMapping();
102+
$this->_rootElement->find($mapping['email']['selector'], $mapping['email']['strategy'])->setValue($customer->getEmail());
103+
}
104+
93105
/**
94106
* Click continue on checkout method block.
95107
*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Checkout\Test\Constraint;
8+
9+
use Magento\Checkout\Test\Page\CheckoutOnepage;
10+
use Magento\Mtf\Constraint\AbstractConstraint;
11+
12+
/**
13+
* Class AssertBillingAddressAbsentInShoppingCart
14+
* Assert billing address is not present in selected payment method
15+
*/
16+
class AssertBillingAddressAbsentInPayment extends AbstractConstraint
17+
{
18+
/**
19+
* Assert billing address is not present in selected payment method
20+
*
21+
* @param CheckoutOnepage $checkoutOnepage,
22+
* @return void
23+
*/
24+
public function processAssert(CheckoutOnepage $checkoutOnepage)
25+
{
26+
\PHPUnit_Framework_Assert::assertFalse(
27+
$checkoutOnepage->getPaymentBlock()
28+
->getSelectedPaymentMethodBlock()
29+
->getBillingBlock()->isVisible(),
30+
'Billing address is present in payment method'
31+
);
32+
}
33+
34+
/**
35+
* Returns string representation of successful assertion
36+
*
37+
* @return string
38+
*/
39+
public function toString()
40+
{
41+
return 'Billing address is absent in payment method';
42+
}
43+
}

0 commit comments

Comments
 (0)