Skip to content
Merged
Show file tree
Hide file tree
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 @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/v3/InstalmentGenerator/Run.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Expand Down
2 changes: 1 addition & 1 deletion managed/Job_InstalmentCharge.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],
Expand Down
2 changes: 1 addition & 1 deletion managed/Job_InstalmentGenerator.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down
Loading