diff --git a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php index b7624d2de..2a5f321bc 100644 --- a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php @@ -160,7 +160,7 @@ class PartnersEndpoint { $this->failure_registry->clear_failures( FailureRegistry::SELLER_STATUS_KEY ); - $status = $this->seller_status_factory->from_paypal_reponse( $json ); + $status = $this->seller_status_factory->from_paypal_response( $json ); return $status; } } diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index 5b972efc7..0fb18aa0a 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -28,15 +28,23 @@ class SellerStatus { */ private $capabilities; + /** + * Merchant country on PayPal. + * + * @var string + */ + private $country; + /** * SellerStatus constructor. * * @param SellerStatusProduct[] $products The products. * @param SellerStatusCapability[] $capabilities The capabilities. + * @param string $country Merchant country on PayPal. * * @psalm-suppress RedundantConditionGivenDocblockType */ - public function __construct( array $products, array $capabilities ) { + public function __construct( array $products, array $capabilities, string $country = '' ) { foreach ( $products as $key => $product ) { if ( is_a( $product, SellerStatusProduct::class ) ) { continue; @@ -52,6 +60,7 @@ class SellerStatus { $this->products = $products; $this->capabilities = $capabilities; + $this->country = $country; } /** @@ -95,6 +104,7 @@ class SellerStatus { return array( 'products' => $products, 'capabilities' => $capabilities, + 'country' => $this->country, ); } } diff --git a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php index 9f1ff31f4..4182b5815 100644 --- a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php +++ b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php @@ -25,7 +25,7 @@ class SellerStatusFactory { * * @return SellerStatus */ - public function from_paypal_reponse( \stdClass $json ) : SellerStatus { + public function from_paypal_response( \stdClass $json ) : SellerStatus { $products = array_map( function( $json ) : SellerStatusProduct { $product = new SellerStatusProduct( @@ -49,6 +49,6 @@ class SellerStatusFactory { isset( $json->capabilities ) ? (array) $json->capabilities : array() ); - return new SellerStatus( $products, $capabilities ); + return new SellerStatus( $products, $capabilities, $json->country ?? '' ); } }