This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
__internalEmitPaymentProcessingEvent not mapping shippingData property #8785
Labels
type: bug
The issue/PR concerns a confirmed bug.
Describe the bug
In versions of WC Blocks prior to 9.5.0, the response object returned from the
onPaymentProcessing
event could include a shippingData property like the following:In versions 9.5.0 and greater, a new property called
shippingAddress
was added. In function__internalEmitPaymentProcessingEvent
, there is code to handle the now deprecatedshippingData
property. The issue is, the deprecation code assumes theshippingData
object is flat and thus ignores the child propertyshippingData.address
. That means that when the validation functionisShippingAddress
is called, it returns false and the address object is not used to populate the checkout fields.To reproduce
Steps to reproduce the behavior:
Expected behavior
WC Blocks should handle the response object for integrations that follow the design from versions < 9.5.0.
Additional context
On line 84 of /assets/js/data/payment/thunks.ts, the
shippingData
property is created by destructuring theresponse.meta
object. However, this ignores that theshippingData
contains a child property likeshippingData.address
that has the actual address.On line 112 of /assets/js/data/payment/thunks.ts, if the variable
shippingDataFromResponse
exists, it overrides theshippingAddress
variable.On line 137 of /assets/js/data/payment/thunks.ts, if the shipping address is not valid, the
setShippingAddress
function is not called. TheshippingAddress
object will never be valid because the actual address object is nested within theshippingData
object.The text was updated successfully, but these errors were encountered: