mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 05:14:37 -04:00
Reset v2 into working stage (#3673)
* fix withsorting * fix recurring invoices table * Reset BasePaymentDriver
This commit is contained in:
parent
42ccfe0700
commit
e3e52987c3
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Traits\WithSorting;
|
use App\Utils\Traits\WithSorting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\ClientGatewayToken;
|
use App\Models\ClientGatewayToken;
|
||||||
use App\Traits\WithSorting;
|
use App\Utils\Traits\WithSorting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Traits\WithSorting;
|
use App\Utils\Traits\WithSorting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
use App\Traits\WithSorting;
|
use App\Utils\Traits\WithSorting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use App\Traits\WithSorting;
|
use App\Utils\Traits\WithSorting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
@ -143,21 +143,20 @@ class BasePaymentDriver
|
|||||||
*/
|
*/
|
||||||
public function refundPayment($payment, $amount = 0)
|
public function refundPayment($payment, $amount = 0)
|
||||||
{
|
{
|
||||||
|
if ($amount) {
|
||||||
|
$amount = min($amount, $payment->getCompletedAmount());
|
||||||
|
} else {
|
||||||
|
$amount = $payment->getCompletedAmount();
|
||||||
|
}
|
||||||
|
|
||||||
if ($payment->is_deleted) {
|
if ($payment->is_deleted) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$amount || $amount == 0) {
|
if (! $amount) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($amount) {
|
|
||||||
$amount = min($amount, $payment->getCompletedAmount());
|
|
||||||
} else {
|
|
||||||
$amount = $payment->getCompletedAmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($payment->type_id == Payment::TYPE_CREDIT_CARD) {
|
if ($payment->type_id == Payment::TYPE_CREDIT_CARD) {
|
||||||
return $payment->recordRefund($amount);
|
return $payment->recordRefund($amount);
|
||||||
}
|
}
|
||||||
@ -178,15 +177,6 @@ class BasePaymentDriver
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function refundDetails($payment, $amount)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'amount' => $amount,
|
|
||||||
'transactionReference' => $payment->transaction_reference,
|
|
||||||
'currency' => $payment->client->getCurrencyCode(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function attemptVoidPayment($response, $payment, $amount)
|
protected function attemptVoidPayment($response, $payment, $amount)
|
||||||
{
|
{
|
||||||
// Partial refund not allowed for unsettled transactions
|
// Partial refund not allowed for unsettled transactions
|
||||||
@ -236,7 +226,7 @@ class BasePaymentDriver
|
|||||||
acceptNotification() - convert an incoming request from an off-site gateway to a generic notification object for further processing
|
acceptNotification() - convert an incoming request from an off-site gateway to a generic notification object for further processing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected function paymentDetails() : array
|
protected function paymentDetails($input) : array
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'currency' => $this->client->getCurrencyCode(),
|
'currency' => $this->client->getCurrencyCode(),
|
||||||
@ -295,58 +285,4 @@ class BasePaymentDriver
|
|||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////// V1 cut and paste
|
|
||||||
public function completeOffsitePurchase($input)
|
|
||||||
{
|
|
||||||
$this->input = $input;
|
|
||||||
$transRef = array_get($this->input, 'token');
|
|
||||||
|
|
||||||
if (method_exists($this->gateway(), 'completePurchase')) {
|
|
||||||
$details = $this->paymentDetails();
|
|
||||||
$response = $this->gateway()->completePurchase($details)->send();
|
|
||||||
$paymentRef = $response->getTransactionReference() ?: $transRef;
|
|
||||||
|
|
||||||
if ($response->isCancelled()) {
|
|
||||||
return false;
|
|
||||||
} elseif (!$response->isSuccessful()) {
|
|
||||||
throw new \Exception($response->getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$paymentRef = $transRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
//$this->updateClientFromOffsite($transRef, $paymentRef);
|
|
||||||
|
|
||||||
// check invoice still has balance
|
|
||||||
if (!floatval($this->invoice()->balance)) {
|
|
||||||
throw new Exception(trans('texts.payment_error_code', ['code' => 'NB']));
|
|
||||||
}
|
|
||||||
|
|
||||||
// check this isn't a duplicate transaction reference
|
|
||||||
if (Payment::whereAccountId($this->invitation->account_id)
|
|
||||||
->whereTransactionReference($paymentRef)
|
|
||||||
->first()
|
|
||||||
) {
|
|
||||||
throw new Exception(trans('texts.payment_error_code', ['code' => 'DT']));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->createPayment($paymentRef);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center md:justify-between mt-6 mb-6">
|
<div class="flex justify-center md:justify-between mt-6 mb-6">
|
||||||
@if($quotes->total() > 0)
|
@if($invoices->total() > 0)
|
||||||
<span class="text-gray-700 text-sm hidden md:block">
|
<span class="text-gray-700 text-sm hidden md:block">
|
||||||
{{ ctrans('texts.showing_x_of', ['first' => $quotes->firstItem(), 'last' => $quotes->lastItem(), 'total' => $quotes->total()]) }}
|
{{ ctrans('texts.showing_x_of', ['first' => $invoices->firstItem(), 'last' => $invoices->lastItem(), 'total' => $invoices->total()]) }}
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
{{ $invoices->links() }}
|
{{ $invoices->links() }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user