use of com.braintreegateway.TransactionRequest in project camel by apache.
the class TransactionGatewayIntegrationTest method testSubmitForSettlementWithIdAndAmount.
@Test
public void testSubmitForSettlementWithIdAndAmount() throws Exception {
assertNotNull("BraintreeGateway can't be null", this.gateway);
final Result<Transaction> createResult = requestBody("direct://SALE", new TransactionRequest().amount(new BigDecimal("100.00")).paymentMethodNonce("fake-valid-nonce").options().submitForSettlement(false).done(), Result.class);
assertNotNull("sale result", createResult);
assertTrue(createResult.isSuccess());
LOG.info("Transaction done - id={}", createResult.getTarget().getId());
this.transactionIds.add(createResult.getTarget().getId());
final Result<Transaction> result = requestBodyAndHeaders("direct://SUBMITFORSETTLEMENT_WITH_ID_ADN_AMOUNT", null, new BraintreeHeaderBuilder().add("id", createResult.getTarget().getId()).add("amount", new BigDecimal("100.00")).build(), Result.class);
assertNotNull("Submit For Settlement result", result);
LOG.debug("Transaction submitted for settlement - id={}" + result.getTarget().getId());
}
use of com.braintreegateway.TransactionRequest in project camel by apache.
the class TransactionGatewayIntegrationTest method testCloneTransaction.
@Test
public void testCloneTransaction() throws Exception {
assertNotNull("BraintreeGateway can't be null", this.gateway);
final Result<Transaction> createResult = requestBody("direct://SALE", new TransactionRequest().amount(new BigDecimal("100.00")).paymentMethodNonce("fake-valid-nonce").options().submitForSettlement(false).done(), Result.class);
assertNotNull("sale result", createResult);
assertTrue(createResult.isSuccess());
LOG.info("Transaction done - id={}", createResult.getTarget().getId());
this.transactionIds.add(createResult.getTarget().getId());
final Result<Transaction> cloneResult = requestBodyAndHeaders("direct://CLONETRANSACTION", null, new BraintreeHeaderBuilder().add("id", createResult.getTarget().getId()).add("cloneRequest", new TransactionCloneRequest().amount(new BigDecimal("99.00")).options().submitForSettlement(true).done()).build(), Result.class);
assertNotNull("clone result", cloneResult);
assertTrue(cloneResult.isSuccess());
LOG.info("Clone Transaction done - clonedId={}, id={}", createResult.getTarget().getId(), cloneResult.getTarget().getId());
this.transactionIds.add(cloneResult.getTarget().getId());
}
use of com.braintreegateway.TransactionRequest in project camel by apache.
the class TransactionGatewayIntegrationTest method testFind.
@Test
public void testFind() throws Exception {
assertNotNull("BraintreeGateway can't be null", this.gateway);
final Result<Transaction> createResult = requestBody("direct://SALE", new TransactionRequest().amount(new BigDecimal("100.00")).paymentMethodNonce("fake-valid-nonce").options().submitForSettlement(false).done(), Result.class);
assertNotNull("sale result", createResult);
assertTrue(createResult.isSuccess());
LOG.info("Transaction done - id={}", createResult.getTarget().getId());
this.transactionIds.add(createResult.getTarget().getId());
// using String message body for single parameter "id"
final Transaction result = requestBody("direct://FIND", createResult.getTarget().getId());
assertNotNull("find result", result);
LOG.info("Transaction found - id={}", result.getId());
}
Aggregations