mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Paytrace: New payment flow (#74)
* pass livewirePaymentView & processPaymentView thru base driver * add paymentData to the interface * paytrace
This commit is contained in:
parent
cbd852a0fc
commit
fc80287429
@ -18,12 +18,13 @@ use App\Models\Invoice;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||||
use App\PaymentDrivers\PaytracePaymentDriver;
|
use App\PaymentDrivers\PaytracePaymentDriver;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreditCard
|
class CreditCard implements LivewireMethodInterface
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
@ -36,8 +37,7 @@ class CreditCard
|
|||||||
|
|
||||||
public function authorizeView($data)
|
public function authorizeView($data)
|
||||||
{
|
{
|
||||||
$data['client_key'] = $this->paytrace->getAuthToken();
|
$data = $this->paymentData($data);
|
||||||
$data['gateway'] = $this->paytrace;
|
|
||||||
|
|
||||||
return render('gateways.paytrace.authorize', $data);
|
return render('gateways.paytrace.authorize', $data);
|
||||||
}
|
}
|
||||||
@ -240,4 +240,23 @@ class CreditCard
|
|||||||
|
|
||||||
return $this->paytrace->processUnsuccessfulTransaction($data);
|
return $this->paytrace->processUnsuccessfulTransaction($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function livewirePaymentView(array $data): string
|
||||||
|
{
|
||||||
|
return 'gateways.paytrace.pay_livewire';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function paymentData(array $data): array
|
||||||
|
{
|
||||||
|
$data['client_key'] = $this->paytrace->getAuthToken();
|
||||||
|
$data['gateway'] = $this->paytrace;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { instant, wait } from '../wait';
|
||||||
|
|
||||||
class PayTraceCreditCard {
|
class PayTraceCreditCard {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.clientKey = document.querySelector(
|
this.clientKey = document.querySelector(
|
||||||
@ -217,7 +219,15 @@ class PayTraceCreditCard {
|
|||||||
|
|
||||||
return this.handlePaymentWithToken(e);
|
return this.handlePaymentWithToken(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Array.from(document.getElementsByClassName('toggle-payment-with-token')).length === 0 && !instant()) {
|
||||||
|
document.getElementById('toggle-payment-with-credit-card').click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new PayTraceCreditCard().handle();
|
function boot() {
|
||||||
|
new PayTraceCreditCard().handle();
|
||||||
|
}
|
||||||
|
|
||||||
|
instant() ? boot() : wait('#paytrace-credit-card-payment').then(() => boot())
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="ctrans-cvv" content="{{ ctrans('texts.cvv') }}">
|
<meta name="ctrans-cvv" content="{{ ctrans('texts.cvv') }}">
|
||||||
<meta name="ctrans-card_number" content="{{ ctrans('texts.card_number') }}">
|
<meta name="ctrans-card_number" content="{{ ctrans('texts.card_number') }}">
|
||||||
<meta name="ctrans-expires" content="{{ ctrans('texts.expires') }}">
|
<meta name="ctrans-expires" content="{{ ctrans('texts.expires') }}">
|
||||||
|
<meta name="instant-payment" content="yes" />
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('gateway_content')
|
@section('gateway_content')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user