Skip to content

Magento_Braintree/js/view/payment/method-renderer/paypal.js accessing undefined variables #24618

Closed
@speedupmate

Description

@speedupmate

Preconditions (*)

  1. Magento 2.2. * - 2.3.2

Steps to reproduce (*)

  1. initiate paypal payment method when shipping address object is not filled with data

Expected result (*)

  1. no js errors on frontend
  2. more checks on getShippingAddress method is needed to validate the address object before usage

currently only address.postcode is validated however when other fields are missing like street it expects data to be present while it can be missing

Actual result (*)

  1. its possible to end up in a state where console logs errors

Uncaught TypeError: Cannot read property '0' of undefined at UiClass.getShippingAddress (/pub/static/version1568411942/frontend/Magento/luma/en_US/Magento_Braintree/js/view/payment/method-renderer/paypal.js:305) at UiClass.getPayPalConfig (/pub/static/version1568411942/frontend/Magento/luma/en_US/Magento_Braintree/js/view/payment/method-renderer/paypal.js:268) at UiClass.initClientConfig (/pub/static/version1568411942/frontend/Magento/luma/en_US/Magento_Braintree/js/view/payment/method-renderer/paypal.js:167) at UiClass.initObservable (/pub/static/version1568411942/frontend/Magento/luma/en_US/Magento_Braintree/js/view/payment/method-renderer/paypal.js:114) at UiClass.initObservable (wrapper.js:109) at UiClass.initialize (element.js:104) at UiClass.initialize (wrapper.js:109) at UiClass._super (wrapper.js:106) at UiClass.initialize (default.js:62) at UiClass.initialize (wrapper.js:109) at UiClass._super (wrapper.js:106) at UiClass.extendingObj.initialize (default.js:21) at UiClass.initialize (wrapper.js:109) at new UiClass (class.js:49) at Object.initComponent (layout.js:137) at fire (jquery.js:3232)

Metadata

Metadata

Assignees

Labels

Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions