mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Mollie: New payment flow (#73)
* pass livewirePaymentView & processPaymentView thru base driver * add paymentData to the interface * mollie * credit card
This commit is contained in:
parent
d68b75641a
commit
8fbd8a9593
@ -19,13 +19,14 @@ use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\PaymentDrivers\Common\MethodInterface;
|
||||
use App\PaymentDrivers\MolliePaymentDriver;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class Bancontact implements MethodInterface
|
||||
class Bancontact implements MethodInterface, LivewireMethodInterface
|
||||
{
|
||||
protected MolliePaymentDriver $mollie;
|
||||
|
||||
@ -209,4 +210,24 @@ class Bancontact implements MethodInterface
|
||||
{
|
||||
return $this->processSuccessfulPayment($payment, 'open');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function livewirePaymentView(array $data): string
|
||||
{
|
||||
// Doesn't support, it's offsite payment method.
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$this->paymentView($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\PaymentDrivers\Common\MethodInterface;
|
||||
use App\PaymentDrivers\MolliePaymentDriver;
|
||||
use Exception;
|
||||
@ -28,7 +29,7 @@ use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Mollie\Api\Resources\Payment as ResourcesPayment;
|
||||
|
||||
class BankTransfer implements MethodInterface
|
||||
class BankTransfer implements MethodInterface, LivewireMethodInterface
|
||||
{
|
||||
protected MolliePaymentDriver $mollie;
|
||||
|
||||
@ -206,4 +207,24 @@ class BankTransfer implements MethodInterface
|
||||
{
|
||||
return $this->processSuccessfulPayment($payment, 'open');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function livewirePaymentView(array $data): string
|
||||
{
|
||||
// Doesn't support, it's offsite payment method.
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$this->paymentView($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,13 @@ use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\PaymentDrivers\MolliePaymentDriver;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CreditCard
|
||||
class CreditCard implements LivewireMethodInterface
|
||||
{
|
||||
/**
|
||||
* @var MolliePaymentDriver
|
||||
@ -37,7 +38,7 @@ class CreditCard
|
||||
*/
|
||||
public function paymentView(array $data)
|
||||
{
|
||||
$data['gateway'] = $this->mollie;
|
||||
$data = $this->paymentData($data);
|
||||
|
||||
return render('gateways.mollie.credit_card.pay', $data);
|
||||
}
|
||||
@ -257,4 +258,22 @@ class CreditCard
|
||||
{
|
||||
return redirect()->route('client.payment_methods.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function livewirePaymentView(array $data): string
|
||||
{
|
||||
return 'gateways.mollie.credit_card.pay_livewire';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$data['gateway'] = $this->mollie;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,14 @@ use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\PaymentDrivers\Common\MethodInterface;
|
||||
use App\PaymentDrivers\MolliePaymentDriver;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class IDEAL implements MethodInterface
|
||||
class IDEAL implements MethodInterface, LivewireMethodInterface
|
||||
{
|
||||
protected MolliePaymentDriver $mollie;
|
||||
|
||||
@ -209,4 +210,24 @@ class IDEAL implements MethodInterface
|
||||
{
|
||||
return $this->processSuccessfulPayment($payment, 'open');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function livewirePaymentView(array $data): string
|
||||
{
|
||||
// Doesn't support, it's offsite payment method.
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$this->paymentView($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,14 @@ use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Common\LivewireMethodInterface;
|
||||
use App\PaymentDrivers\Common\MethodInterface;
|
||||
use App\PaymentDrivers\MolliePaymentDriver;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class KBC implements MethodInterface
|
||||
class KBC implements MethodInterface, LivewireMethodInterface
|
||||
{
|
||||
protected MolliePaymentDriver $mollie;
|
||||
|
||||
@ -193,4 +194,24 @@ class KBC implements MethodInterface
|
||||
|
||||
return redirect()->route('client.payments.show', ['payment' => $this->mollie->encodePrimaryKey($payment_record->id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function livewirePaymentView(array $data): string
|
||||
{
|
||||
// Doesn't support, it's offsite payment method.
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function paymentData(array $data): array
|
||||
{
|
||||
$this->paymentView($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
import { wait, instant } from '../wait';
|
||||
|
||||
class _Mollie {
|
||||
constructor() {
|
||||
this.mollie = Mollie(
|
||||
@ -166,4 +168,9 @@ class _Mollie {
|
||||
}
|
||||
}
|
||||
|
||||
new _Mollie().handle();
|
||||
|
||||
function boot() {
|
||||
new _Mollie().handle();
|
||||
}
|
||||
|
||||
instant() ? boot(): wait('#mollie-credit-card-payment').then(() => boot());
|
||||
|
@ -4,6 +4,7 @@ ctrans('texts.credit_card')])
|
||||
@section('gateway_head')
|
||||
<meta name="mollie-testmode" content="{{ $gateway->company_gateway->getConfigField('testMode') }}">
|
||||
<meta name="mollie-profileId" content="{{ $gateway->company_gateway->getConfigField('profileId') }}">
|
||||
<meta name="instant-payment" content="yes">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user