Add paymentMethod and paymentProcessing fields to GET /v1/subscription/{subscriberId} endpoint

This commit is contained in:
Katherine
2023-10-10 09:56:50 -07:00
committed by GitHub
parent e1aa734c40
commit 207ae6129b
5 changed files with 66 additions and 15 deletions

View File

@@ -394,6 +394,7 @@ public class SubscriptionController {
return switch (paymentMethod) {
case CARD, SEPA_DEBIT -> stripeManager;
case PAYPAL -> braintreeManager;
case UNKNOWN -> throw new BadRequestException("Invalid payment method");
};
}
@@ -886,7 +887,7 @@ public class SubscriptionController {
public record Subscription(long level, Instant billingCycleAnchor, Instant endOfCurrentPeriod, boolean active,
boolean cancelAtPeriodEnd, String currency, BigDecimal amount, String status,
SubscriptionProcessor processor) {
SubscriptionProcessor processor, PaymentMethod paymentMethod, boolean paymentProcessing) {
}
}
@@ -919,7 +920,9 @@ public class SubscriptionController {
subscriptionInformation.price().currency(),
subscriptionInformation.price().amount(),
subscriptionInformation.status().getApiValue(),
manager.getProcessor()),
manager.getProcessor(),
subscriptionInformation.paymentMethod(),
subscriptionInformation.paymentProcessing()),
subscriptionInformation.chargeFailure()
)).build()));
});