Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Pay/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ abstract public function cancelAuthorization(string $paymentId, array $additiona
* @param array<mixed> $additionalParams Additional parameters (optional)
* @return array<mixed> 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
Expand All @@ -143,7 +143,7 @@ abstract public function retryPurchase(string $paymentId, ?string $paymentMethod
* @param string $reason
* @return array<mixed>
*/
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
Expand Down Expand Up @@ -173,7 +173,7 @@ abstract public function createPaymentMethod(string $customerId, string $type, a
* @param array<mixed>|null $address
* @return array<mixed>
*/
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
Expand Down Expand Up @@ -210,7 +210,7 @@ abstract public function deletePaymentMethod(string $paymentMethodId): bool;
* @param string|null $paymentMethod
* @return array<mixed>
*/
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
Expand All @@ -237,7 +237,7 @@ abstract public function getCustomer(string $customerId): array;
* @param string|null $paymentMethod
* @return array<mixed>
*/
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
Expand Down
10 changes: 5 additions & 5 deletions src/Pay/Adapter/Stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -164,7 +164,7 @@ public function getPayment(string $paymentId): array
* @param array<mixed> $additionalParams Additional parameters (optional)
* @return array<mixed> 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 = [];
Expand Down Expand Up @@ -236,7 +236,7 @@ public function getPaymentMethod(string $customerId, string $paymentMethodId): a
* @param array<mixed>|null $address
* @return array<mixed>
*/
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 = [];
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/Pay/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Pay/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/Pay/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function getCurrency(): string
* @param array<mixed> $additionalParams
* @return array<mixed>
*/
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);
}
Expand All @@ -98,7 +98,7 @@ public function purchase(int $amount, string $customerId, string $paymentMethodI
* @param array<mixed> $additionalParams
* @return array<mixed>
*/
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);
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public function getPayment(string $paymentId): array
* @param array<mixed> $additionalParams Additional parameters (optional)
* @return array<mixed> 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);
}
Expand Down Expand Up @@ -218,7 +218,7 @@ public function createPaymentMethod(string $customerId, string $type, array $det
* @param array<mixed> $address
* @return array<mixed>
*/
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);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ public function getCustomer(string $customerId): array
* @param Address $address
* @return array<mixed>
*/
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);
}
Expand Down