mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 17:51:41 +08:00
avoid redundant exception throwing
This commit is contained in:
parent
1076c58002
commit
a83af94b88
1 changed files with 8 additions and 4 deletions
|
@ -245,12 +245,16 @@ class CreateOrderEndpoint implements EndpointInterface {
|
||||||
* Returns the PaymentMethod object for the order.
|
* Returns the PaymentMethod object for the order.
|
||||||
*
|
*
|
||||||
* @return PaymentMethod
|
* @return PaymentMethod
|
||||||
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException In case a setting would not be found.
|
|
||||||
*/
|
*/
|
||||||
private function payment_method() : PaymentMethod {
|
private function payment_method() : PaymentMethod {
|
||||||
$payee_preferred = $this->settings->has( 'payee_preferred' ) && $this->settings->get( 'payee_preferred' ) ?
|
try {
|
||||||
PaymentMethod::PAYEE_PREFERRED_IMMEDIATE_PAYMENT_REQUIRED
|
$payee_preferred = $this->settings->has( 'payee_preferred' ) && $this->settings->get( 'payee_preferred' ) ?
|
||||||
: PaymentMethod::PAYEE_PREFERRED_UNRESTRICTED;
|
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 );
|
$payment_method = new PaymentMethod( $payee_preferred );
|
||||||
return $payment_method;
|
return $payment_method;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue