diff --git a/src/Pay/Adapter.php b/src/Pay/Adapter.php index f0a182e..b048231 100644 --- a/src/Pay/Adapter.php +++ b/src/Pay/Adapter.php @@ -123,7 +123,7 @@ abstract public function cancelAuthorization(string $paymentId, array $additiona * @param array $additionalParams Additional parameters (optional) * @return array Result of the update */ - abstract public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, string $currency = null, array $additionalParams = []): array; + abstract public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, ?string $currency = null, array $additionalParams = []): array; /** * Retry a purchase for a payment intent @@ -143,7 +143,7 @@ abstract public function retryPurchase(string $paymentId, ?string $paymentMethod * @param string $reason * @return array */ - abstract public function refund(string $paymentId, int $amount = null, string $reason = null): array; + abstract public function refund(string $paymentId, ?int $amount = null, ?string $reason = null): array; /** * Get a payment details @@ -173,7 +173,7 @@ abstract public function createPaymentMethod(string $customerId, string $type, a * @param array|null $address * @return array */ - abstract public function updatePaymentMethodBillingDetails(string $paymentMethodId, string $name = null, string $email = null, string $phone = null, array $address = null): array; + abstract public function updatePaymentMethodBillingDetails(string $paymentMethodId, ?string $name = null, ?string $email = null, ?string $phone = null, ?array $address = null): array; /** * Update payment method @@ -210,7 +210,7 @@ abstract public function deletePaymentMethod(string $paymentMethodId): bool; * @param string|null $paymentMethod * @return array */ - abstract public function createCustomer(string $name, string $email, array $address = [], string $paymentMethod = null): array; + abstract public function createCustomer(string $name, string $email, array $address = [], ?string $paymentMethod = null): array; /** * List customers @@ -237,7 +237,7 @@ abstract public function getCustomer(string $customerId): array; * @param string|null $paymentMethod * @return array */ - abstract public function updateCustomer(string $customerId, string $name, string $email, Address $address = null, string $paymentMethod = null): array; + abstract public function updateCustomer(string $customerId, string $name, string $email, ?Address $address = null, ?string $paymentMethod = null): array; /** * Delete Customer diff --git a/src/Pay/Adapter/Stripe.php b/src/Pay/Adapter/Stripe.php index fc65d23..72e8365 100644 --- a/src/Pay/Adapter/Stripe.php +++ b/src/Pay/Adapter/Stripe.php @@ -126,7 +126,7 @@ public function retryPurchase(string $paymentId, ?string $paymentMethodId = null /** * Refund payment */ - public function refund(string $paymentId, int $amount = null, string $reason = null): array + public function refund(string $paymentId, ?int $amount = null, ?string $reason = null): array { $path = '/refunds'; $requestBody = ['payment_intent' => $paymentId]; @@ -164,7 +164,7 @@ public function getPayment(string $paymentId): array * @param array $additionalParams Additional parameters (optional) * @return array Result of the update */ - public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, string $currency = null, array $additionalParams = []): array + public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, ?string $currency = null, array $additionalParams = []): array { $path = '/payment_intents/'.$paymentId; $requestBody = []; @@ -236,7 +236,7 @@ public function getPaymentMethod(string $customerId, string $paymentMethodId): a * @param array|null $address * @return array */ - public function updatePaymentMethodBillingDetails(string $paymentMethodId, string $name = null, string $email = null, string $phone = null, array $address = null): array + public function updatePaymentMethodBillingDetails(string $paymentMethodId, ?string $name = null, ?string $email = null, ?string $phone = null, ?array $address = null): array { $path = '/payment_methods/'.$paymentMethodId; $requestBody = []; @@ -285,7 +285,7 @@ public function deletePaymentMethod(string $paymentMethodId): bool * * @throws \Exception */ - public function createCustomer(string $name, string $email, array $address = [], string $paymentMethod = null): array + public function createCustomer(string $name, string $email, array $address = [], ?string $paymentMethod = null): array { $path = '/customers'; $requestBody = [ @@ -325,7 +325,7 @@ public function getCustomer(string $customerId): array /** * Update customer details */ - public function updateCustomer(string $customerId, string $name, string $email, Address $address = null, string $paymentMethod = null): array + public function updateCustomer(string $customerId, string $name, string $email, ?Address $address = null, ?string $paymentMethod = null): array { $path = '/customers/'.$customerId; $requestBody = [ diff --git a/src/Pay/Address.php b/src/Pay/Address.php index 0632d58..9fb3fb5 100644 --- a/src/Pay/Address.php +++ b/src/Pay/Address.php @@ -47,7 +47,7 @@ class Address */ protected ?string $state; - public function __construct(string $city, string $country, string $line1 = null, string $line2 = null, string $postalCode = null, string $state = null) + public function __construct(string $city, string $country, ?string $line1 = null, ?string $line2 = null, ?string $postalCode = null, ?string $state = null) { $this->city = $city; $this->country = $country; diff --git a/src/Pay/Exception.php b/src/Pay/Exception.php index ef234f0..074b358 100644 --- a/src/Pay/Exception.php +++ b/src/Pay/Exception.php @@ -23,7 +23,7 @@ class Exception extends \Exception */ protected array $metadata = []; - public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int $code = null, array $metadata = [], \Throwable $previous = null) + public function __construct(string $type = Exception::GENERAL_UNKNOWN, ?string $message = null, ?int $code = null, array $metadata = [], ?\Throwable $previous = null) { $this->type = $type; $this->code = $code ?? 500; diff --git a/src/Pay/Pay.php b/src/Pay/Pay.php index 908b370..fdea6c0 100644 --- a/src/Pay/Pay.php +++ b/src/Pay/Pay.php @@ -81,7 +81,7 @@ public function getCurrency(): string * @param array $additionalParams * @return array */ - public function purchase(int $amount, string $customerId, string $paymentMethodId = null, array $additionalParams = []): array + public function purchase(int $amount, string $customerId, ?string $paymentMethodId = null, array $additionalParams = []): array { return $this->adapter->purchase($amount, $customerId, $paymentMethodId, $additionalParams); } @@ -98,7 +98,7 @@ public function purchase(int $amount, string $customerId, string $paymentMethodI * @param array $additionalParams * @return array */ - public function authorize(int $amount, string $customerId, string $paymentMethodId = null, array $additionalParams = []): array + public function authorize(int $amount, string $customerId, ?string $paymentMethodId = null, array $additionalParams = []): array { return $this->adapter->authorize($amount, $customerId, $paymentMethodId, $additionalParams); } @@ -178,7 +178,7 @@ public function getPayment(string $paymentId): array * @param array $additionalParams Additional parameters (optional) * @return array Result of the update */ - public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, string $currency = null, array $additionalParams = []): array + public function updatePayment(string $paymentId, ?string $paymentMethodId = null, ?int $amount = null, ?string $currency = null, array $additionalParams = []): array { return $this->adapter->updatePayment($paymentId, $paymentMethodId, $amount, $currency, $additionalParams); } @@ -218,7 +218,7 @@ public function createPaymentMethod(string $customerId, string $type, array $det * @param array $address * @return array */ - public function updatePaymentMethodBillingDetails(string $paymentMethodId, string $type, string $name = null, string $email = null, string $phone = null, array $address = null): array + public function updatePaymentMethodBillingDetails(string $paymentMethodId, string $type, ?string $name = null, ?string $email = null, ?string $phone = null, ?array $address = null): array { return $this->adapter->updatePaymentMethodBillingDetails($paymentMethodId, $name, $email, $phone, $address); } @@ -307,7 +307,7 @@ public function getCustomer(string $customerId): array * @param Address $address * @return array */ - public function updateCustomer(string $customerId, string $name, string $email, Address $address = null, ?string $paymentMethod = null): array + public function updateCustomer(string $customerId, string $name, string $email, ?Address $address = null, ?string $paymentMethod = null): array { return $this->adapter->updateCustomer($customerId, $name, $email, $address, $paymentMethod); }