diff --git a/src/OrderBuilder.php b/src/OrderBuilder.php index e6bdd31..f648e83 100644 --- a/src/OrderBuilder.php +++ b/src/OrderBuilder.php @@ -11,6 +11,7 @@ class OrderBuilder private int $amount = 0; private string $description = ''; private string $brandName = ''; + private string $locale = 'es-AR'; private string $returnUrl = ''; private string $cancelUrl = ''; @@ -67,6 +68,16 @@ public function brandName(string $brandName): OrderBuilder return $this; } + /** + * @param string $locale + * @return OrderBuilder + */ + public function setLocale(string $locale): OrderBuilder + { + $this->locale = $locale; + return $this; + } + /** * @param string $returnUrl * @return OrderBuilder @@ -87,7 +98,8 @@ public function cancelUrl(string $cancelUrl): OrderBuilder return $this; } - public function make(): array { + public function make(): array + { return [ 'intent' => 'CAPTURE', 'purchase_units' => [ @@ -105,7 +117,7 @@ public function make(): array { ], 'application_context' => [ 'brand_name' => $this->brandName, - 'locale' => 'es-AR', + 'locale' => $this->locale, 'user_action' => 'PAY_NOW', 'payment_method' => [ 'payee_preferred' => 'IMMEDIATE_PAYMENT_REQUIRED', diff --git a/src/PayPalApi.php b/src/PayPalApi.php index 62b4864..82546a7 100644 --- a/src/PayPalApi.php +++ b/src/PayPalApi.php @@ -43,7 +43,6 @@ public function __construct(string $apiClientKey, string $apiClientSecret, bool /** * @param array $order - * * @return array * @throws RequestException */ @@ -73,6 +72,11 @@ public function findOrderById(string $id): ?array ->json(); } + /** + * @param string $orderId + * @return array|null + * @throws RequestException + */ public function captureOrder(string $orderId): ?array { $token = $this->getToken(); @@ -88,7 +92,6 @@ public function captureOrder(string $orderId): ?array /** * @param string $querystring - * * @return string * @throws RequestException */ diff --git a/src/PayPalFacade.php b/src/PayPalFacade.php index 4b6046c..ebb9ff3 100644 --- a/src/PayPalFacade.php +++ b/src/PayPalFacade.php @@ -13,6 +13,6 @@ class PayPalFacade extends Facade */ protected static function getFacadeAccessor() { - return 'paypal'; + return PayPal::class; } }