Search in sources :

Example 1 with Transfer

use of com.stripe.model.Transfer in project stripe-java by stripe.

the class TransferTest method testTransferDestinationLoadedCorrectly.

@Test
public void testTransferDestinationLoadedCorrectly() throws StripeException {
    Map<String, Object> transferParams = getTransferParams();
    Transfer created = Transfer.create(transferParams);
    assertEquals(transferParams.get("destination"), created.getDestination());
}
Also used : Transfer(com.stripe.model.Transfer) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 2 with Transfer

use of com.stripe.model.Transfer in project stripe-java by stripe.

the class TransferTest method testTransferCreate.

@Test
public void testTransferCreate() throws StripeException {
    Map<String, Object> transferParams = getTransferParams();
    Transfer createdTransfer = Transfer.create(transferParams);
    assertEquals(transferParams.get("destination"), createdTransfer.getDestination());
}
Also used : Transfer(com.stripe.model.Transfer) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 3 with Transfer

use of com.stripe.model.Transfer in project stripe-java by stripe.

the class TransferTest method testTransferRetrieve.

@Test
public void testTransferRetrieve() throws StripeException {
    Transfer createdTransfer = Transfer.create(getTransferParams());
    Transfer retrievedTransfer = Transfer.retrieve(createdTransfer.getId());
    assertEquals(createdTransfer.getDate(), retrievedTransfer.getDate());
    assertEquals(createdTransfer.getId(), retrievedTransfer.getId());
}
Also used : Transfer(com.stripe.model.Transfer) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 4 with Transfer

use of com.stripe.model.Transfer in project stripe-java by stripe.

the class TransferTest method testTransferCancel.

@Test
public void testTransferCancel() throws StripeException {
    Transfer created = Transfer.create(getTransferParams());
    try {
        // we expect an InvalidRequestException here (caught by JUnit),
        // because in test mode, transfers are automatically sent.
        created.cancel(RequestOptions.getDefault());
        Assert.fail();
    } catch (InvalidRequestException ire) {
    // do nothing
    }
}
Also used : Transfer(com.stripe.model.Transfer) InvalidRequestException(com.stripe.exception.InvalidRequestException) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 5 with Transfer

use of com.stripe.model.Transfer in project stripe-java by stripe.

the class TransferTest method testTransferTransactions.

@Test
public void testTransferTransactions() throws StripeException {
    Map<String, Object> transferParams = getTransferParams();
    Transfer transfer = Transfer.create(transferParams);
    HashMap<String, Object> params = new HashMap<String, Object>();
    TransferTransactionCollection transactions = transfer.transactions(params, supportedRequestOptions);
    // Test that requestOptions and requestParams are the same in returned transactions:
    assertEquals(supportedRequestOptions, transactions.getRequestOptions());
    assertEquals(params, transactions.getRequestParams());
}
Also used : TransferTransactionCollection(com.stripe.model.TransferTransactionCollection) HashMap(java.util.HashMap) Transfer(com.stripe.model.Transfer) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)5 Transfer (com.stripe.model.Transfer)5 Test (org.junit.Test)5 InvalidRequestException (com.stripe.exception.InvalidRequestException)1 TransferTransactionCollection (com.stripe.model.TransferTransactionCollection)1 HashMap (java.util.HashMap)1