Group one-time donation methods together

This commit is contained in:
ravi-signal
2024-08-15 13:25:09 -05:00
committed by GitHub
parent b5f9564e13
commit a8eaf2d0ad
10 changed files with 507 additions and 372 deletions

View File

@@ -133,7 +133,6 @@ public class BraintreeManager implements SubscriptionProcessorManager {
return paymentMethod == PaymentMethod.PAYPAL;
}
@Override
public CompletableFuture<PaymentDetails> getPaymentDetails(final String paymentId) {
return CompletableFuture.supplyAsync(() -> {
try {

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.subscriptions;
import java.time.Instant;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Payment details for a one-time payment specified by id
*
* @param id The id of the payment in the payment processor
* @param customMetadata Any custom metadata attached to the payment
* @param status The status of the payment in the payment processor
* @param created When the payment was created
* @param chargeFailure If present, additional information about why the payment failed. Will not be set if the status
* is not {@link PaymentStatus#SUCCEEDED}
*/
public record PaymentDetails(String id,
Map<String, String> customMetadata,
PaymentStatus status,
Instant created,
@Nullable ChargeFailure chargeFailure) {}

View File

@@ -0,0 +1,12 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.subscriptions;
public enum PaymentStatus {
SUCCEEDED,
PROCESSING,
FAILED,
UNKNOWN,
}

View File

@@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.subscriptions;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
@@ -22,8 +21,6 @@ public interface SubscriptionProcessorManager {
Set<String> getSupportedCurrenciesForPaymentMethod(PaymentMethod paymentMethod);
CompletableFuture<PaymentDetails> getPaymentDetails(String paymentId);
CompletableFuture<ProcessorCustomer> createCustomer(byte[] subscriberUser, @Nullable ClientPlatform clientPlatform);
CompletableFuture<String> createPaymentMethodSetupToken(String customerId);
@@ -58,21 +55,6 @@ public interface SubscriptionProcessorManager {
CompletableFuture<SubscriptionInformation> getSubscriptionInformation(Object subscription);
record PaymentDetails(String id,
Map<String, String> customMetadata,
PaymentStatus status,
Instant created,
@Nullable ChargeFailure chargeFailure) {
}
enum PaymentStatus {
SUCCEEDED,
PROCESSING,
FAILED,
UNKNOWN,
}
enum SubscriptionStatus {
/**
* The subscription is in good standing and the most recent payment was successful.