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/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/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, ], ], 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, ], ], 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. */