use of com.braintreegateway.TransactionCloneRequest 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());
}
Aggregations