Skip to content

Commit 75afcad

Browse files
committed
Update parameter names in PaymentHandlerInterface implementations
1 parent 7440680 commit 75afcad

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/Contracts/PaymentHandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function proceedToPaymentGateway(Payment $payment, $redirect_or_callback_
2828
* process it should confirm that the payment_processor_name for the transaction is the
2929
* same as its own getUniquePaymentHandlerName() value, then handle the response and return the Payment object
3030
*
31-
* @param Request $request
31+
* @param Request $paymentGatewayServerResponse
3232
*
3333
* @return Payment
3434
*/
35-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment;
35+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment;
3636

3737
public function getHumanReadableTransactionResponse(Payment $payment): string;
3838

src/Services/PaymentHandlers/Flutterwave.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ protected function sendUserToPaymentGateway(string $redirect_or_callback_url, Pa
8585
exit;
8686
}
8787

88-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment
88+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment
8989
{
90-
if (!$request->has('tx_ref')) {
90+
if (!$paymentGatewayServerResponse->has('tx_ref')) {
9191
return null;
9292
}
9393

94-
$payment = $this->handleExternalWebhookRequest($request);
94+
$payment = $this->handleExternalWebhookRequest($paymentGatewayServerResponse);
9595

9696
return $payment;
9797
}

src/Services/PaymentHandlers/Interswitch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function proceedToPaymentGateway(Payment $payment, $redirect_or_callback_
4949
]);
5050
}
5151

52-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment
52+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment
5353
{
5454
return null;
5555
}

src/Services/PaymentHandlers/Paystack.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ public function proceedToPaymentGateway(Payment $payment, $redirect_or_callback_
4444
/**
4545
* This is a get request. (https://developers.paystack.co/docs/paystack-standard#section-4-verify-transaction)
4646
*
47-
* @param Request $request
47+
* @param Request $paymentGatewayServerResponse
4848
*
4949
* @return Payment
5050
*/
51-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment
51+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment
5252
{
53-
if (!$request->has('reference')) {
53+
if (!$paymentGatewayServerResponse->has('reference')) {
5454
return null;
5555
}
5656

57-
return $this->processValueForTransaction($request->reference);
57+
return $this->processValueForTransaction($paymentGatewayServerResponse->reference);
5858
}
5959

6060
/**
6161
* For Paystack, this is a get request. (https://developers.paystack.co/docs/paystack-standard#section-4-verify-transaction)
6262
*/
63-
public function processValueForTransaction(string $transactionReferenceIdNumber): ?Payment
63+
public function processValueForTransaction(string $paystackReference): ?Payment
6464
{
65-
throw_if(empty($transactionReferenceIdNumber));
65+
throw_if(empty($paystackReference));
6666

67-
$verificationResponse = $this->verifyPaystackTransaction($transactionReferenceIdNumber);
67+
$verificationResponse = $this->verifyPaystackTransaction($paystackReference);
6868

6969
// status should be true if there was a successful call
7070
if (!$verificationResponse->status) {
7171
throw new \Exception($verificationResponse->message);
7272
}
7373

74-
$payment = $this->resolveLocalPayment($transactionReferenceIdNumber, $verificationResponse);
74+
$payment = $this->resolveLocalPayment($paystackReference, $verificationResponse);
7575

7676
if ('success' === $verificationResponse->data['status']) {
7777
if ($payment->payment_processor_name != $this->getUniquePaymentHandlerName()) {
@@ -104,7 +104,7 @@ public function reQuery(Payment $existingPayment): ?ReQuery
104104
throw new \Exception($verificationResponse->message);
105105
}
106106

107-
$payment = $this->resolveLocalPayment($existingPayment->transaction_reference, $verificationResponse);
107+
$payment = $this->resolveLocalPayment($existingPayment->processor_transaction_reference, $verificationResponse);
108108

109109
if ('success' === $verificationResponse->data['status']) {
110110
if ($payment->payment_processor_name != $this->getUniquePaymentHandlerName()) {
@@ -266,13 +266,13 @@ public function createPaymentPlan(string $name, string $amount, string $interval
266266
return '';
267267
}
268268

269-
protected function resolveLocalPayment(string $transactionReferenceIdNumber, PaystackVerificationResponse $verificationResponse): Payment
269+
protected function resolveLocalPayment(string $paystackReferenceNumber, PaystackVerificationResponse $verificationResponse): Payment
270270
{
271271
return Payment::query()
272272
/**
273273
* normal transactions
274274
*/
275-
->where('processor_transaction_reference', $transactionReferenceIdNumber)
275+
->where('processor_transaction_reference', $paystackReferenceNumber)
276276

277277
/**
278278
* terminal POS transactions

src/Services/PaymentHandlers/Remita.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ protected function getRrrToInitiatePayment(Payment $payment): string
9191
return $responseJson['RRR'];
9292
}
9393

94-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment
94+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment
9595
{
96-
if (!$request->has('RRR')) {
96+
if (!$paymentGatewayServerResponse->has('RRR')) {
9797
return null;
9898
}
9999

100-
$rrr = $request->RRR;
100+
$rrr = $paymentGatewayServerResponse->RRR;
101101

102102
$payment = Payment::where('processor_transaction_reference', $rrr)
103103
->first();

src/Services/PaymentHandlers/UnifiedPayments.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ public function proceedToPaymentGateway(Payment $payment, $redirect_or_callback_
4444

4545
/**
4646
*
47-
* @param Request $request
47+
* @param Request $paymentGatewayServerResponse
4848
*
4949
* @return Payment
5050
*/
51-
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $request): ?Payment
51+
public function confirmResponseCanBeHandledAndUpdateDatabaseWithTransactionOutcome(Request $paymentGatewayServerResponse): ?Payment
5252
{
53-
if (!$request->has('trxId')) {
53+
if (!$paymentGatewayServerResponse->has('trxId')) {
5454
return null;
5555
}
5656

57-
$payment = Payment::where('processor_transaction_reference', $request->trxId)->first();
57+
$payment = Payment::where('processor_transaction_reference', $paymentGatewayServerResponse->trxId)->first();
5858

5959
if (is_null($payment)) {
6060
return null;

0 commit comments

Comments
 (0)