mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Update NinjaPaymentModel to Payment
This commit is contained in:
parent
17831087fe
commit
9a2286fb7b
@ -17,14 +17,14 @@ use App\Jobs\Mail\PaymentFailureMailer;
|
|||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Models\ClientGatewayToken;
|
use App\Models\ClientGatewayToken;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Payment as NinjaPaymentModel;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
use App\PaymentDrivers\CheckoutCom\Utilities;
|
use App\PaymentDrivers\CheckoutCom\Utilities;
|
||||||
use App\Utils\Traits\SystemLogTrait;
|
use App\Utils\Traits\SystemLogTrait;
|
||||||
use Checkout\CheckoutApi;
|
use Checkout\CheckoutApi;
|
||||||
use Checkout\Library\Exceptions\CheckoutHttpException;
|
use Checkout\Library\Exceptions\CheckoutHttpException;
|
||||||
use Checkout\Models\Payments\Payment;
|
use Checkout\Models\Payments\Payment as CheckoutPayment;
|
||||||
use Checkout\Models\Payments\TokenSource;
|
use Checkout\Models\Payments\TokenSource;
|
||||||
|
|
||||||
class CheckoutComPaymentDriver extends BasePaymentDriver
|
class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||||
@ -104,7 +104,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
|||||||
|
|
||||||
$method = new TokenSource($state['server_response']->cardToken);
|
$method = new TokenSource($state['server_response']->cardToken);
|
||||||
|
|
||||||
$payment = new Payment($method, $state['currency']);
|
$payment = new CheckoutPayment($method, $state['currency']);
|
||||||
$payment->amount = $state['value'];
|
$payment->amount = $state['value'];
|
||||||
|
|
||||||
// We need a proper logic to test if this is first payment with Checkout.
|
// We need a proper logic to test if this is first payment with Checkout.
|
||||||
@ -152,7 +152,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
|||||||
'amount' => $state['raw_value'],
|
'amount' => $state['raw_value'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$payment = $this->createPayment($data, NinjaPaymentModel::STATUS_COMPLETED);
|
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
$this->attachInvoices($payment, $state['hashed_ids']);
|
$this->attachInvoices($payment, $state['hashed_ids']);
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
|||||||
'amount' => $state['raw_value'],
|
'amount' => $state['raw_value'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$payment = $this->createPayment($data, NinjaPaymentModel::STATUS_PENDING);
|
$payment = $this->createPayment($data, Payment::STATUS_PENDING);
|
||||||
|
|
||||||
$this->attachInvoices($payment, $state['hashed_ids']);
|
$this->attachInvoices($payment, $state['hashed_ids']);
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
|||||||
throw new \Exception('Failed to process the payment.', 1);
|
throw new \Exception('Failed to process the payment.', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createPayment($data, $status = NinjaPaymentModel::STATUS_COMPLETED): NinjaPaymentModel
|
public function createPayment($data, $status = Payment::STATUS_COMPLETED): Payment
|
||||||
{
|
{
|
||||||
$payment = parent::createPayment($data, $status);
|
$payment = parent::createPayment($data, $status);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user