Skip to content
Snippets Groups Projects
Commit f4ecbb9b authored by mattwire's avatar mattwire
Browse files

Support future recurring start date on backend forms

parent 127eed76
Branches
Tags
1 merge request!1246.5
......@@ -141,7 +141,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
* @return bool
*/
public function supportsFutureRecurStartDate() {
return FALSE;
return TRUE;
}
/**
......@@ -661,6 +661,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
'default_payment_method' => $stripePaymentMethod,
'metadata' => ['Description' => $params['description']],
'expand' => ['latest_invoice.payment_intent'],
'billing_cycle_anchor' => $this->getRecurBillingCycleDay($params),
];
// Create the stripe subscription for the customer
......@@ -705,6 +706,15 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
return $this->endDoPayment($params, $newParams);
}
private function getRecurBillingCycleDay($params) {
if (empty($params['receive_date'])) {
return strtotime('now');
}
else {
return strtotime($params['receive_date']);
}
}
/**
* This performs the processing and recording of the paymentIntent for both recurring and non-recurring payments
* @param array $params
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment