Esempio n. 1
0
  @Test
  public void canVaultOnTransactionCreate() {
    TransactionRequest request =
        new TransactionRequest()
            .amount(TransactionAmount.AUTHORIZE.amount)
            .paymentMethodNonce(Nonce.Coinbase)
            .options()
            .submitForSettlement(true)
            .storeInVaultOnSuccess(true)
            .done();

    Result<Transaction> authResult = gateway.transaction().sale(request);
    assertTrue(authResult.isSuccess());

    Transaction transaction = authResult.getTarget();
    assertNotNull(transaction);
    CoinbaseDetails details = transaction.getCoinbaseDetails();
    assertNotNull(details);
    String token = details.getToken();
    assertNotNull(token);

    PaymentMethod account = gateway.paymentMethod().find(token);
    assertTrue(account instanceof CoinbaseAccount);
    assertNotNull(account);
  }
Esempio n. 2
0
  @Test
  public void canCreateTransaction() {
    TransactionRequest request =
        new TransactionRequest()
            .amount(TransactionAmount.AUTHORIZE.amount)
            .paymentMethodNonce(Nonce.Coinbase);

    Result<Transaction> authResult = gateway.transaction().sale(request);
    assertTrue(authResult.isSuccess());

    CoinbaseDetails details = authResult.getTarget().getCoinbaseDetails();
    assertNotNull(details);
    assertNull(details.getToken());
    assertNotNull(details.getUserId());
    assertThat(details.getUserId(), not(equalTo("")));
    assertNotNull(details.getUserName());
    assertThat(details.getUserName(), not(equalTo("")));
    assertNotNull(details.getUserEmail());
    assertThat(details.getUserEmail(), not(equalTo("")));
  }