Package com.stripe.model

Examples of com.stripe.model.Token


    Map<String, Object> creationParams = new HashMap<String, Object>();
    creationParams.put("card", defaultCardParams);
    Card addedCard = createdCustomer.createCard(creationParams);

    Token token = Token.create(defaultTokenParams);
    createdCustomer.createCard(token.getId());

    Customer updatedCustomer = Customer.retrieve(createdCustomer.getId());
    assertEquals((Integer) updatedCustomer.getCards().getData().size(), (Integer) 3);
    assertEquals(updatedCustomer.getDefaultCard(), originalDefaultCard);
View Full Code Here


    assertTrue(linesAfterFirst.getData().isEmpty());
  }

  @Test
  public void testTokenCreate() throws StripeException {
    Token token = Token.create(defaultTokenParams);
    assertFalse(token.getUsed());
  }
View Full Code Here

    assertFalse(token.getUsed());
  }

  @Test
  public void testTokenRetrieve() throws StripeException {
    Token createdToken = Token.create(defaultTokenParams);
    Token retrievedToken = Token.retrieve(createdToken.getId());
    assertEquals(createdToken.getId(), retrievedToken.getId());
  }
View Full Code Here

    assertEquals(createdToken.getId(), retrievedToken.getId());
  }

  @Test
  public void testTokenUse() throws StripeException {
    Token createdToken = Token.create(defaultTokenParams);
    Map<String, Object> chargeWithTokenParams = new HashMap<String, Object>();
    chargeWithTokenParams.put("amount", 199);
    chargeWithTokenParams.put("currency", "usd");
    chargeWithTokenParams.put("card", createdToken.getId());
    Charge.create(chargeWithTokenParams);
    Token retrievedToken = Token.retrieve(createdToken.getId());
    assertTrue(retrievedToken.getUsed());
  }
View Full Code Here

    Map<String, Object> creationParams = new HashMap<String, Object>();
    creationParams.put("card", defaultDebitCardParams);
    Card addedCard = createdRecipient.createCard(creationParams);

    Token token = Token.create(defaultDebitTokenParams);
    createdRecipient.createCard(token.getId());

    Recipient updatedRecipient = Recipient.retrieve(createdRecipient.getId());
    assertEquals((Integer) 3, (Integer) updatedRecipient.getCards().getData().size());
    assertEquals(updatedRecipient.getDefaultCard(), originalDefaultCard);
View Full Code Here

    assertFalse(upcomingInvoice.getAttempted());
  }

  @Test
  public void testTokenCreatePerCallAPIKey() throws StripeException {
    Token token = Token.create(defaultTokenParams, Stripe.apiKey);
    assertFalse(token.getUsed());
  }
View Full Code Here

    assertFalse(token.getUsed());
  }

  @Test
  public void testTokenRetrievePerCallAPIKey() throws StripeException {
    Token createdToken = Token.create(defaultTokenParams, Stripe.apiKey);
    Token retrievedToken = Token.retrieve(createdToken.getId(),
        Stripe.apiKey);
    assertEquals(createdToken.getId(), retrievedToken.getId());
  }
View Full Code Here

    assertEquals(createdToken.getId(), retrievedToken.getId());
  }

  @Test
  public void testTokenUsePerCallAPIKey() throws StripeException {
    Token createdToken = Token.create(defaultTokenParams, Stripe.apiKey);
    Map<String, Object> chargeWithTokenParams = new HashMap<String, Object>();
    chargeWithTokenParams.put("amount", 199);
    chargeWithTokenParams.put("currency", "usd");
    chargeWithTokenParams.put("card", createdToken.getId());
    Charge.create(chargeWithTokenParams, Stripe.apiKey);
    Token retrievedToken = Token.retrieve(createdToken.getId(),
        Stripe.apiKey);
    assertTrue(retrievedToken.getUsed());
  }
View Full Code Here

TOP

Related Classes of com.stripe.model.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.