1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Paytrace sandbox

This commit is contained in:
David Bomba 2023-05-24 09:37:29 +10:00
parent c9e66b34ec
commit ed4db8963b
3 changed files with 30 additions and 9 deletions

View File

@ -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,

View File

@ -32,6 +32,10 @@
@endsection
@section('gateway_footer')
<script src="https://protect.paytrace.com/js/protect.min.js"></script>
@if($gateway->company_gateway->getConfigField('testMode'))
<script src='https://protect.sandbox.paytrace.com/js/protect.min.js'></script>
@else
<script src='https://protect.paytrace.com/js/protect.min.js'></script>
@endif
<script src="{{ asset('js/clients/payments/paytrace-credit-card.js') }}"></script>
@endsection

View File

@ -59,6 +59,10 @@
@endsection
@section('gateway_footer')
@if($gateway->company_gateway->getConfigField('testMode'))
<script src='https://protect.sandbox.paytrace.com/js/protect.min.js'></script>
@else
<script src='https://protect.paytrace.com/js/protect.min.js'></script>
@endif
<script src="{{ asset('js/clients/payments/paytrace-credit-card.js') }}"></script>
@endsection