add refund logic and fix books inventory logic
This commit is contained in:
@@ -24,7 +24,7 @@ class RefundEligibilityServiceHarness extends RefundEligibilityService
|
||||
return $this->completedPayoutCents;
|
||||
}
|
||||
|
||||
protected function calculateReservedAmountCents(string $sourceType, int $sourceId, ?int $excludeRefundId): int
|
||||
protected function calculateReservedAmountCents(string $sourceType, int $sourceId, ?int $excludeRefundId, ?int $invoiceId = null): int
|
||||
{
|
||||
return $this->reservedAmountCents;
|
||||
}
|
||||
@@ -60,17 +60,17 @@ class RefundEligibilityServiceTest extends CIUnitTestCase
|
||||
$this->assertContains('HAS_APPROVED_RESERVATIONS', $result->reasonCodes);
|
||||
}
|
||||
|
||||
public function testTuitionWithdrawalAvailableCreditSubtractsCompletedPayoutsAndReservations(): void
|
||||
public function testTuitionWithdrawalAvailableCreditUsesAdjustedInvoiceCreditWithoutDoubleSubtractingPayouts(): void
|
||||
{
|
||||
$service = new RefundEligibilityServiceHarness(20000, 2500, 1500);
|
||||
|
||||
$result = $service->calculateAvailableCredit(10, 20, 'tuition_withdrawal', 20);
|
||||
|
||||
$this->assertSame(20000, $result->sourceCreditCents);
|
||||
$this->assertSame(2500, $result->completedPayoutCents);
|
||||
$this->assertSame(0, $result->completedPayoutCents);
|
||||
$this->assertSame(1500, $result->reservedAmountCents);
|
||||
$this->assertSame(16000, $result->availableAmountCents);
|
||||
$this->assertContains('HAS_COMPLETED_PAYOUTS', $result->reasonCodes);
|
||||
$this->assertSame(18500, $result->availableAmountCents);
|
||||
$this->assertNotContains('HAS_COMPLETED_PAYOUTS', $result->reasonCodes);
|
||||
$this->assertContains('HAS_APPROVED_RESERVATIONS', $result->reasonCodes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user