From 31a0b76a360feff2b625e4a2c9b9061828b4a19b Mon Sep 17 00:00:00 2001 From: Erawat Chamanont Date: Wed, 11 Mar 2026 14:35:57 +0000 Subject: [PATCH 1/3] CIVIMM-462: Fix processor type name from Stripe to Stripe Connect The instalment generation job filtered by PaymentProcessorType.name using 'Stripe', but the actual type name in the database is 'Stripe Connect', causing the job to find zero eligible recurring contributions. --- .../Service/InstalmentGenerationService.php | 2 +- managed/Job_InstalmentGenerator.mgd.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Civi/Paymentprocessingcore/Service/InstalmentGenerationService.php b/Civi/Paymentprocessingcore/Service/InstalmentGenerationService.php index 60793fa..7d3b455 100644 --- a/Civi/Paymentprocessingcore/Service/InstalmentGenerationService.php +++ b/Civi/Paymentprocessingcore/Service/InstalmentGenerationService.php @@ -24,7 +24,7 @@ class InstalmentGenerationService { /** * Default payment processor type. */ - public const DEFAULT_PROCESSOR_TYPE = 'Stripe'; + public const DEFAULT_PROCESSOR_TYPE = 'Stripe Connect'; /** * Generate instalments for all due recurring contributions. diff --git a/managed/Job_InstalmentGenerator.mgd.php b/managed/Job_InstalmentGenerator.mgd.php index 4423dce..3eeaa36 100644 --- a/managed/Job_InstalmentGenerator.mgd.php +++ b/managed/Job_InstalmentGenerator.mgd.php @@ -20,7 +20,7 @@ 'api_entity' => 'InstalmentGenerator', 'api_action' => 'Run', 'api_version' => 3, - 'parameters' => "processor_type=Stripe\nbatch_size=500", + 'parameters' => "processor_type=Stripe Connect\nbatch_size=500", 'is_active' => 1, ], ], From 6c56614b759c88918b750ec1332eedd1c7fbd9aa Mon Sep 17 00:00:00 2001 From: Erawat Chamanont Date: Wed, 11 Mar 2026 14:44:34 +0000 Subject: [PATCH 2/3] CIVIMM-462: Fix charge job processor type from Stripe to Stripe Connect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same mismatch as the generator job — the charge job also filtered by PaymentProcessorType.name using 'Stripe' instead of 'Stripe Connect'. --- managed/Job_InstalmentCharge.mgd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/managed/Job_InstalmentCharge.mgd.php b/managed/Job_InstalmentCharge.mgd.php index 423b5bf..240a2fd 100644 --- a/managed/Job_InstalmentCharge.mgd.php +++ b/managed/Job_InstalmentCharge.mgd.php @@ -28,7 +28,7 @@ 'api_entity' => 'InstalmentCharge', 'api_action' => 'Run', 'api_version' => 3, - 'parameters' => "processor_type=Stripe\nbatch_size=500\nmax_retry_count=3", + 'parameters' => "processor_type=Stripe Connect\nbatch_size=500\nmax_retry_count=3", 'is_active' => 1, ], ], From 310aa14444fa5965b7cdfaba8c4e614621edadd8 Mon Sep 17 00:00:00 2001 From: Erawat Chamanont Date: Wed, 11 Mar 2026 14:46:19 +0000 Subject: [PATCH 3/3] CIVIMM-462: Add regression test for processor type constant/job sync Verifies that the DEFAULT_PROCESSOR_TYPE constant matches the managed job parameter so a mismatch cannot silently break instalment generation. --- api/v3/InstalmentGenerator/Run.php | 2 +- .../InstalmentGenerationServiceTest.php | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/api/v3/InstalmentGenerator/Run.php b/api/v3/InstalmentGenerator/Run.php index 03aa567..224005b 100644 --- a/api/v3/InstalmentGenerator/Run.php +++ b/api/v3/InstalmentGenerator/Run.php @@ -42,7 +42,7 @@ function civicrm_api3_instalment_generator_Run(array $params): array { function _civicrm_api3_instalment_generator_Run_spec(array &$spec): void { $spec['processor_type'] = [ 'title' => 'Processor Type', - 'description' => 'Payment processor type name. Default: "Stripe".', + 'description' => 'Payment processor type name. Default: "Stripe Connect".', 'type' => CRM_Utils_Type::T_STRING, 'api.default' => InstalmentGenerationService::DEFAULT_PROCESSOR_TYPE, ]; diff --git a/tests/phpunit/Civi/Paymentprocessingcore/Service/InstalmentGenerationServiceTest.php b/tests/phpunit/Civi/Paymentprocessingcore/Service/InstalmentGenerationServiceTest.php index 8065d17..d624082 100644 --- a/tests/phpunit/Civi/Paymentprocessingcore/Service/InstalmentGenerationServiceTest.php +++ b/tests/phpunit/Civi/Paymentprocessingcore/Service/InstalmentGenerationServiceTest.php @@ -8,7 +8,7 @@ * * Uses the built-in CiviCRM Dummy payment processor type for testing, * passing 'Dummy' as the processor_type parameter. The service and - * scheduled job default to 'Stripe' in production, but the query is + * scheduled job default to 'Stripe Connect' in production, but the query is * fully parameterized to support any payment processor type. * * @group headless @@ -391,6 +391,38 @@ public function testGetDueRecurringContributionsFiltersByProcessorType(): void { $this->assertCount(0, $results); } + /** + * Tests DEFAULT_PROCESSOR_TYPE matches the managed job parameter. + * + * Regression test: the managed job definition must use the same processor + * type as the service default so that the job works out of the box. + */ + public function testDefaultProcessorTypeMatchesManagedJobParameter(): void { + $managed = include __DIR__ . '/../../../../../managed/Job_InstalmentGenerator.mgd.php'; + + $this->assertIsArray($managed); + $this->assertArrayHasKey(0, $managed); + $params = $managed[0]['params'] ?? []; + $this->assertArrayHasKey('parameters', $params); + + // Parse the newline-delimited job parameters. + $lines = explode("\n", $params['parameters']); + $jobParams = []; + foreach ($lines as $line) { + $parts = explode('=', $line, 2); + if (count($parts) === 2) { + $jobParams[trim($parts[0])] = trim($parts[1]); + } + } + + $this->assertArrayHasKey('processor_type', $jobParams); + $this->assertEquals( + InstalmentGenerationService::DEFAULT_PROCESSOR_TYPE, + $jobParams['processor_type'], + 'Managed job processor_type must match DEFAULT_PROCESSOR_TYPE constant' + ); + } + /** * Tests getDueRecurringContributions only returns In Progress status. */