mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Tests for delayed gocardless payments
This commit is contained in:
parent
90adc915bd
commit
9d9f9e6a6b
@ -353,6 +353,8 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
];
|
];
|
||||||
|
|
||||||
$payment = $this->go_cardless->createPayment($data, Payment::STATUS_COMPLETED);
|
$payment = $this->go_cardless->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
|
$payment->save();
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
['response' => $payment, 'data' => $data],
|
['response' => $payment, 'data' => $data],
|
||||||
|
@ -14,6 +14,7 @@ namespace Tests\Feature;
|
|||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
@ -178,6 +179,18 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
|
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
|
||||||
|
|
||||||
|
|
||||||
|
$cg = new CompanyGateway;
|
||||||
|
$cg->company_id = $this->company->id;
|
||||||
|
$cg->user_id = $this->user->id;
|
||||||
|
$cg->gateway_key = 'b9886f9257f0c6ee7c302f1c74475f6c';
|
||||||
|
$cg->require_cvv = true;
|
||||||
|
$cg->require_billing_address = true;
|
||||||
|
$cg->require_shipping_address = true;
|
||||||
|
$cg->update_details = true;
|
||||||
|
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||||
|
$cg->fees_and_limits = '';
|
||||||
|
$cg->save();
|
||||||
|
|
||||||
foreach($this->mock['events'] as $event)
|
foreach($this->mock['events'] as $event)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -213,17 +226,19 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
$this->assertEquals('my_mandate', $data['payment_method']);
|
$this->assertEquals('my_mandate', $data['payment_method']);
|
||||||
$this->assertEquals('gocardless_payment_id', $data['transaction_reference']);
|
$this->assertEquals('gocardless_payment_id', $data['transaction_reference']);
|
||||||
$this->assertEquals($invoice->balance, $data['amount']);
|
$this->assertEquals($invoice->balance, $data['amount']);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$gocardless_driver = $cg->driver($this->client);
|
||||||
|
$gocardless_driver->setPaymentHash($hash);
|
||||||
|
|
||||||
|
$payment = $gocardless_driver->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(Payment::class, $payment);
|
||||||
|
|
||||||
|
$this->assertEquals(round($invoice->amount,2), round($payment->amount,2));
|
||||||
|
$this->assertEquals(Payment::STATUS_COMPLETED, $payment->status_id);
|
||||||
|
$this->assertEquals(1, $payment->invoices()->count());
|
||||||
|
$this->assertEquals($invoice->number, $payment->invoices()->first()->number);
|
||||||
|
$this->assertEquals(Invoice::STATUS_PAID, $payment->invoices()->first()->status_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -231,5 +246,10 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user