mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-30 23:27:29 -04:00 
			
		
		
		
	processWebhookRequest for checkoutpaymentdriver
This commit is contained in:
		
							parent
							
								
									c548bc2e0d
								
							
						
					
					
						commit
						fdafc068bb
					
				| @ -12,10 +12,15 @@ | ||||
| 
 | ||||
| namespace App\PaymentDrivers; | ||||
| 
 | ||||
| use App\Http\Requests\Payments\PaymentWebhookRequest; | ||||
| use App\Jobs\Util\SystemLogger; | ||||
| use App\Models\ClientGatewayToken; | ||||
| use App\Models\Company; | ||||
| use App\Models\CompanyGateway; | ||||
| use App\Models\GatewayType; | ||||
| use App\Models\Payment; | ||||
| use App\Models\PaymentHash; | ||||
| use App\Models\PaymentType; | ||||
| use App\Models\SystemLog; | ||||
| use App\PaymentDrivers\CheckoutCom\CreditCard; | ||||
| use App\PaymentDrivers\CheckoutCom\Utilities; | ||||
| @ -23,6 +28,7 @@ use App\Utils\Traits\SystemLogTrait; | ||||
| use Checkout\CheckoutApi; | ||||
| use Checkout\Library\Exceptions\CheckoutHttpException; | ||||
| use Checkout\Models\Payments\Refund; | ||||
| use Exception; | ||||
| 
 | ||||
| class CheckoutComPaymentDriver extends BaseDriver | ||||
| { | ||||
| @ -134,7 +140,7 @@ class CheckoutComPaymentDriver extends BaseDriver | ||||
|                 ->route('client.profile.edit', ['client_contact' => auth()->user()->hashed_id]) | ||||
|                 ->with('missing_required_fields', $this->required_fields); | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         return $this->payment_method->authorizeResponse($data); | ||||
|     } | ||||
| 
 | ||||
| @ -209,5 +215,24 @@ class CheckoutComPaymentDriver extends BaseDriver | ||||
| 
 | ||||
|     public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) | ||||
|     { | ||||
|         // ..
 | ||||
|     } | ||||
| 
 | ||||
|     public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null) | ||||
|     { | ||||
|         $this->init(); | ||||
|         $this->setPaymentHash($request->getPaymentHash()); | ||||
| 
 | ||||
|         try { | ||||
|             $payment = $this->gateway->payments()->details($request->query('cko-session-id')); | ||||
| 
 | ||||
|             if ($payment->approved) { | ||||
|                 return $this->processSuccessfulPayment($payment); | ||||
|             } else { | ||||
|                 return $this->processUnsuccessfulPayment($payment); | ||||
|             } | ||||
|         } catch (CheckoutHttpException | Exception $e) { | ||||
|             return $this->processInternallyFailedPayment($this, $e); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user