2022-08-11 09:46:51 +00:00
< ? php
namespace App\Http\Controllers ;
2023-07-31 22:20:36 +00:00
use App\Enums\PaymentMethod ;
2023-06-07 19:56:04 +00:00
use App\Enums\PaymentTransactionStatus ;
2023-07-31 22:20:36 +00:00
use App\Enums\PaymentType ;
use App\Models\Country ;
2023-06-29 08:53:32 +00:00
use App\Models\PaymentAggregator ;
2022-08-11 09:46:51 +00:00
use App\Models\PaymentTransaction ;
use GuzzleHttp\Client ;
use Illuminate\Http\Request ;
2022-11-19 18:16:55 +00:00
use Illuminate\Support\Facades\Lang ;
2022-08-11 09:46:51 +00:00
use Illuminate\Support\Facades\Log ;
2023-06-29 08:53:32 +00:00
use Propaganistas\LaravelPhone\PhoneNumber ;
use Propaganistas\LaravelPhone\Rules\Phone ;
2023-07-31 12:54:20 +00:00
use Symfony\Component\HttpFoundation\Response as ResponseAlias ;
2022-08-11 09:46:51 +00:00
use Throwable ;
class CinetpayController extends Controller
{
private $client ;
private $timeout = 60 ; //In seconds
/**
* Create a new controller instance .
*
* @ return void
*/
public function __construct ()
{
// Create a client with a base URI
$this -> client = new Client ([
'base_uri' => config ( 'variables.cinetpay_api_url' )
]);
}
2022-10-08 21:12:51 +00:00
/**
* @ OA\Get (
* path = " /cinetpay/methods " ,
* summary = " Afficher la liste des methodes de Cinetpay " ,
* tags = { " Cinetpay " },
* security = {{ " api_key " : {}}},
* @ OA\Response (
* response = 200 ,
* description = " OK " ,
* @ OA\JsonContent (
* ref = " #/components/schemas/ApiResponse " ,
* example = {
* " status " : 200 ,
2022-11-21 22:29:50 +00:00
* " response " : { " hasWebview " : true , " methods " : { " MOBILE_MONEY " : " Mobile Money " , " CREDIT_CARD " : " Carte de crédit " }},
2022-10-08 21:12:51 +00:00
* " error " : null
* }
* )
* )
* )
*/
public function getMethods ()
{
2022-11-19 18:16:55 +00:00
$providers = [
// 'ALL',
'MOBILE_MONEY' ,
'CREDIT_CARD' ,
];
$methods = [];
foreach ( $providers as $provider ) {
$key = 'providers.' . $provider ;
2022-11-21 23:56:44 +00:00
$method [ 'title' ] = Lang :: has ( $key ) ? __ ( $key ) : $provider ;
$method [ 'value' ] = $provider ;
$methods [] = $method ;
2022-11-19 18:16:55 +00:00
}
return $this -> successResponse ([
'hasWebview' => true ,
'methods' => $methods ,
]);
2022-10-08 21:12:51 +00:00
}
2022-08-11 09:46:51 +00:00
//
public function pay ( Request $request )
{
$this -> validate ( $request , [
2023-08-01 06:15:48 +00:00
// 'aggregator_id' => 'required|integer',
2022-08-11 09:46:51 +00:00
'amount' => 'required|numeric|min:5' ,
'currency' => 'required|string|size:3' ,
2023-07-31 12:54:20 +00:00
// 'payment_method' => 'nullable|string|in:ALL,MOBILE_MONEY,CREDIT_CARD,WALLET',
2022-08-11 09:46:51 +00:00
'customer_id' => 'required|integer' ,
'customer_email' => 'required|email' ,
2023-06-07 19:56:04 +00:00
'customer_name' => 'nullable|string' ,
2022-08-11 09:46:51 +00:00
'customer_surname' => 'required|string' ,
'customer_phone_number' => 'required|string' ,
'customer_address' => 'required|string' ,
'customer_city' => 'required_if:payment_method,CREDIT_CARD|string' ,
'customer_country' => 'required|string|size:2' ,
2023-07-17 11:10:04 +00:00
'customer_state' => 'required_if:payment_method,CREDIT_CARD|string' , //Etat du pays dans lequel se trouve le client. Cette valeur est obligatoire si le client se trouve au États Unis d’ Amérique (US) ou au Canada (CA)
2022-08-11 09:46:51 +00:00
'customer_zip_code' => 'required_if:payment_method,CREDIT_CARD|string|size:5' ,
'reason' => 'required|string'
]);
2023-08-01 06:15:48 +00:00
$aggregator = PaymentAggregator :: where ( 'name' , 'like' , '%cinetpay%' ) -> firstOrFail ();
2022-08-11 09:46:51 +00:00
$transaction_id = $this -> getTransactionID ();
2023-07-31 12:54:20 +00:00
$payment_method = 'ALL' ;
2022-08-11 09:46:51 +00:00
$amount = $request -> input ( 'amount' );
$currency = $request -> input ( 'currency' );
if ( $currency != 'USD' ) {
// Convertir en multiple de 5
$amount = $this -> roundUpToAny ( $amount );
}
// Init payment
$createResponse = $this -> client -> post ( 'payment' , [
'json' => [
" api_key " => config ( 'variables.cinetpay_api_key' ),
" site_id " => config ( 'variables.cinetpay_site_id' ),
" transaction_id " => $transaction_id ,
" amount " => $amount ,
" currency " => $request -> input ( 'currency' ),
" description " => $request -> input ( 'reason' ),
" notify_url " => route ( 'cinetpay.webhook' ),
" return_url " => route ( 'cinetpay.webhook' ),
" channels " => $payment_method ,
'lang' => app () -> getLocale (),
" customer_id " => $request -> input ( 'customer_id' ),
" customer_name " => $request -> input ( 'customer_name' ),
" customer_surname " => $request -> input ( 'customer_surname' ),
" customer_email " => $request -> input ( 'customer_email' ),
" customer_phone_number " => $request -> input ( 'customer_phone_number' ),
" customer_address " => $request -> input ( 'customer_address' ),
" customer_city " => $request -> input ( 'customer_city' ),
" customer_country " => $request -> input ( 'customer_country' ),
" customer_state " => $request -> input ( 'customer_state' ),
" customer_zip_code " => $request -> input ( 'customer_zip_code' ),
],
'timeout' => $this -> timeout
]);
$responseData = json_decode ( $createResponse -> getBody () -> getContents ());
$responseCode = $createResponse -> getStatusCode ();
if ( $responseCode == 200 ) {
PaymentTransaction :: create ([
2023-08-01 06:15:48 +00:00
'aggregator_id' => $aggregator -> id ,
2022-08-11 09:46:51 +00:00
" currency " => $request -> input ( 'currency' ),
" transaction_id " => $transaction_id ,
" amount " => $amount ,
" payment_method " => $payment_method ,
" payment_token " => $responseData -> data -> payment_token ,
" payment_url " => $responseData -> data -> payment_url ,
2023-06-07 19:56:04 +00:00
'status' => PaymentTransactionStatus :: PENDING ,
2022-08-11 09:46:51 +00:00
" reason " => $request -> input ( 'reason' ),
" customer_id " => $request -> input ( 'customer_id' ),
" customer_name " => $request -> input ( 'customer_name' ),
" customer_surname " => $request -> input ( 'customer_surname' ),
" customer_email " => $request -> input ( 'customer_email' ),
" customer_phone_number " => $request -> input ( 'customer_phone_number' ),
" customer_address " => $request -> input ( 'customer_address' ),
" customer_city " => $request -> input ( 'customer_city' ),
" customer_country " => $request -> input ( 'customer_country' ),
" customer_state " => $request -> input ( 'customer_state' ),
" customer_zip_code " => $request -> input ( 'customer_zip_code' ),
]);
return $this -> successResponse ([
'message' => $responseData -> message ,
'payment_url' => $responseData -> data -> payment_url
2023-07-31 12:54:20 +00:00
], ResponseAlias :: HTTP_MOVED_PERMANENTLY );
2022-08-11 09:46:51 +00:00
} else {
return $this -> errorResponse ( $responseData -> error ? ? trans ( 'errors.unexpected_error' ), $responseCode );
}
}
2023-06-29 08:53:32 +00:00
public function payOut ( Request $request )
{
$this -> validate ( $request , [
// 'aggregator_id' => 'required|integer',
'amount' => 'required|numeric|min:5' ,
'currency' => 'required|string|size:3' ,
'customer_id' => 'nullable' ,
// 'payment_method' => 'required|string|in:WALLET',
'customer_email' => 'required|email' ,
'customer_name' => 'nullable|string' ,
'customer_surname' => 'required|string' ,
'customer_phone_number' => [ 'nullable' , 'string' ,( new Phone ()) -> country ([ 'CI' , 'SN' , 'ML' , 'CM' , 'TG' , 'BF' , 'CD' , 'GN' , 'BJ' ])],
2023-06-29 09:08:08 +00:00
'customer_address' => 'nullable|string' ,
'customer_city' => 'nullable|string' ,
2023-06-29 08:53:32 +00:00
'customer_country' => 'required|string|size:2|in:CI,SN,ML,CM,TG,BF,CD,GN,BJ' ,
'reason' => 'required|string'
]);
$aggregator = PaymentAggregator :: where ( 'name' , 'like' , '%cinetpay%' ) -> firstOrFail ();
try {
2023-06-29 09:47:30 +00:00
$customer_surname = $request -> input ( 'customer_surname' );
$customer_name = $request -> input ( 'customer_name' ) ? ? $customer_surname ;
$customer_email = $request -> input ( 'customer_email' );
2023-06-29 08:53:32 +00:00
$country_code = $request -> input ( 'customer_country' );
$phoneNumber = str_replace ( ' ' , '' , $request -> input ( 'customer_phone_number' ));
$phone = new PhoneNumber ( $phoneNumber , $country_code );
2023-06-29 09:08:08 +00:00
$phoneNumber = str_replace ( ' ' , '' , $phone -> formatInternational ());
2023-06-29 08:53:32 +00:00
$nationalPhone = str_replace ( ' ' , '' , $phone -> formatNational ());
$phonePrefix = substr ( $phoneNumber , 1 , strlen ( $phoneNumber ) - strlen ( $nationalPhone ) - 1 );
$amount = $request -> input ( 'amount' );
$payment_method = 'WALLET' ;
2023-07-03 07:05:58 +00:00
// if($amount < 500){
// return $this->errorResponse('Minimun amount is 500');
// }
2023-06-29 08:53:32 +00:00
$client = new Client ([
'base_uri' => config ( 'variables.cinetpay_transfert_url' )
]);
// Login
$loginResponse = $client -> post ( 'auth/login' , [
'form_params' => [
" apikey " => config ( 'variables.cinetpay_api_key' ),
" password " => config ( 'variables.cinetpay_transfert_password' ),
],
'timeout' => $this -> timeout ,
'http_errors' => false
]);
$responseData = json_decode ( $loginResponse -> getBody () -> getContents ());
$token = $responseData -> data -> token ;
$responseCode = $loginResponse -> getStatusCode ();
2023-06-29 09:47:30 +00:00
if ( $responseCode == 200 && ! empty ( $token )) {
2023-06-29 08:53:32 +00:00
// Add Contact
$contactResponse = $client -> post ( 'transfer/contact' , [
'query' => [
'token' => $token
],
'form_params' => [
" data " => json_encode (
[
[
'prefix' => $phonePrefix ,
'phone' => $nationalPhone ,
2023-06-29 09:47:30 +00:00
'name' => $customer_name ,
'surname' => $customer_surname ,
'email' => $customer_email
2023-06-29 08:53:32 +00:00
]
]
),
],
'timeout' => $this -> timeout ,
'http_errors' => false
]);
$responseCode = $contactResponse -> getStatusCode ();
2023-06-29 09:47:30 +00:00
$responseData = json_decode ( $contactResponse -> getBody () -> getContents ());
2023-06-29 08:53:32 +00:00
if ( $responseCode == 200 ) {
$transactionId = $this -> getTransactionID ();
$transaction = PaymentTransaction :: create ([
'aggregator_id' => $aggregator -> id ,
" currency " => $request -> input ( 'currency' ),
" transaction_id " => $transactionId ,
" amount " => $amount ,
" payment_method " => $payment_method ,
'status' => PaymentTransactionStatus :: INITIATED ,
" reason " => $request -> input ( 'reason' ),
" customer_id " => $request -> input ( 'customer_id' ),
2023-06-29 09:47:30 +00:00
" customer_name " => $customer_name ,
" customer_surname " => $customer_surname ,
" customer_email " => $customer_email ,
2023-06-29 08:53:32 +00:00
" customer_phone_number " => $phoneNumber ,
" customer_address " => $request -> input ( 'customer_address' ),
" customer_city " => $request -> input ( 'customer_city' ),
" customer_country " => $request -> input ( 'customer_country' ),
" customer_state " => $request -> input ( 'customer_state' ),
" customer_zip_code " => $request -> input ( 'customer_zip_code' ),
]);
// Transfert Fund
$transfertResponse = $client -> post ( 'transfer/money/send/contact' , [
'query' => [
'token' => $token
],
'form_params' => [
" data " => json_encode (
[
[
'client_transaction_id' => $transactionId ,
'amount' => $amount ,
'notify_url' => route ( 'cinetpay.transfert.webhook' ),
'prefix' => $phonePrefix ,
'phone' => $nationalPhone ,
]
]
),
],
'timeout' => $this -> timeout ,
'http_errors' => false
]);
$responseData = json_decode ( $transfertResponse -> getBody () -> getContents ());
$responseCode = $transfertResponse -> getStatusCode ();
if ( $responseCode == 200 ) {
$transaction -> update ([
2023-07-03 08:06:53 +00:00
'aggregator_payment_ref' => $responseData -> data [ 0 ][ 0 ] ? -> transaction_id ,
'status' => $this -> convertTransfertStatus ( $responseData -> data [ 0 ][ 0 ] ? -> treatment_status ) ,
2023-06-29 08:53:32 +00:00
]);
return $this -> successResponse ([
'message' => 'Transfert is pending' ,
'transaction_id' => $transactionId ,
'transaction_status' => $transaction -> status
]);
2023-07-24 11:15:53 +00:00
} else {
Log :: error ( " Error Cinetpay make transfert payment " );
Log :: error ( json_encode ( $responseData ));
return $this -> errorResponse ( __ ( 'errors.service_unavailable_try_later' ));
2023-06-29 08:53:32 +00:00
}
}
}
2023-06-29 09:47:30 +00:00
2023-06-29 08:53:32 +00:00
$errorMessage = $responseData ? -> description ? ? $responseData ? -> message ;
} catch ( Throwable $e ){
Log :: error ( " Error CinetPay transfert payment " );
$errorMessage = $e -> getMessage ();
2023-07-03 08:06:53 +00:00
Log :: error ( " Response data :: " . json_encode ( $responseData ? ? '' ));
2023-06-29 08:53:32 +00:00
Log :: error ( $errorMessage );
}
return $this -> errorResponse ( $errorMessage ? ? __ ( 'errors.unexpected_error' ));
}
public function captureTransfertResult ( Request $request )
{
$this -> validate ( $request , [
'transaction_id' => 'nullable|string' ,
'client_transaction_id' => 'nullable|string|exists:payment_transactions,transaction_id'
]);
if ( $request -> has ( 'transaction_id' ) && $request -> has ( 'client_transaction_id' )){
$transaction = PaymentTransaction :: where ( 'transaction_id' , $request -> input ( 'client_transaction_id' )) -> firstOrFail ();
try {
$client = new Client ([
'base_uri' => config ( 'variables.cinetpay_transfert_url' )
]);
// Login
$loginResponse = $client -> post ( 'auth/login' , [
'form_params' => [
" apikey " => config ( 'variables.cinetpay_api_key' ),
" password " => config ( 'variables.cinetpay_transfert_password' ),
],
'timeout' => $this -> timeout
]);
$responseData = json_decode ( $loginResponse -> getBody () -> getContents ());
$token = $responseData -> data -> token ;
$responseCode = $loginResponse -> getStatusCode ();
if ( $responseCode == 200 && ! empty ( $token )) {
$response = $client -> get ( 'transfer/check/money' , [
'query' => [
'token' => $token ,
'transaction_id' => $request -> input ( 'transaction_id' )
],
]);
$responseData = json_decode ( $response -> getBody () -> getContents ());
$responseCode = $response -> getStatusCode ();
if ( $responseCode == 200 ) {
$transaction -> update ([
2023-07-03 07:05:58 +00:00
'aggregator_payment_ref' => $responseData -> data [ 0 ] ? -> transaction_id ,
2023-07-03 08:06:53 +00:00
'status' => $this -> convertTransfertStatus ( $responseData -> data [ 0 ] ? -> treatment_status ),
2023-06-29 08:53:32 +00:00
]);
}
}
} catch ( Throwable $e ) {
Log :: info ( " Get Cinetpay Transfert Status Error " );
$errorMessage = $e -> getMessage ();
2023-07-03 08:06:53 +00:00
Log :: error ( " Response data :: " . json_encode ( $responseData ? ? '' ));
2023-06-29 08:53:32 +00:00
Log :: info ( $errorMessage );
$transaction -> update ([
'status' => PaymentTransactionStatus :: REFUSED
]);
}
return $this -> errorResponse ( $errorMessage ? ? __ ( 'errors.unexpected_error' ));
} else {
return response ( " OK " );
}
}
2023-07-03 08:06:53 +00:00
private function convertTransfertStatus ( $incomingStatus ) : string {
return match ( $incomingStatus ) {
'NEW' , 'REC' => PaymentTransactionStatus :: PENDING ,
'VAL' => PaymentTransactionStatus :: ACCEPTED ,
'REJ' => PaymentTransactionStatus :: REFUSED ,
'NOS' => PaymentTransactionStatus :: PENDING_OTP ,
default => PaymentTransactionStatus :: INITIATED ,
};
}
2023-06-29 08:53:32 +00:00
2022-08-11 09:46:51 +00:00
public function capturePaymentResult ( Request $request )
{
$this -> validate ( $request , [
'cpm_site_id' => 'nullable|string' ,
'cpm_trans_id' => 'nullable|string|exists:payment_transactions,transaction_id'
]);
if ( $request -> has ( 'cpm_trans_id' )) {
$data = $request -> input ( 'cpm_site_id' ) . $request -> input ( 'cpm_trans_id' ) . $request -> input ( 'cpm_trans_date' ) . $request -> input ( 'cpm_amount' ) . $request -> input ( 'cpm_currency' ) .
$request -> input ( 'signature' ) . $request -> input ( 'payment_method' ) . $request -> input ( 'cel_phone_num' ) . $request -> input ( 'cpm_phone_prefixe' ) .
$request -> input ( 'cpm_language' ) . $request -> input ( 'cpm_version' ) . $request -> input ( 'cpm_payment_config' ) . $request -> input ( 'cpm_page_action' ) . $request -> input ( 'cpm_custom' ) . $request -> input ( 'cpm_designation' ) . $request -> input ( 'cpm_error_message' );
$generated_token = hash_hmac ( 'SHA256' , $data , config ( 'variables.cinetpay_secret_key' ));
$received_token = $request -> header ( 'x-token' );
if ( hash_equals ( $received_token , $generated_token )) {
$transaction = PaymentTransaction :: where ( 'transaction_id' , $request -> input ( 'cpm_trans_id' )) -> firstOrFail ();
return $this -> getPaymentStatus ( $transaction );
} else {
return $this -> errorResponse ( " Invalid token " );
}
} else if ( $request -> has ( 'transaction_id' )){
$transaction = PaymentTransaction :: where ( 'transaction_id' , $request -> input ( 'transaction_id' )) -> firstOrFail ();
return $this -> getPaymentStatus ( $transaction );
} else {
return response ( " OK " );
}
}
private function getPaymentStatus ( PaymentTransaction $transaction )
{
try {
$response = $this -> client -> post ( 'payment/check' , [
'json' => [
" apikey " => config ( 'variables.cinetpay_api_key' ),
" site_id " => config ( 'variables.cinetpay_site_id' ),
'transaction_id' => $transaction -> transaction_id ,
]
]);
$responseData = json_decode ( $response -> getBody () -> getContents ());
$responseCode = $response -> getStatusCode ();
if ( $responseCode == 200 ) {
$transaction -> update ([
2023-06-07 19:56:04 +00:00
'status' => $responseData -> data -> status ,
2022-08-11 09:46:51 +00:00
'payment_method_exact' => $responseData -> data -> payment_method ? ? null ,
'aggregator_payment_ref' => $responseData -> data -> operator_id ? ? null ,
'payment_date' => $responseData -> data -> payment_date ? ? null ,
]);
}
} catch ( Throwable $e ) {
Log :: info ( " Get Payment Status Error " );
Log :: info ( $e -> getMessage ());
$transaction -> update ([
2023-06-07 19:56:04 +00:00
'status' => PaymentTransactionStatus :: REFUSED
2022-08-11 09:46:51 +00:00
]);
}
2023-06-07 19:56:04 +00:00
if ( $transaction -> status == PaymentTransactionStatus :: ACCEPTED ){
2022-11-12 14:01:21 +00:00
return redirect () -> route ( 'paymentResult' ,[
2022-08-11 09:46:51 +00:00
'transaction_id' => $transaction -> transaction_id ,
2022-11-12 14:01:21 +00:00
'token' => $transaction -> payment_token ,
'status' => 1
2022-08-11 09:46:51 +00:00
]);
} else {
2022-11-12 14:01:21 +00:00
return redirect () -> route ( 'paymentResult' ,[
'message' => " Payment failed " ,
'status' => 0
]);
2022-08-11 09:46:51 +00:00
}
}
2023-07-31 22:20:36 +00:00
public function checkBalance ( Request $request )
{
$this -> validate ( $request , [
'country_id' => 'required|integer|exists:countries,id' ,
'amount' => 'required|numeric' ,
'payment_channel' => 'nullable|string' ,
]);
$amount = $request -> input ( 'amount' );
$paymentChannel = $request -> input ( 'payment_channel' );
$countryId = $request -> input ( 'country_id' );
$country = Country :: where ( 'id' , $countryId ) -> firstOrFail ();
$countryCode = $country -> code_country ;
$client = new Client ([
'base_uri' => config ( 'variables.cinetpay_transfert_url' )
]);
// Login
$loginResponse = $client -> post ( 'auth/login' , [
'form_params' => [
" apikey " => config ( 'variables.cinetpay_api_key' ),
" password " => config ( 'variables.cinetpay_transfert_password' ),
],
'timeout' => $this -> timeout ,
'http_errors' => false
]);
$responseData = json_decode ( $loginResponse -> getBody () -> getContents ());
$token = $responseData -> data -> token ;
$responseCode = $loginResponse -> getStatusCode ();
if ( $responseCode == 200 && ! empty ( $token )) {
// Add Contact
$balanceResponse = $client -> get ( 'transfer/check/balance' , [
'query' => [
'token' => $token
],
'timeout' => $this -> timeout ,
'http_errors' => false
]);
$responseCode = $balanceResponse -> getStatusCode ();
$responseData = json_decode ( $balanceResponse -> getBody () -> getContents ());
if ( $responseCode == 200 ) {
$amountAvailable = $responseData ? -> data ? -> countryBalance ? -> { $countryCode } ? -> available ? ? 0 ;
$fees = 0 ;
$aggregator = PaymentAggregator :: where ( 'name' , 'like' , '%cinetpay%' ) -> first ();
if ( ! empty ( $aggregator )){
$baseQuery = $aggregator -> rates () -> where ( 'type' , PaymentType :: CASH_IN )
-> where ( 'method' , PaymentMethod :: WALLET )
-> when ( $paymentChannel , function ( $q ) use ( $paymentChannel ){
return $q -> where ( 'channel' , $paymentChannel );
});
$rate = ( clone $baseQuery ) -> where ( 'country' , $countryCode ) -> first ();
if ( empty ( $rate )){
$rate = ( clone $baseQuery ) -> where ( 'country' , 'ALL' ) -> first ();
}
if ( ! empty ( $rate )){
if ( ! empty ( $rate -> fixed_fees )){
$targetCurrency = $country -> currency -> code ;
$sourceCurrency = $targetCurrency ;
if ( ! empty ( $rate -> fixed_fees_currency )){
$sourceCurrency = $rate -> fixed_fees_currency ;
}
$fixed_fees = $this -> toMoneyAmount ( $rate -> fixed_fees , $sourceCurrency , $targetCurrency );
$fees = (( $amount - $fixed_fees ) * $rate -> rate / 100 ) + $fixed_fees ;
} else {
$fees = $amount * $rate -> rate / 100 ;
}
}
}
$amount += $fees ;
if ( $amountAvailable >= $amount ){
return $this -> successResponse ( " Solde disponible " );
} else {
Log :: error ( " Solde insuffisant :: " . $amountAvailable );
return $this -> errorResponse ( __ ( 'errors.service_unavailable_try_later' ));
}
}
}
$errorMessage = $responseData ? -> description ? ? $responseData ? -> message ;
Log :: error ( " Error CinetPay check balance " );
Log :: error ( " Response data :: " . json_encode ( $responseData ? ? '' ));
return $this -> errorResponse ( $errorMessage ? ? __ ( 'errors.unexpected_error' ));
}
2022-08-11 09:46:51 +00:00
}