Skip to content

Commit

Permalink
Revert "10698 dr-nucleus-issues-in-stripe:"
Browse files Browse the repository at this point in the history
This reverts commit f8bdf26.
  • Loading branch information
VSydor committed Aug 16, 2023
1 parent f8bdf26 commit bffa317
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
18 changes: 2 additions & 16 deletions src/main/java/com/impactupgrade/nucleus/client/StripeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,26 +460,12 @@ public void updateSubscriptionPaymentMethod(String subscriptionId, String paymen
PaymentSource newSource = addCustomerSource(customer, paymentMethodToken);

// set source as defaultSource for subscription
updateSubscriptionDefaultSource(subscription, newSource);
updateSubscriptionPaymentMethod(subscription, newSource);

env.logJobInfo("updated customer {} payment method on subscription {}", customerId, subscriptionId);
}

public void disableSubscriptionProration(String subscriptionId) throws StripeException {
env.logJobInfo("updating subscription proration behaviour to {} for subscription {}", SubscriptionUpdateParams.ProrationBehavior.NONE, subscriptionId);

Subscription subscription = Subscription.retrieve(subscriptionId, requestOptions);

SubscriptionUpdateParams subscriptionUpdateParams = SubscriptionUpdateParams.builder()
.setProrationBehavior(SubscriptionUpdateParams.ProrationBehavior.NONE)
.build();

subscription.update(subscriptionUpdateParams, requestOptions);

env.logJobInfo("updated subscription proration behaviour to {} for subscription {}", SubscriptionUpdateParams.ProrationBehavior.NONE, subscriptionId);
}

public void updateSubscriptionDefaultSource(Subscription subscription, PaymentSource newSource) throws StripeException {
public void updateSubscriptionPaymentMethod(Subscription subscription, PaymentSource newSource) throws StripeException {
SubscriptionUpdateParams subscriptionParams = SubscriptionUpdateParams.builder()
.setDefaultSource(newSource.getId())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public Response updateSource(
}

if (!newSource.getId().equalsIgnoreCase(subscriptionPaymentMethodId)) {
stripeClient.updateSubscriptionDefaultSource(subscription, newSource);
stripeClient.updateSubscriptionPaymentMethod(subscription, newSource);
env.logJobInfo("updated payment method for subscription {}", subscription.getId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ public void updateSubscription(ManageDonationEvent manageDonationEvent) throws S
if (manageDonationEvent.getStripeToken() != null) {
stripeClient.updateSubscriptionPaymentMethod(crmRecurringDonation.subscriptionId, manageDonationEvent.getStripeToken());
}

stripeClient.disableSubscriptionProration(crmRecurringDonation.subscriptionId);
}

@Override
Expand Down

0 comments on commit bffa317

Please sign in to comment.