Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjude committed Apr 24, 2024
1 parent b2f17f8 commit 6385a4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Contracts/ProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getCheckout(string $sessionReference): ?SessionData;

public function destroyCheckout(string $sessionReference): void;

public function confirmTransaction(string $reference, ?SerializableClosure $closure): ?TransactionData;
public function confirmTransaction(string $reference, ?SerializableClosure $closure = null): ?TransactionData;

public function findTransaction(string $reference): TransactionData;

Expand Down
14 changes: 11 additions & 3 deletions src/DataObjects/TransactionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public function __construct(

public function isSuccessful(): bool
{
// Paystack: success; Flutterwave: successful; Stripe: succeeded;
// Paystack: success; Flutterwave: successful; Stripe: succeeded; Startbutton: verified;
/**
* @description Paystack: success;
* Flutterwave: successful;
* Stripe: succeeded;
* Startbutton: verified;
*/
return match (strtolower($this->status)) {
'success', 'succeeded', 'successful', 'paid', 'approved', 'completed' => true,
'success', 'succeeded', 'successful', 'paid', 'approved', 'completed', 'verified' => true,
default => false
};
}
Expand All @@ -38,7 +44,9 @@ public function isProcessing(): bool

public function failed(): bool
{
// Paystack: failed; Flutterwave: failed; Stripe: failed;
/**
* @description Paystack: failed; Flutterwave: failed; Stripe: failed;
*/
return match (strtolower($this->status)) {
'failed', 'expired' => true,
default => false
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getReference(string $sessionReference): string|null
return Cache::get($key);
}

public function confirmTransaction(string $reference, ?SerializableClosure $closure): TransactionData|null
public function confirmTransaction(string $reference, ?SerializableClosure $closure = null): TransactionData|null
{
$transaction = $this->findTransaction($reference);

Expand Down
4 changes: 2 additions & 2 deletions src/Providers/StartbuttonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function initializeCheckout(array $parameters = []): SessionData
public function findTransaction(string $reference): TransactionData
{
$transaction = $this->request('GET', "transaction/status/$reference");

return $this->transactionDTO($transaction['data']['transaction']);
}

Expand All @@ -84,7 +84,7 @@ public function transactionDTO(array $transaction): TransactionData
meta: null,
amount: ($transaction['amount'] / 100),
currency: $transaction['currency'],
reference: $transaction['transactionReference'],
reference: $transaction['userTransactionReference'],
provider: $this->provider,
status: $transaction['status'],
date: Carbon::parse($transaction['createdAt'])->toDateTimeString(),
Expand Down

0 comments on commit 6385a4d

Please sign in to comment.