-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filtering billing details from order based on checkout fields (#8459)
Co-authored-by: Samir Merchant <[email protected]>
- Loading branch information
1 parent
024f00b
commit f284f74
Showing
4 changed files
with
65 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fix | ||
|
||
Fixed billing address error for subscription without some billing details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -504,6 +504,37 @@ public function test_update_payment_method_with_billing_details_from_order() { | |
$this->customer_service->update_payment_method_with_billing_details_from_order( 'pm_mock', $order ); | ||
} | ||
|
||
public function test_update_payment_method_with_billing_details_from_checkout_fields() { | ||
$fields = wc()->checkout()->checkout_fields; | ||
unset( $fields['billing']['billing_company'] ); | ||
unset( $fields['billing']['billing_country'] ); | ||
unset( $fields['billing']['billing_address_1'] ); | ||
unset( $fields['billing']['billing_address_2'] ); | ||
unset( $fields['billing']['billing_city'] ); | ||
unset( $fields['billing']['billing_state'] ); | ||
unset( $fields['billing']['billing_phone'] ); | ||
wc()->checkout()->checkout_fields = $fields; | ||
$this->mock_api_client | ||
->expects( $this->once() ) | ||
->method( 'update_payment_method' ) | ||
->with( | ||
'pm_mock', | ||
[ | ||
'billing_details' => [ | ||
'address' => [ | ||
'postal_code' => '12345', | ||
], | ||
'email' => '[email protected]', | ||
'name' => 'Jeroen Sormani', | ||
], | ||
] | ||
); | ||
|
||
$order = WC_Helper_Order::create_order(); | ||
|
||
$this->customer_service->update_payment_method_with_billing_details_from_order( 'pm_mock', $order ); | ||
} | ||
|
||
public function test_get_payment_methods_for_customer_not_throw_resource_missing_code_exception() { | ||
$this->mock_api_client->expects( $this->once() ) | ||
->method( 'get_payment_methods' ) | ||
|