This commit is contained in:
David Bomba 2023-12-18 15:37:03 +11:00
parent c026704e83
commit 3365e93da0
2 changed files with 7 additions and 12 deletions

View File

@ -137,7 +137,7 @@ class ACSS
* Generates a token Payment Intent * Generates a token Payment Intent
* *
* @param ClientGatewayToken $token * @param ClientGatewayToken $token
* @return void * @return PaymentIntent
*/ */
private function tokenIntent(ClientGatewayToken $token): PaymentIntent private function tokenIntent(ClientGatewayToken $token): PaymentIntent
{ {
@ -223,7 +223,6 @@ class ACSS
* Continues the payment flow after a Mandate has been successfully generated * Continues the payment flow after a Mandate has been successfully generated
* *
* @param array $data * @param array $data
* @return void
*/ */
private function continuePayment(array $data) private function continuePayment(array $data)
{ {
@ -260,7 +259,7 @@ class ACSS
/** /**
* PaymentResponseRequest * PaymentResponseRequest
* *
* @param mixed $request * @param PaymentResponseRequest $request
*/ */
public function paymentResponse(PaymentResponseRequest $request) public function paymentResponse(PaymentResponseRequest $request)
{ {
@ -269,7 +268,7 @@ class ACSS
$cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token)); $cgt = ClientGatewayToken::find($this->decodePrimaryKey($request->token));
/** @var Stripe\PaymentIntent $intent */ /** @var \Stripe\PaymentIntent $intent */
$intent = $this->tokenIntent($cgt); $intent = $this->tokenIntent($cgt);
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all());
@ -298,7 +297,7 @@ class ACSS
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $stripe_amount]); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['stripe_amount' => $stripe_amount]);
$this->stripe->payment_hash->save(); $this->stripe->payment_hash->save();
/** @var Stripe\PaymentIntent $intent */ /** @var \Stripe\PaymentIntent $intent */
$intent = $this->tokenIntent($cgt); $intent = $this->tokenIntent($cgt);
if ($intent->status && $intent->status == 'processing') { if ($intent->status && $intent->status == 'processing') {
@ -316,9 +315,8 @@ class ACSS
* Creates a payment for the transaction * Creates a payment for the transaction
* *
* @param string $payment_intent * @param string $payment_intent
* @return Illuminate\Http\RedirectResponse
*/ */
public function processSuccessfulPayment(string $payment_intent): \Illuminate\Http\RedirectResponse public function processSuccessfulPayment(string $payment_intent)
{ {
$data = [ $data = [
'payment_method' => $payment_intent, 'payment_method' => $payment_intent,

View File

@ -102,12 +102,9 @@ class Charge
]; ];
switch ($e) { switch ($e) {
/** @var \Stripe\Exception\CardException $e */
case $e instanceof CardException: case $e instanceof CardException:
$data['status'] = $e->getHttpStatus(); $data['message'] = $e->getError()->message ?? $e->getMessage();
$data['error_type'] = $e->getError()->type;
$data['error_code'] = $e->getError()->code;
$data['param'] = $e->getError()->param;
$data['message'] = $e->getError()->message;
break; break;
case $e instanceof RateLimitException: case $e instanceof RateLimitException:
$data['message'] = 'Too many requests made to the API too quickly'; $data['message'] = 'Too many requests made to the API too quickly';