mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
✨ Add new contact-preference property to context
This commit is contained in:
parent
62c1b93fe2
commit
f300e10afb
1 changed files with 28 additions and 0 deletions
|
@ -73,6 +73,12 @@ class ExperienceContext {
|
|||
*/
|
||||
private ?string $payment_method_preference = null;
|
||||
|
||||
/**
|
||||
* Controls the contact module, and when defined, the API response will
|
||||
* include additional details in the `purchase_units[].shipping` object.
|
||||
*/
|
||||
private ?string $contact_preference = null;
|
||||
|
||||
/**
|
||||
* Returns the return URL.
|
||||
*/
|
||||
|
@ -227,6 +233,28 @@ class ExperienceContext {
|
|||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact preference.
|
||||
*/
|
||||
public function contact_preference(): ?string {
|
||||
return $this->contact_preference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the contact preference.
|
||||
*
|
||||
* This preference is only available for the payment source 'paypal' and 'venmo'.
|
||||
* https://developer.paypal.com/docs/api/orders/v2/#definition-paypal_wallet_experience_context
|
||||
*
|
||||
* @param string|null $new_value The value to set.
|
||||
*/
|
||||
public function with_contact_preference( ?string $new_value ): ExperienceContext {
|
||||
$obj = clone $this;
|
||||
|
||||
$obj->contact_preference = $new_value;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object as array.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue