mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #1489 from woocommerce/PCP-585-instant-payments
Send payee_preferred correctly for instant payments
This commit is contained in:
commit
5361d4b3b2
6 changed files with 42 additions and 144 deletions
|
@ -19,7 +19,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Payer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentMethod;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
@ -32,7 +31,6 @@ use WooCommerce\PayPalCommerce\Button\Helper\EarlyOrderHandler;
|
|||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\Subscription\FreeTrialHandlerTrait;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\CardBillingMode;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
|
@ -463,7 +461,6 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
$shipping_preference,
|
||||
$payer,
|
||||
null,
|
||||
$this->payment_method(),
|
||||
'',
|
||||
$action
|
||||
);
|
||||
|
@ -486,8 +483,7 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
array( $this->purchase_unit ),
|
||||
$shipping_preference,
|
||||
$payer,
|
||||
null,
|
||||
$this->payment_method()
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -549,24 +545,6 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
$this->api_endpoint->with_bn_code( $bn_code );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PaymentMethod object for the order.
|
||||
*
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
private function payment_method() : PaymentMethod {
|
||||
try {
|
||||
$payee_preferred = $this->settings->has( 'payee_preferred' ) && $this->settings->get( 'payee_preferred' ) ?
|
||||
PaymentMethod::PAYEE_PREFERRED_IMMEDIATE_PAYMENT_REQUIRED
|
||||
: PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED;
|
||||
} catch ( NotFoundException $exception ) {
|
||||
$payee_preferred = PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED;
|
||||
}
|
||||
|
||||
$payment_method = new PaymentMethod( $payee_preferred );
|
||||
return $payment_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the form fields are valid.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue