Add additional handling for nullable field in recurring donation record

This commit is contained in:
Chris Eager
2022-10-21 12:56:39 -05:00
committed by GitHub
parent 70a6c3e8e5
commit 8ea794baef
4 changed files with 173 additions and 106 deletions

View File

@@ -22,6 +22,7 @@ import java.time.Clock;
import java.time.Instant;
import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -223,9 +224,11 @@ class SubscriptionControllerTest {
when(STRIPE_MANAGER.createCustomer(any()))
.thenReturn(CompletableFuture.completedFuture(customer));
final SubscriptionManager.Record recordWithCustomerId = SubscriptionManager.Record.from(record.user, dynamoItem);
recordWithCustomerId.customerId = customerId;
recordWithCustomerId.processorsToCustomerIds.put(SubscriptionProcessor.STRIPE, customerId);
final Map<String, AttributeValue> dynamoItemWithProcessorCustomer = new HashMap<>(dynamoItem);
dynamoItemWithProcessorCustomer.put(SubscriptionManager.KEY_PROCESSOR_ID_CUSTOMER_ID,
b(new ProcessorCustomer(customerId, SubscriptionProcessor.STRIPE).toDynamoBytes()));
final SubscriptionManager.Record recordWithCustomerId = SubscriptionManager.Record.from(record.user,
dynamoItemWithProcessorCustomer);
when(SUBSCRIPTION_MANAGER.updateProcessorAndCustomerId(any(SubscriptionManager.Record.class), any(),
any(Instant.class)))