mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 03:06:01 +02:00
Add Registrar client ID to Braintree payment info
The client ID is passed as the "customer ID" to Braintree. In order for this to work, someone needs to go into the Braintree website beforehand, click on "New Customer" link, and create the customer record with a matching ID. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=116769955
This commit is contained in:
parent
dd633c9e72
commit
3eef39126d
5 changed files with 52 additions and 0 deletions
|
@ -22,6 +22,8 @@ import static org.mockito.Mockito.verify;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.domain.registry.model.registrar.Registrar;
|
||||
import com.google.domain.registry.testing.AppEngineRule;
|
||||
|
||||
import com.braintreegateway.BraintreeGateway;
|
||||
import com.braintreegateway.Result;
|
||||
|
@ -35,6 +37,7 @@ import com.braintreegateway.ValidationErrors;
|
|||
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
@ -49,6 +52,9 @@ import java.math.BigDecimal;
|
|||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class RegistrarPaymentActionTest {
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||
|
||||
@Mock
|
||||
private BraintreeGateway braintreeGateway;
|
||||
|
||||
|
@ -71,6 +77,7 @@ public class RegistrarPaymentActionTest {
|
|||
|
||||
@Before
|
||||
public void before() throws Exception {
|
||||
paymentAction.registrar = Registrar.loadByClientId("TheRegistrar");
|
||||
paymentAction.accountIds =
|
||||
ImmutableMap.of(
|
||||
CurrencyUnit.USD, "merchant-account-usd",
|
||||
|
@ -106,6 +113,8 @@ public class RegistrarPaymentActionTest {
|
|||
.isEqualTo(BigDecimal.valueOf(123.4).setScale(2));
|
||||
assertThat(extractField(String.class, transactionRequest, "merchantAccountId"))
|
||||
.isEqualTo("merchant-account-usd");
|
||||
assertThat(extractField(String.class, transactionRequest, "customerId"))
|
||||
.isEqualTo("TheRegistrar");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue