mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Fix phpunit
This commit is contained in:
parent
687b56d8c0
commit
056cb9fcc2
5 changed files with 81 additions and 25 deletions
|
@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\ApiClient;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\UserIdToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentMethodTokensEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokensEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\CardAuthenticationResult;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\FailureRegistry;
|
||||
use WooCommerce\PayPalCommerce\Common\Pattern\SingletonDecorator;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingSubscriptions;
|
||||
|
@ -448,6 +449,9 @@ return array(
|
|||
$container->get( 'api.factory.payment-preferences' )
|
||||
);
|
||||
},
|
||||
'api.factory.card-authentication-result' => static function( ContainerInterface $container ): CardAuthenticationResult {
|
||||
return new CardAuthenticationResult();
|
||||
},
|
||||
'api.helpers.dccapplies' => static function ( ContainerInterface $container ) : DccApplies {
|
||||
return new DccApplies(
|
||||
$container->get( 'api.dcc-supported-country-currency-matrix' ),
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* The card authentication result factory.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\ApiClient\Factory
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\ApiClient\Factory;
|
||||
|
||||
use stdClass;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\CardAuthenticationResult;
|
||||
|
||||
/**
|
||||
* Class CardAuthenticationResultFactory
|
||||
*/
|
||||
class CardAuthenticationResultFactory {
|
||||
|
||||
/**
|
||||
* Returns a card authentication result from the given response object.
|
||||
*
|
||||
* @param stdClass $authentication_result The authentication result object.
|
||||
* @return CardAuthenticationResult
|
||||
*/
|
||||
public function from_paypal_response( stdClass $authentication_result ): CardAuthenticationResult {
|
||||
return new CardAuthenticationResult(
|
||||
$authentication_result->liability_shift ?? '',
|
||||
$authentication_result->three_d_secure->enrollment_status ?? '',
|
||||
$authentication_result->three_d_secure->authentication_status ?? ''
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue