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

Fix PHP notice

parent 8b838a84
Branches
Tags
No related merge requests found
......@@ -767,10 +767,14 @@ class CRM_Core_Payment_StripeIPN {
'id' => $this->contribution_recur_id,
]);
if (empty($contributionRecur['installments']) && empty($contributionRecur['end_date'])) {
if (empty($contributionRecur['end_date'])) {
return;
}
// There is no easy way of retrieving a count of all invoices for a subscription so we ignore the "installments"
// parameter for now and rely on checking end_date (which was calculated based on number of installments...)
// if (empty($contributionRecur['installments'])) { return; }
$stripeSubscription = $this->_paymentProcessor->stripeClient->subscriptions->retrieve($this->subscription_id);
// If we've passed the end date cancel the subscription
if (($stripeSubscription->current_period_end >= strtotime($contributionRecur['end_date']))
......@@ -779,9 +783,6 @@ class CRM_Core_Payment_StripeIPN {
$this->_paymentProcessor->stripeClient->subscriptions->update($this->subscription_id, ['cancel_at_period_end' => TRUE]);
$this->updateRecurCompleted(['id' => $this->contribution_recur_id]);
}
// There is no easy way of retrieving a count of all invoices for a subscription so we ignore the "installments"
// parameter for now and rely on checking end_date (which was calculated based on number of installments...)
// $stripeInvoices = \Stripe\Invoice::all(['subscription' => $this->subscription_id, 'limit' => 100]);
}
}
......@@ -108,7 +108,6 @@ class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implements Headles
* Submit to stripe
*/
public function doPayment($params = []) {
// Send in credit card to get payment method. xxx mock here
$paymentMethod = $this->paymentObject->stripeClient->paymentMethods->create([
'type' => 'card',
......@@ -123,7 +122,7 @@ class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implements Headles
$paymentIntentID = NULL;
$paymentMethodID = NULL;
if (!array_key_exists('is_recur', $params)) {
if (!isset($params['is_recur'])) {
// Send in payment method to get payment intent.
$paymentIntentParams = [
'payment_method_id' => $paymentMethod->id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment