Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ public function testSelectsPendingContributions(): void {
$this->assertCount(1, $this->capturedEvents);
}

/**
* Tests that pay-later contributions are selected.
*
* Membership payment plan instalments are pay later (invoices), and must be
* charged like any other due instalment.
*/
public function testSelectsPayLaterContributions(): void {
$fixtures = $this->createTestFixtures([
'contribution_status' => 'Pending',
'receive_date' => date('Y-m-d', strtotime('-1 day')),
'is_pay_later' => TRUE,
]);

$result = $this->service->chargeInstalments([self::PROCESSOR_TYPE], 500, 3);

$this->assertEquals(1, $result['charged']);
$this->assertCount(1, $this->capturedEvents);
$this->assertArrayHasKey((int) $fixtures['contribution_id'], $this->capturedEvents[0]->getItems());
}

/**
* Tests that Partially paid contributions are selected.
*/
Expand Down Expand Up @@ -641,6 +661,7 @@ private function createTestFixtures(array $options = []): array {
'receive_date' => $options['receive_date'] ?? date('Y-m-d'),
'total_amount' => $totalAmount,
'currency' => $options['currency'] ?? 'GBP',
'is_pay_later' => $options['is_pay_later'] ?? FALSE,
]);

// Note: paid_amount is a computed field, not a real column.
Expand Down
Loading