Package com.stripe.model

Examples of com.stripe.model.Charge


    assertTrue(captured.getCaptured());
  }

  @Test
  public void testChargePartialRefund() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    Map<String, Object> refundParams = new HashMap<String, Object>();
    final Integer REFUND_AMOUNT = 50;
    refundParams.put("amount", REFUND_AMOUNT);
    Charge refundedCharge = createdCharge.refund(refundParams);
    assertFalse(refundedCharge.getRefunded());
    assertEquals(refundedCharge.getAmountRefunded(), REFUND_AMOUNT);
  }
View Full Code Here


    invalidCardParams.put("address_zip", "94024");
    invalidCardParams.put("address_line1", "42 Foo Street");
    invalidCardParams.put("exp_month", 12);
    invalidCardParams.put("exp_year", 2015);
    invalidChargeParams.put("card", invalidCardParams);
    Charge charge = Charge.create(invalidChargeParams);
    assertEquals(charge.getPaid(), true);
    assertEquals(charge.getCard().getAddressZipCheck(), "fail");
    assertEquals(charge.getCard().getAddressLine1Check(), "pass");
  }
View Full Code Here

    invalidCardParams.put("address_zip", "94024");
    invalidCardParams.put("address_line1", "42 Foo Street");
    invalidCardParams.put("exp_month", 12);
    invalidCardParams.put("exp_year", 2015);
    invalidChargeParams.put("card", invalidCardParams);
    Charge charge = Charge.create(invalidChargeParams);
    assertEquals(charge.getPaid(), true);
    assertEquals(charge.getCard().getAddressZipCheck(), "pass");
    assertEquals(charge.getCard().getAddressLine1Check(), "fail");
  }
View Full Code Here

   *
   * @throws StripeException
   */
  @Test
  public void testPerCallAPIUsage() throws StripeException {
    Charge createdCharge = Charge
        .create(defaultChargeParams, Stripe.apiKey);
    assertFalse(createdCharge.getRefunded());
    try {
      Charge.create(defaultChargeParams, "INVALID_KEY_HERE");
      fail();
    } catch (Exception e) {
    }
View Full Code Here

    }
  }

  @Test
  public void testChargeCreatePerCallAPIKey() throws StripeException {
    Charge createdCharge = Charge
        .create(defaultChargeParams, Stripe.apiKey);
    assertFalse(createdCharge.getRefunded());
  }
View Full Code Here

    assertFalse(createdCharge.getRefunded());
  }

  @Test
  public void testChargeRetrievePerCallAPIKey() throws StripeException {
    Charge createdCharge = Charge
        .create(defaultChargeParams, Stripe.apiKey);
    Charge retrievedCharge = Charge.retrieve(createdCharge.getId(),
        Stripe.apiKey);
    assertEquals(createdCharge.getCreated(), retrievedCharge.getCreated());
    assertEquals(createdCharge.getId(), retrievedCharge.getId());
  }
View Full Code Here

    assertEquals(createdCharge.getId(), retrievedCharge.getId());
  }

  @Test
  public void testChargeRefundPerCallAPIKey() throws StripeException {
    Charge createdCharge = Charge
        .create(defaultChargeParams, Stripe.apiKey);
    Charge refundedCharge = createdCharge.refund(Stripe.apiKey);
    assertTrue(refundedCharge.getRefunded());
  }
View Full Code Here

    assertTrue(refundedCharge.getRefunded());
  }

  @Test
  public void testChargePartialRefundPerCallAPIKey() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    Map<String, Object> refundParams = new HashMap<String, Object>();
    final Integer REFUND_AMOUNT = 50;
    refundParams.put("amount", REFUND_AMOUNT);
    Charge refundedCharge = createdCharge.refund(refundParams,
        Stripe.apiKey);
    assertFalse(refundedCharge.getRefunded());
    assertEquals(refundedCharge.getAmountRefunded(), REFUND_AMOUNT);
  }
View Full Code Here

    testMetadata(customer.createSubscription(getSubscriptionParams()));
  }

  @Test
  public void testRefundMetadata() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    Charge refundedCharge = createdCharge.refund();
    testMetadata(refundedCharge.getRefunds().getData().get(0));
  }
View Full Code Here

TOP

Related Classes of com.stripe.model.Charge

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.