diff --git a/app/PaymentDrivers/PaytracePaymentDriver.php b/app/PaymentDrivers/PaytracePaymentDriver.php index 74f797024f92..2097ea89ce86 100644 --- a/app/PaymentDrivers/PaytracePaymentDriver.php +++ b/app/PaymentDrivers/PaytracePaymentDriver.php @@ -11,18 +11,19 @@ namespace App\PaymentDrivers; -use App\Exceptions\SystemError; -use App\Http\Requests\Payments\PaymentWebhookRequest; -use App\Jobs\Util\SystemLogger; -use App\Models\ClientGatewayToken; -use App\Models\GatewayType; +use App\Models\Invoice; use App\Models\Payment; +use App\Utils\CurlUtils; +use App\Models\SystemLog; +use App\Models\GatewayType; use App\Models\PaymentHash; use App\Models\PaymentType; -use App\Models\SystemLog; -use App\PaymentDrivers\PayTrace\CreditCard; -use App\Utils\CurlUtils; +use App\Exceptions\SystemError; +use App\Jobs\Util\SystemLogger; use App\Utils\Traits\MakesHash; +use App\Models\ClientGatewayToken; +use App\PaymentDrivers\PayTrace\CreditCard; +use App\Http\Requests\Payments\PaymentWebhookRequest; class PaytracePaymentDriver extends BaseDriver { @@ -125,14 +126,26 @@ class PaytracePaymentDriver extends BaseDriver { $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; + $_invoice = collect($payment_hash->data->invoices)->first(); + $invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id)); + + if ($invoice) { + $invoice_id = ctrans('texts.invoice_number').'# '.$invoice->number; + } + + $invoice_id = ctrans('texts.invoice_number').'# '.substr($payment_hash->hash, 0, 6); + $data = [ 'customer_id' => $cgt->token, 'integrator_id' => $this->company_gateway->getConfigField('integratorId'), 'amount' => $amount, + 'invoice_id' => $invoice_id, ]; $response = $this->gatewayRequest('/v1/transactions/sale/by_customer', $data); + nlog($response); + if ($response && $response->success) { $data = [ 'gateway_type_id' => $cgt->gateway_type_id, diff --git a/resources/views/portal/ninja2020/gateways/paytrace/authorize.blade.php b/resources/views/portal/ninja2020/gateways/paytrace/authorize.blade.php index c84c6052171a..3a358432da9b 100644 --- a/resources/views/portal/ninja2020/gateways/paytrace/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/paytrace/authorize.blade.php @@ -32,6 +32,10 @@ @endsection @section('gateway_footer') - + @if($gateway->company_gateway->getConfigField('testMode')) + + @else + + @endif @endsection diff --git a/resources/views/portal/ninja2020/gateways/paytrace/pay.blade.php b/resources/views/portal/ninja2020/gateways/paytrace/pay.blade.php index 6d2933188b07..4807c15827e2 100644 --- a/resources/views/portal/ninja2020/gateways/paytrace/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/paytrace/pay.blade.php @@ -59,6 +59,10 @@ @endsection @section('gateway_footer') + @if($gateway->company_gateway->getConfigField('testMode')) + + @else + @endif @endsection