add refund logic and fix books inventory logic
This commit is contained in:
@@ -161,7 +161,7 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
|
||||
$this->assertSame('0.00', $calculation['balance']);
|
||||
$this->assertSame('15.00', $calculation['customer_credit']);
|
||||
$this->assertSame(-3500, $calculation['rawBalanceCents']);
|
||||
$this->assertSame(-1500, $calculation['rawBalanceCents']);
|
||||
}
|
||||
|
||||
public function testFullyRefundedOverpaymentClearsCustomerCredit(): void
|
||||
@@ -177,7 +177,7 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
|
||||
$this->assertSame('0.00', $calculation['balance']);
|
||||
$this->assertSame('0.00', $calculation['customer_credit']);
|
||||
$this->assertSame(-5000, $calculation['rawBalanceCents']);
|
||||
$this->assertSame(0, $calculation['rawBalanceCents']);
|
||||
}
|
||||
|
||||
public function testPaymentAfterRefundCanRestorePaidStatus(): void
|
||||
@@ -392,7 +392,7 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
$this->assertSame(FinancialStatus::INVOICE_PAID, $calculation['status']);
|
||||
}
|
||||
|
||||
public function testCashRefundDoesNotCreateBalanceAfterOverpaymentIsReturned(): void
|
||||
public function testCashRefundAboveOverpaymentCreatesBalanceDue(): void
|
||||
{
|
||||
$service = new InvoiceLedgerServiceHarness([
|
||||
'id' => 12,
|
||||
@@ -405,8 +405,8 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
$calculation = $service->calculateInvoice(12);
|
||||
|
||||
$this->assertSame('0.00', $calculation['customer_credit']);
|
||||
$this->assertSame('0.00', $calculation['balance']);
|
||||
$this->assertSame(FinancialStatus::INVOICE_PAID, $calculation['status']);
|
||||
$this->assertSame('5.00', $calculation['balance']);
|
||||
$this->assertSame(FinancialStatus::INVOICE_PARTIALLY_PAID, $calculation['status']);
|
||||
}
|
||||
|
||||
public function testIssuedInvoiceUsesPaidRefundsAsCashOutInsteadOfAdditionalCredit(): void
|
||||
@@ -429,7 +429,7 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
$this->assertSame(FinancialStatus::INVOICE_PAID, $calculation['status']);
|
||||
}
|
||||
|
||||
public function testRefundedWithdrawalInvoiceHasNoBalanceDue(): void
|
||||
public function testRefundedWithdrawalInvoiceShowsBalanceWhenRefundsExceedPaymentAgainstCharge(): void
|
||||
{
|
||||
$service = new InvoiceLedgerServiceHarness([
|
||||
'id' => 14,
|
||||
@@ -446,7 +446,7 @@ class InvoiceLedgerServiceTest extends CIUnitTestCase
|
||||
$this->assertSame('178.00', $calculation['paid_amount']);
|
||||
$this->assertSame('178.00', $calculation['refund_paid_total']);
|
||||
$this->assertSame('0.00', $calculation['customer_credit']);
|
||||
$this->assertSame('0.00', $calculation['balance']);
|
||||
$this->assertSame(FinancialStatus::INVOICE_PAID, $calculation['status']);
|
||||
$this->assertSame('280.00', $calculation['balance']);
|
||||
$this->assertSame(FinancialStatus::INVOICE_PARTIALLY_PAID, $calculation['status']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user