Skip to content

Commit

Permalink
Merge pull request #11 from utopia-php/feat-support-pmc
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar authored Dec 5, 2023
2 parents 3d55af7 + fbf3c52 commit 110f04a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Pay/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ abstract public function getPaymentMethod(string $customerId, string $paymentMet
* @param array $paymentMethodTypes
* @return array
*/
abstract public function createFuturePayment(string $customerId, array $paymentMethodTypes = []): array;
abstract public function createFuturePayment(string $customerId, array $paymentMethodTypes = [], ?string $paymentMethodConfiguration = null): array;

/**
* Call
Expand Down
6 changes: 5 additions & 1 deletion src/Pay/Adapter/Stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,18 @@ public function deleteCustomer(string $customerId): bool
return $result['deleted'] ?? false;
}

public function createFuturePayment(string $customerId, array $paymentMethodTypes = ['card']): array
public function createFuturePayment(string $customerId, array $paymentMethodTypes = ['card'], ?string $paymentMethodConfiguration = null): array
{
$path = '/setup_intents';
$requestBody = [
'customer' => $customerId,
'payment_method_types' => $paymentMethodTypes,
];

if ($paymentMethodConfiguration != null) {
$requestBody['payment_method_configuration'] = $paymentMethodConfiguration;
}

$result = $this->execute(self::METHOD_POST, $path, $requestBody);

return $result;
Expand Down
3 changes: 2 additions & 1 deletion src/Pay/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ public function deleteCustomer(string $customerId): bool
*
* @param string $customerId
* @param array $paymentMethodTypes
* @param ?string $paymentMethodConfiguration
* @return array
*/
public function createFuturePayment(string $customerId, array $paymentMethodTypes = ['card']): array
public function createFuturePayment(string $customerId, array $paymentMethodTypes = ['card'], ?string $paymentMethodConfiguration = null): array
{
return $this->adapter->createFuturePayment($customerId, $paymentMethodTypes);
}
Expand Down

0 comments on commit 110f04a

Please sign in to comment.