You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/01/16 07:03:32 UTC

[camel] branch master updated (dcf0b9a -> 45ebf8e)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from dcf0b9a  FUSE-DOC-1921 added info for XML route definition
     new 3534149  CAMEL-12137: camel-braintree - Added Support for Braintree Auth Configuration and extended some integration tests.
     new 45ebf8e  CAMEL-12137 - Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-braintree/pom.xml                 |  31 ++++
 .../src/main/docs/braintree-component.adoc         |  33 ++--
 .../component/braintree}/AuthenticationType.java   |   4 +-
 .../component/braintree/BraintreeComponent.java    |  22 ++-
 .../BraintreeComponentVerifierExtension.java       |  48 ++++++
 .../braintree/BraintreeConfiguration.java          |  49 ++++--
 .../component/braintree/BraintreeEndpoint.java     |  17 +-
 .../braintree/AbstractBraintreeTestSupport.java    |  90 ++++++++---
 .../TransactionGatewayIntegrationTest.java         | 154 ++++++++++++++----
 .../WebhookNotificationGatewayIntegrationTest.java | 176 +++++++++++++++++++--
 .../src/test/resources/test-options.properties     |   4 +-
 .../BraintreeComponentConfiguration.java           |  14 ++
 12 files changed, 540 insertions(+), 102 deletions(-)
 copy components/{camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce => camel-braintree/src/main/java/org/apache/camel/component/braintree}/AuthenticationType.java (90%)
 create mode 100644 components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].

[camel] 02/02: CAMEL-12137 - Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 45ebf8ef27a0cd716c88a7499746c1f29495cc78
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Jan 16 08:02:10 2018 +0100

    CAMEL-12137 - Fixed CS
---
 .../component/braintree/AuthenticationType.java    | 16 ++++++++
 .../BraintreeComponentVerifierExtension.java       | 20 +++++++++-
 .../braintree/AbstractBraintreeTestSupport.java    | 43 +++++++++++-----------
 .../TransactionGatewayIntegrationTest.java         | 10 +++--
 4 files changed, 63 insertions(+), 26 deletions(-)

diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java
index 19edd08..f03df96 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.camel.component.braintree;
 
 public enum AuthenticationType {
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java
index 37ca6bf..0e4a858 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java
@@ -1,12 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.camel.component.braintree;
 
+import java.util.Map;
+
 import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension;
 import org.apache.camel.component.extension.verifier.OptionsGroup;
 import org.apache.camel.component.extension.verifier.ResultBuilder;
 import org.apache.camel.component.extension.verifier.ResultErrorHelper;
 
-import java.util.Map;
-
 public class BraintreeComponentVerifierExtension extends DefaultComponentVerifierExtension {
 
     BraintreeComponentVerifierExtension() {
diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
index c1b7cb9..837919f 100644
--- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
+++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import com.braintreegateway.BraintreeGateway;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.component.braintree.internal.BraintreeApiCollection;
@@ -91,21 +92,23 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport {
         AuthenticationType configurationType = getAuthenticationType();
         LOG.info(String.format("Test using %s configuration profile", configurationType));
         switch (configurationType) {
-            case PUBLIC_PRIVATE_KEYS:
-                addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT");
-                addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID");
-                addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY");
-                addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY");
-                options.remove("accessToken");
-                options.remove("clientId");
-                break;
-            case ACCESS_TOKEN:
-                addOptionIfMissing(options, "accessToken", "CAMEL_BRAINTREE_ACCESS_TOKEN");
-                options.remove("environment");
-                options.remove("merchantId");
-                options.remove("publicKey");
-                options.remove("privateKey");
-                break;
+        case PUBLIC_PRIVATE_KEYS:
+            addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT");
+            addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID");
+            addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY");
+            addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY");
+            options.remove("accessToken");
+            options.remove("clientId");
+            break;
+        case ACCESS_TOKEN:
+            addOptionIfMissing(options, "accessToken", "CAMEL_BRAINTREE_ACCESS_TOKEN");
+            options.remove("environment");
+            options.remove("merchantId");
+            options.remove("publicKey");
+            options.remove("privateKey");
+            break;
+        default:
+            throw new IllegalArgumentException("Unsupported configuration type");
         }
 
         final BraintreeConfiguration configuration = new BraintreeConfiguration();
@@ -146,19 +149,17 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport {
     }
 
     @SuppressWarnings("unchecked")
-    protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers)
-        throws CamelExecutionException {
-        return (T) template().requestBodyAndHeaders(endpointUri, body, headers);
+    protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException {
+        return (T)template().requestBodyAndHeaders(endpointUri, body, headers);
     }
 
-    protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type)
-        throws CamelExecutionException {
+    protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type) throws CamelExecutionException {
         return template().requestBodyAndHeaders(endpointUri, body, headers, type);
     }
 
     @SuppressWarnings("unchecked")
     protected <T> T requestBody(String endpoint, Object body) throws CamelExecutionException {
-        return (T) template().requestBody(endpoint, body);
+        return (T)template().requestBody(endpoint, body);
     }
 
     protected <T> T requestBody(String endpoint, Object body, Class<T> type) throws CamelExecutionException {
diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
index 8fec666..01f5fbb 100644
--- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
+++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
@@ -22,12 +22,16 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import com.braintreegateway.*;
+import com.braintreegateway.BraintreeGateway;
+import com.braintreegateway.Result;
+import com.braintreegateway.Transaction;
+import com.braintreegateway.TransactionCloneRequest;
+import com.braintreegateway.TransactionRefundRequest;
+import com.braintreegateway.TransactionRequest;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.braintree.internal.BraintreeApiCollection;
 import org.apache.camel.component.braintree.internal.TransactionGatewayApiMethod;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.

[camel] 01/02: CAMEL-12137: camel-braintree - Added Support for Braintree Auth Configuration and extended some integration tests.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 35341491fc7ca26f552d1c6c4900f437f7e2079e
Author: Russ Johnson <ru...@magento.com>
AuthorDate: Mon Jan 8 14:35:25 2018 +0100

    CAMEL-12137: camel-braintree - Added Support for Braintree Auth Configuration and extended some integration tests.
---
 components/camel-braintree/pom.xml                 |  31 ++++
 .../src/main/docs/braintree-component.adoc         |  33 ++--
 .../component/braintree/AuthenticationType.java    |   5 +
 .../component/braintree/BraintreeComponent.java    |  22 ++-
 .../BraintreeComponentVerifierExtension.java       |  32 ++++
 .../braintree/BraintreeConfiguration.java          |  49 ++++--
 .../component/braintree/BraintreeEndpoint.java     |  17 +-
 .../braintree/AbstractBraintreeTestSupport.java    |  77 +++++++--
 .../TransactionGatewayIntegrationTest.java         | 160 ++++++++++++++-----
 .../WebhookNotificationGatewayIntegrationTest.java | 176 +++++++++++++++++++--
 .../src/test/resources/test-options.properties     |   4 +-
 .../BraintreeComponentConfiguration.java           |  14 ++
 12 files changed, 521 insertions(+), 99 deletions(-)

diff --git a/components/camel-braintree/pom.xml b/components/camel-braintree/pom.xml
index 1637634..fb3957a 100644
--- a/components/camel-braintree/pom.xml
+++ b/components/camel-braintree/pom.xml
@@ -327,6 +327,37 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
+              <systemPropertyVariables>
+                <braintreeAuthenticationType>PUBLIC_PRIVATE_KEYS</braintreeAuthenticationType>
+              </systemPropertyVariables>
+              <childDelegation>false</childDelegation>
+              <useFile>true</useFile>
+              <forkCount>1</forkCount>
+              <reuseForks>true</reuseForks>
+              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+              <includes>
+                <include>**/*Test.java</include>
+              </includes>
+              <excludes>
+                <exclude>**/*XXXTest.java</exclude>
+              </excludes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+    <profile>
+      <id>braintree-access-token-test</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <systemPropertyVariables>
+                <braintreeAuthenticationType>ACCESS_TOKEN</braintreeAuthenticationType>
+              </systemPropertyVariables>
               <childDelegation>false</childDelegation>
               <useFile>true</useFile>
               <forkCount>1</forkCount>
diff --git a/components/camel-braintree/src/main/docs/braintree-component.adoc b/components/camel-braintree/src/main/docs/braintree-component.adoc
index ab55a9d..4de1634 100644
--- a/components/camel-braintree/src/main/docs/braintree-component.adoc
+++ b/components/camel-braintree/src/main/docs/braintree-component.adoc
@@ -69,19 +69,20 @@ with the following path and query parameters:
 | *methodName* | What sub operation to use for the selected operation |  | String
 |===
 
-==== Query Parameters (13 parameters):
+==== Query Parameters (14 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *environment* (common) | *Required* The environment Either SANDBOX or PRODUCTION |  | String
+| *environment* (common) | The environment Either SANDBOX or PRODUCTION |  | String
 | *inBody* (common) | Sets the name of a parameter to be passed in the exchange In Body |  | String
-| *merchantId* (common) | *Required* The merchant id provided by Braintree. |  | String
-| *privateKey* (common) | *Required* The private key provided by Braintree. |  | String
-| *publicKey* (common) | *Required* The public key provided by Braintree. |  | String
+| *merchantId* (common) | The merchant id provided by Braintree. |  | String
+| *privateKey* (common) | The private key provided by Braintree. |  | String
+| *publicKey* (common) | The public key provided by Braintree. |  | String
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN or ERROR level and ignored. | false | boolean
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
+| *accessToken* (advanced) | The access token granted by a merchant to another in order to process transactions on their behalf. Used in place of environment merchant id public key and private key fields. |  | String
 | *httpReadTimeout* (advanced) | Set read timeout for http calls. |  | Integer
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *httpLogLevel* (logging) | Set logging level for http calls see java.util.logging.Level |  | String
@@ -131,16 +132,20 @@ type *org.apache.camel.component.braintree.BraintreeConfiguration*.
 [cols="<,<,<",options="header",]
 |=======================================================================
 |Option |Type |Description
-|environment |String |value that specifies where requests should be
+|environment |String |Value that specifies where requests should be
 directed – sandbox or production
 
-|merchantId |String |a unique identifier for your gateway account, which
+|merchantId |String |A unique identifier for your gateway account, which
 is different than your merchant account ID
 
-|publicKey |String |user-specific public identifier
+|publicKey |String |User-specific public identifier
 
-|privateKey |String |user-specific secure identifier that should not be
+|privateKey |String |User-specific secure identifier that should not be
 shared – even with us!
+
+|accessToken |String |Token granted to a merchant using Braintree Auth
+allowing them to process transactions on another's behalf. Used in place
+of the environment, merchantId, publicKey and privateKey options.
 |=======================================================================
 
 All the options above are provided by Braintree Payments
@@ -366,6 +371,9 @@ braintree://merchantAccount/endpoint?[options]
 |create |  |request
 |com.braintreegateway.Result<com.braintreegateway.MerchantAccount>
 
+|createForCurrency |  |currencyRequest
+|com.braintreegateway.Result<com.braintreegateway.MerchantAccount>
+
 |find |  |id |com.braintreegateway.MerchantAccount
 
 |update |  |id, request
@@ -380,6 +388,7 @@ URI Options for _merchantAccount_
 |Name |Type
 |id |String
 |request |com.braintreegateway.MerchantAccountRequest
+|currencyRequest |com.braintreegateway.MerchantAccountCreateForCurrencyRequest
 |====================================================
 
 #### Endpoint prefix _paymentMethod_
@@ -400,7 +409,7 @@ braintree://paymentMethod/endpoint?[options]
 |create |  |request
 |com.braintreegateway.Result<com.braintreegateway.PaymentMethod>
 
-|delete |  |token
+|delete |  |token, deleteRequest
 |com.braintreegateway.Result<com.braintreegateway.PaymentMethod>
 
 |find |  |token |com.braintreegateway.PaymentMethod
@@ -417,6 +426,7 @@ URI Options for _paymentMethod_
 |Name |Type
 |token |String
 |request |com.braintreegateway.PaymentMethodRequest
+|deleteRequest |com.braintreegateway.PaymentMethodDeleteRequest
 |==================================================
 
 #### Endpoint prefix _paymentMethodNonce_
@@ -583,7 +593,7 @@ braintree://transaction/endpoint?[options]
 |releaseFromEscrow |  |id
 |com.braintreegateway.Result<com.braintreegateway.Transaction>
 
-|refund |  |id, amount
+|refund |  |id, amount, refundRequest
 |com.braintreegateway.Result<com.braintreegateway.Transaction>
 
 |sale |  |request
@@ -611,6 +621,7 @@ URI Options for _transaction_
 |id |String
 |request |com.braintreegateway.TransactionCloneRequest
 |cloneRequest |com.braintreegateway.TransactionCloneRequest
+|refundRequest |com.braintreegateway.TransactionRefundRequest
 |amount |BigDecimal
 |query |com.braintreegateway.TransactionSearchRequest
 |==========================================================
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java
new file mode 100644
index 0000000..19edd08
--- /dev/null
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java
@@ -0,0 +1,5 @@
+package org.apache.camel.component.braintree;
+
+public enum AuthenticationType {
+    PUBLIC_PRIVATE_KEYS, ACCESS_TOKEN
+}
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponent.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponent.java
index 8918771..c50d7a7 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponent.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponent.java
@@ -51,7 +51,7 @@ public class BraintreeComponent extends AbstractApiComponent<BraintreeApiName, B
     protected Endpoint createEndpoint(String uri, String methodName, BraintreeApiName apiName, BraintreeConfiguration endpointConfiguration) {
         endpointConfiguration.setApiName(apiName);
         endpointConfiguration.setMethodName(methodName);
-        return new BraintreeEndpoint(uri, this, apiName, methodName, endpointConfiguration, getGateway(endpointConfiguration));
+        return new BraintreeEndpoint(uri, this, apiName, methodName, endpointConfiguration);
     }
 
     /**
@@ -67,13 +67,21 @@ public class BraintreeComponent extends AbstractApiComponent<BraintreeApiName, B
         return super.getConfiguration();
     }
 
-    private synchronized BraintreeGateway getGateway(BraintreeConfiguration configuration) {
-        BraintreeGateway gateway = gateways.get(configuration.getMerchantId());
-        if (gateway == null) {
-            //TODO: review the key used to track gateways
-            gateways.put(configuration.getMerchantId(), gateway = configuration.newBraintreeGateway());
+    public synchronized BraintreeGateway getGateway(BraintreeConfiguration configuration) {
+        BraintreeGateway gateway;
+        if (configuration.getAccessToken() != null) {
+            gateway = gateways.get(configuration.getAccessToken());
+            if (gateway == null) {
+                gateway = configuration.newBraintreeGateway();
+                gateways.put(configuration.getAccessToken(), gateway);
+            }
+        } else {
+            gateway = gateways.get(configuration.getMerchantId());
+            if (gateway == null) {
+                gateway = configuration.newBraintreeGateway();
+                gateways.put(configuration.getMerchantId(), gateway);
+            }
         }
-
         return gateway;
     }
 }
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java
new file mode 100644
index 0000000..37ca6bf
--- /dev/null
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java
@@ -0,0 +1,32 @@
+package org.apache.camel.component.braintree;
+
+import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension;
+import org.apache.camel.component.extension.verifier.OptionsGroup;
+import org.apache.camel.component.extension.verifier.ResultBuilder;
+import org.apache.camel.component.extension.verifier.ResultErrorHelper;
+
+import java.util.Map;
+
+public class BraintreeComponentVerifierExtension extends DefaultComponentVerifierExtension {
+
+    BraintreeComponentVerifierExtension() {
+        super("braintree");
+    }
+
+    @Override
+    protected Result verifyParameters(Map<String, Object> parameters) {
+        // Validate mandatory component options, needed to be done here as these
+        // options are not properly marked as mandatory in the catalog.
+        ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS)
+                .errors(ResultErrorHelper.requiresAny(parameters,
+                        OptionsGroup.withName(AuthenticationType.PUBLIC_PRIVATE_KEYS)
+                                .options("environment", "merchantId", "publicKey", "privateKey", "!accessToken"),
+                        OptionsGroup.withName(AuthenticationType.ACCESS_TOKEN)
+                                .options("!environment", "!merchantId", "!publicKey", "!privateKey", "accessToken")));
+
+        // Validate using the catalog
+        super.verifyParametersAgainstCatalog(builder, parameters);
+
+        return builder.build();
+    }
+}
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
index 8106384..420a362 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeConfiguration.java
@@ -39,6 +39,7 @@ public class BraintreeConfiguration {
     private static final String MERCHANT_ID = "merchant_id";
     private static final String PUBLIC_KEY  = "public_key";
     private static final String PRIVATE_KEY = "private_key";
+    private static final String ACCESS_TOKEN = "access_token";
 
     @UriPath
     @Metadata(required = "true")
@@ -47,22 +48,22 @@ public class BraintreeConfiguration {
     private String methodName;
 
     @UriParam
-    @Metadata(required = "true")
     private String environment;
 
     @UriParam
-    @Metadata(required = "true")
     private String merchantId;
 
     @UriParam
-    @Metadata(required = "true")
     private String publicKey;
 
     @UriParam
-    @Metadata(required = "true")
     private String privateKey;
 
     @UriParam
+    @Metadata(label = "advanced")
+    private String accessToken;
+
+    @UriParam
     @Metadata(label = "proxy")
     private String proxyHost;
 
@@ -104,7 +105,7 @@ public class BraintreeConfiguration {
     }
 
     public String getEnvironment() {
-        return ObjectHelper.notNull(environment, ENVIRONMENT);
+        return environment;
     }
 
     /**
@@ -115,7 +116,7 @@ public class BraintreeConfiguration {
     }
 
     public String getMerchantId() {
-        return ObjectHelper.notNull(merchantId, MERCHANT_ID);
+        return merchantId;
     }
 
     /**
@@ -126,7 +127,7 @@ public class BraintreeConfiguration {
     }
 
     public String getPublicKey() {
-        return ObjectHelper.notNull(publicKey, PUBLIC_KEY);
+        return publicKey;
     }
 
     /**
@@ -137,7 +138,7 @@ public class BraintreeConfiguration {
     }
 
     public String getPrivateKey() {
-        return ObjectHelper.notNull(privateKey, PRIVATE_KEY);
+        return privateKey;
     }
 
     /**
@@ -147,6 +148,18 @@ public class BraintreeConfiguration {
         this.privateKey = privateKey;
     }
 
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    /**
+     * The access token granted by a merchant to another in order to process transactions on their behalf.
+     * Used in place of environment, merchant id, public key and private key fields.
+     */
+    public void setAccessToken(String accessToken) {
+        this.accessToken = accessToken;
+    }
+
     public String getProxyHost() {
         return proxyHost;
     }
@@ -232,11 +245,21 @@ public class BraintreeConfiguration {
      * Construct a BraintreeGateway from configuration
      */
     synchronized BraintreeGateway newBraintreeGateway() {
-        final BraintreeGateway gateway = new BraintreeGateway(
-            getBraintreeEnvironment(),
-            getMerchantId(),
-            getPublicKey(),
-            getPrivateKey());
+        final BraintreeGateway gateway;
+
+        if (accessToken != null) {
+            gateway = new BraintreeGateway(
+                    accessToken
+            );
+            setEnvironment(gateway.getConfiguration().getEnvironment().getEnvironmentName());
+        } else {
+            gateway = new BraintreeGateway(
+                    getBraintreeEnvironment(),
+                    getMerchantId(),
+                    getPublicKey(),
+                    getPrivateKey()
+            );
+        }
 
         if (ObjectHelper.isNotEmpty(proxyHost) && ObjectHelper.isNotEmpty(proxyPort)) {
             gateway.setProxy(proxyHost, proxyPort);
diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
index 5b79921..f2a9d04 100644
--- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
+++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeEndpoint.java
@@ -44,13 +44,16 @@ public class BraintreeEndpoint extends AbstractApiEndpoint<BraintreeApiName, Bra
     private final BraintreeConfiguration configuration;
 
     private Object apiProxy;
-    private final BraintreeGateway gateway;
 
-    public BraintreeEndpoint(String uri, BraintreeComponent component,
-                         BraintreeApiName apiName, String methodName, BraintreeConfiguration configuration, BraintreeGateway gateway) {
+    public BraintreeEndpoint(
+            String uri,
+            BraintreeComponent component,
+            BraintreeApiName apiName,
+            String methodName,
+            BraintreeConfiguration configuration
+    ) {
         super(uri, component, apiName, methodName, BraintreeApiCollection.getCollection().getHelper(apiName), configuration);
         this.configuration = configuration;
-        this.gateway = gateway;
     }
 
     @Override
@@ -67,6 +70,11 @@ public class BraintreeEndpoint extends AbstractApiEndpoint<BraintreeApiName, Bra
     }
 
     @Override
+    public BraintreeComponent getComponent() {
+        return (BraintreeComponent) super.getComponent();
+    }
+
+    @Override
     protected ApiMethodPropertiesHelper<BraintreeConfiguration> getPropertiesHelper() {
         return BraintreePropertiesHelper.getHelper();
     }
@@ -78,6 +86,7 @@ public class BraintreeEndpoint extends AbstractApiEndpoint<BraintreeApiName, Bra
 
     @Override
     protected void afterConfigureProperties() {
+        BraintreeGateway gateway = getComponent().getGateway(this.configuration);
         try {
             Method method = gateway.getClass().getMethod(apiName.getName());
             if (method != null) {
diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
index 2297b79..c1b7cb9 100644
--- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
+++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java
@@ -33,14 +33,19 @@ import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.component.ApiMethod;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Abstract base class for Braintree Integration tests generated by Camel API component maven plugin.
  */
 public class AbstractBraintreeTestSupport extends CamelTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractBraintreeTestSupport.class);
 
     private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
 
+    private AuthenticationType authenticationType;
+
     private BraintreeGateway gateway;
 
     protected AbstractBraintreeTestSupport() {
@@ -52,7 +57,25 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport {
 
         final CamelContext context = super.createCamelContext();
 
-        // read Braintree component configuration from TEST_OPTIONS_PROPERTIES
+        // add BraintreeComponent to Camel context
+        final BraintreeComponent component = new BraintreeComponent(context);
+        component.setConfiguration(buildBraintreeConfiguration());
+        context.addComponent("braintree", component);
+
+        return context;
+    }
+
+    protected void addOptionIfMissing(Map<String, Object> options, String name, String envName) {
+        if (!options.containsKey(name)) {
+            String value = System.getenv(envName);
+            if (ObjectHelper.isNotEmpty(value)) {
+                options.put(name, value);
+            }
+        }
+    }
+
+    protected BraintreeConfiguration buildBraintreeConfiguration() throws Exception {
+
         final Properties properties = new Properties();
         try {
             properties.load(getClass().getResourceAsStream(TEST_OPTIONS_PROPERTIES));
@@ -65,35 +88,59 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport {
             options.put(entry.getKey().toString(), entry.getValue());
         }
 
-        addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT");
-        addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID");
-        addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY");
-        addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY");
+        AuthenticationType configurationType = getAuthenticationType();
+        LOG.info(String.format("Test using %s configuration profile", configurationType));
+        switch (configurationType) {
+            case PUBLIC_PRIVATE_KEYS:
+                addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT");
+                addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID");
+                addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY");
+                addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY");
+                options.remove("accessToken");
+                options.remove("clientId");
+                break;
+            case ACCESS_TOKEN:
+                addOptionIfMissing(options, "accessToken", "CAMEL_BRAINTREE_ACCESS_TOKEN");
+                options.remove("environment");
+                options.remove("merchantId");
+                options.remove("publicKey");
+                options.remove("privateKey");
+                break;
+        }
 
         final BraintreeConfiguration configuration = new BraintreeConfiguration();
         configuration.setHttpLogLevel(BraintreeLogHandler.DEFAULT_LOGGER_VERSION);
         configuration.setHttpLogName(BraintreeLogHandler.DEFAULT_LOGGER_NAME);
         IntrospectionSupport.setProperties(configuration, options);
 
-        // add BraintreeComponent to Camel context
-        final BraintreeComponent component = new BraintreeComponent(context);
-        component.setConfiguration(configuration);
-        context.addComponent("braintree", component);
+        return configuration;
+    }
 
-        return context;
+    protected AuthenticationType getAuthenticationType() {
+        if (authenticationType == null) {
+            authenticationType = parseAuthenticationType();
+        }
+        return authenticationType;
     }
 
-    protected void addOptionIfMissing(Map<String, Object> options, String name, String envName) {
-        if (!options.containsKey(name)) {
-            String value = System.getenv(envName);
-            if (ObjectHelper.isNotEmpty(value)) {
-                options.put(name, value);
+    protected boolean checkAuthenticationType(AuthenticationType authenticationType) {
+        return getAuthenticationType().equals(authenticationType);
+    }
+
+    private AuthenticationType parseAuthenticationType() {
+        String authenticationTypeString = System.getProperty("braintreeAuthenticationType");
+        if (authenticationTypeString != null) {
+            AuthenticationType authenticationType = AuthenticationType.valueOf(authenticationTypeString);
+            if (authenticationType != null) {
+                return authenticationType;
             }
         }
+        return AuthenticationType.PUBLIC_PRIVATE_KEYS;
     }
 
     @Override
     public boolean isCreateCamelContextPerClass() {
+
         // only create the context once for this class
         return false;
     }
diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
index fce8f93..8fec666 100644
--- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
+++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java
@@ -22,14 +22,12 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import com.braintreegateway.BraintreeGateway;
-import com.braintreegateway.Result;
-import com.braintreegateway.Transaction;
-import com.braintreegateway.TransactionCloneRequest;
-import com.braintreegateway.TransactionRequest;
+import com.braintreegateway.*;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.braintree.internal.BraintreeApiCollection;
 import org.apache.camel.component.braintree.internal.TransactionGatewayApiMethod;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -63,9 +61,8 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp
             for (String token : this.transactionIds) {
                 // TODO: cleanup
             }
-
-            this.transactionIds.clear();
         }
+        this.transactionIds.clear();
     }
 
     // *************************************************************************
@@ -259,6 +256,120 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp
         LOG.debug("Transaction submitted for settlement - id={}" + result.getTarget().getId());
     }
 
+    @Test
+    public void testRefund() 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(true)
+                        .done(),
+                Result.class
+        );
+
+        assertNotNull("sale result", createResult);
+        assertTrue(createResult.isSuccess());
+
+        String createId = createResult.getTarget().getId();
+
+        final Result<Transaction> settleResult = this.gateway.testing().settle(createId);
+        assertNotNull("settle result", settleResult);
+        assertTrue(settleResult.isSuccess());
+
+        final Result<Transaction> result = requestBody(
+                "direct://REFUND_WITH_ID",
+                createId,
+                Result.class
+        );
+
+        assertNotNull("Request Refund result", result);
+        assertTrue(result.isSuccess());
+        LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId));
+    }
+
+    @Test
+    public void testRefundWithAmount() 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(true)
+                        .done(),
+                Result.class
+        );
+
+        assertNotNull("sale result", createResult);
+        assertTrue(createResult.isSuccess());
+
+        String createId = createResult.getTarget().getId();
+
+        final Result<Transaction> settleResult = this.gateway.testing().settle(createId);
+        assertNotNull("settle result", settleResult);
+        assertTrue(settleResult.isSuccess());
+
+        final Result<Transaction> result = requestBodyAndHeaders(
+                "direct://REFUND",
+                null,
+                new BraintreeHeaderBuilder()
+                        .add("id", createId)
+                        .add("amount", new BigDecimal("99.00"))
+                        .build(),
+                Result.class
+        );
+
+        assertNotNull("Request Refund result", result);
+        assertTrue(result.isSuccess());
+        LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId));
+    }
+
+    @Test
+    public void testRefundWithRequest() 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(true)
+                        .done(),
+                Result.class
+        );
+
+        assertNotNull("sale result", createResult);
+        assertTrue(createResult.isSuccess());
+
+        String createId = createResult.getTarget().getId();
+
+        final Result<Transaction> settleResult = this.gateway.testing().settle(createId);
+        assertNotNull("settle result", settleResult);
+        assertTrue(settleResult.isSuccess());
+
+        final Result<Transaction> result = requestBodyAndHeaders(
+                "direct://REFUND",
+                null,
+                new BraintreeHeaderBuilder()
+                        .add("id", createId)
+                        .add("refundRequest", new TransactionRefundRequest()
+                                .amount(new BigDecimal("100.00")))
+                        .build(),
+                Result.class
+        );
+
+        assertNotNull("Request Refund result", result);
+        assertTrue(result.isSuccess());
+        LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId));
+    }
+
     // *************************************************************************
     // Auto generated tests
     // *************************************************************************
@@ -296,33 +407,6 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp
         LOG.debug("holdInEscrow: " + result);
     }
 
-    // TODO provide parameter values for refund
-    @Ignore
-    @Test
-    public void testRefund() throws Exception {
-        // using String message body for single parameter "id"
-        final com.braintreegateway.Result result = requestBody("direct://REFUND", null);
-
-        assertNotNull("refund result", result);
-        LOG.debug("refund: " + result);
-    }
-
-    // TODO provide parameter values for refund
-    @Ignore
-    @Test
-    public void testRefundWithAmount() throws Exception {
-        final Map<String, Object> headers = new HashMap<String, Object>();
-        // parameter type is String
-        headers.put("CamelBraintree.id", null);
-        // parameter type is java.math.BigDecimal
-        headers.put("CamelBraintree.amount", null);
-
-        final com.braintreegateway.Result result = requestBodyAndHeaders("direct://REFUND_1", null, headers);
-
-        assertNotNull("refund result", result);
-        LOG.debug("refund: " + result);
-    }
-
     // TODO provide parameter values for releaseFromEscrow
     @Ignore
     @Test
@@ -397,10 +481,10 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp
                     .to("braintree://" + PATH_PREFIX + "/holdInEscrow?inBody=id");
                 // test route for refund
                 from("direct://REFUND")
-                    .to("braintree://" + PATH_PREFIX + "/refund?inBody=id");
-                // test route for refund
-                from("direct://REFUND_1")
                     .to("braintree://" + PATH_PREFIX + "/refund");
+                // test route for refund
+                from("direct://REFUND_WITH_ID")
+                        .to("braintree://" + PATH_PREFIX + "/refund?inBody=id");
                 // test route for releaseFromEscrow
                 from("direct://RELEASEFROMESCROW")
                     .to("braintree://" + PATH_PREFIX + "/releaseFromEscrow?inBody=id");
@@ -409,7 +493,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp
                     .to("braintree://" + PATH_PREFIX + "/sale?inBody=request");
                 // test route for search
                 from("direct://SEARCH")
-                    .to("braintree://" + PATH_PREFIX + "/search?inBody=query");
+                        .to("braintree://" + PATH_PREFIX + "/search?inBody=query");
                 // test route for submitForPartialSettlement
                 from("direct://SUBMITFORPARTIALSETTLEMENT")
                     .to("braintree://" + PATH_PREFIX + "/submitForPartialSettlement");
diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java
index 3f822e0..37c2df4 100644
--- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java
+++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java
@@ -16,37 +16,193 @@
  */
 package org.apache.camel.component.braintree;
 
+import java.text.SimpleDateFormat;
 import java.util.HashMap;
 import java.util.Map;
 
 import com.braintreegateway.BraintreeGateway;
+import com.braintreegateway.ConnectedMerchantPayPalStatusChanged;
+import com.braintreegateway.ConnectedMerchantStatusTransitioned;
 import com.braintreegateway.WebhookNotification;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.braintree.internal.BraintreeApiCollection;
 import org.apache.camel.component.braintree.internal.BraintreeConstants;
 import org.apache.camel.component.braintree.internal.WebhookNotificationGatewayApiMethod;
+import org.junit.Assume;
+import org.junit.Before;
 import org.junit.Test;
 
 public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintreeTestSupport {
     private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(WebhookNotificationGatewayApiMethod.class).getName();
 
+    @Before
+    public void checkAuthenticationType() {
+        Assume.assumeTrue(checkAuthenticationType(AuthenticationType.PUBLIC_PRIVATE_KEYS));
+    }
+
     @Test
-    public void testParse() throws Exception {
-        final BraintreeGateway gateway = getGateway();
+    public void testParseSubscription() throws Exception {
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_CANCELED);
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_CHARGED_SUCCESSFULLY);
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_CHARGED_UNSUCCESSFULLY);
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_TRIAL_ENDED);
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_WENT_ACTIVE);
+        runParseSubscriptionTest(WebhookNotification.Kind.SUBSCRIPTION_WENT_PAST_DUE);
+    }
+
+    private void runParseSubscriptionTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getSubscription().getId());
+    }
 
-        Map<String, String> notification = gateway.webhookTesting().sampleNotification(
-            WebhookNotification.Kind.SUBSCRIPTION_WENT_PAST_DUE,
-            "my_id"
+    @Test
+    public void testParseMerchantAccount() throws Exception {
+        runParseMerchantAccountTest(WebhookNotification.Kind.SUB_MERCHANT_ACCOUNT_APPROVED);
+        runParseMerchantAccountTest(WebhookNotification.Kind.SUB_MERCHANT_ACCOUNT_DECLINED);
+    }
+
+    private void runParseMerchantAccountTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getMerchantAccount().getId());
+    }
+
+    @Test
+    public void testParseTransaction() throws Exception {
+        runParseTransactionTest(WebhookNotification.Kind.TRANSACTION_DISBURSED);
+        runParseTransactionTest(WebhookNotification.Kind.TRANSACTION_SETTLED);
+        runParseTransactionTest(WebhookNotification.Kind.TRANSACTION_SETTLEMENT_DECLINED);
+    }
+
+    private void runParseTransactionTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getTransaction().getId());
+    }
+
+    @Test
+    public void testParseDisbursement() throws Exception {
+        runParseDisbursementTest(WebhookNotification.Kind.DISBURSEMENT);
+        runParseDisbursementTest(WebhookNotification.Kind.DISBURSEMENT_EXCEPTION);
+    }
+
+    private void runParseDisbursementTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getDisbursement().getId());
+    }
+
+    @Test
+    public void testParseDispute() throws Exception {
+        runParseDisputeTest(WebhookNotification.Kind.DISPUTE_OPENED);
+        runParseDisputeTest(WebhookNotification.Kind.DISPUTE_LOST);
+        runParseDisputeTest(WebhookNotification.Kind.DISPUTE_WON);
+    }
+
+    private void runParseDisputeTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getDispute().getId());
+    }
+
+    @Test
+    public void testParsePartnerMerchant() throws Exception {
+        runParsePartnerMerchantTest(WebhookNotification.Kind.PARTNER_MERCHANT_CONNECTED);
+        runParsePartnerMerchantTest(WebhookNotification.Kind.PARTNER_MERCHANT_DISCONNECTED);
+        runParsePartnerMerchantTest(WebhookNotification.Kind.PARTNER_MERCHANT_DECLINED);
+    }
+
+    private void runParsePartnerMerchantTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "merchant_public_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("abc123", result.getPartnerMerchant().getPartnerMerchantId());
+    }
+
+    @Test
+    public void testParseConnectedMerchantStatusTransitioned() throws Exception {
+        final WebhookNotification result = sendSampleNotification(
+                WebhookNotification.Kind.CONNECTED_MERCHANT_STATUS_TRANSITIONED,
+                "my_merchant_public_id"
         );
 
-        final Map<String, Object> headers = new HashMap<>();
-        headers.put(BraintreeConstants.PROPERTY_PREFIX + "signature", notification.get("bt_signature"));
-        headers.put(BraintreeConstants.PROPERTY_PREFIX + "payload", notification.get("bt_payload"));
+        assertNotNull("parse result", result);
+        assertEquals(WebhookNotification.Kind.CONNECTED_MERCHANT_STATUS_TRANSITIONED, result.getKind());
+
+        ConnectedMerchantStatusTransitioned connectedMerchantStatusTransitioned = result.getConnectedMerchantStatusTransitioned();
+        assertEquals("my_merchant_public_id", connectedMerchantStatusTransitioned.getMerchantPublicId());
+        assertEquals("oauth_application_client_id", connectedMerchantStatusTransitioned.getOAuthApplicationClientId());
+        assertEquals("new_status", connectedMerchantStatusTransitioned.getStatus());
+    }
+
+    @Test
+    public void testParseConnectedMerchantPayPalStatusChanged() throws Exception {
+        final WebhookNotification result = sendSampleNotification(
+                WebhookNotification.Kind.CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED,
+                "my_merchant_public_id"
+        );
 
-        final WebhookNotification result = requestBodyAndHeaders("direct://PARSE", null, headers);
+        assertNotNull("parse result", result);
+        assertEquals(WebhookNotification.Kind.CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED, result.getKind());
+
+        ConnectedMerchantPayPalStatusChanged connectedMerchantPayPalStatusChanged = result.getConnectedMerchantPayPalStatusChanged();
+        assertEquals("my_merchant_public_id", connectedMerchantPayPalStatusChanged.getMerchantPublicId());
+        assertEquals("oauth_application_client_id", connectedMerchantPayPalStatusChanged.getOAuthApplicationClientId());
+        assertEquals("link", connectedMerchantPayPalStatusChanged.getAction());
+    }
 
+    @Test
+    public void testParseAccountUpdater() throws Exception {
+        runParsePAccountUpdaterTest(WebhookNotification.Kind.ACCOUNT_UPDATER_DAILY_REPORT);
+    }
+
+    private void runParsePAccountUpdaterTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
         assertNotNull("parse result", result);
-        assertEquals("my_id", result.getSubscription().getId());
+        assertEquals(kind, result.getKind());
+        assertEquals("link-to-csv-report", result.getAccountUpdaterDailyReport().getReportUrl());
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        assertEquals("2016-01-14", sdf.format(result.getAccountUpdaterDailyReport().getReportDate().getTime()));
+    }
+
+    @Test
+    public void testParseIdealPayment() throws Exception {
+        runParseIdealPaymentTest(WebhookNotification.Kind.IDEAL_PAYMENT_COMPLETE);
+        runParseIdealPaymentTest(WebhookNotification.Kind.IDEAL_PAYMENT_FAILED);
+    }
+
+    private void runParseIdealPaymentTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("my_id", result.getIdealPayment().getId());
+    }
+
+    @Test
+    public void testParsePaymentInstrument() throws Exception {
+        runParsePaymentInstrumentTest(WebhookNotification.Kind.GRANTED_PAYMENT_INSTRUMENT_UPDATE);
+    }
+
+    private void runParsePaymentInstrumentTest(WebhookNotification.Kind kind) throws Exception {
+        final WebhookNotification result = sendSampleNotification(kind, "my_id");
+        assertNotNull("parse result", result);
+        assertEquals(kind, result.getKind());
+        assertEquals("abc123z", result.getGrantedPaymentInstrumentUpdate().getToken());
+    }
+
+    private WebhookNotification sendSampleNotification(WebhookNotification.Kind kind, String id) {
+        final BraintreeGateway gateway = getGateway();
+        Map<String, String> notification = gateway.webhookTesting().sampleNotification(kind, id);
+        final Map<String, Object> headers = new HashMap<>();
+        headers.put(BraintreeConstants.PROPERTY_PREFIX + "signature", notification.get("bt_signature"));
+        headers.put(BraintreeConstants.PROPERTY_PREFIX + "payload", notification.get("bt_payload"));
+        return requestBodyAndHeaders("direct://PARSE", null, headers);
     }
 
     @Override
diff --git a/components/camel-braintree/src/test/resources/test-options.properties b/components/camel-braintree/src/test/resources/test-options.properties
index 8c15fbb..406437d 100644
--- a/components/camel-braintree/src/test/resources/test-options.properties
+++ b/components/camel-braintree/src/test/resources/test-options.properties
@@ -18,4 +18,6 @@
 #environment = SANDBOX
 #merchantId  = 
 #publicKey   = 
-#privateKey  = 
+#privateKey  =
+#accessToken =
+
diff --git a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java
index 2570d74..780ba0b 100644
--- a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java
@@ -90,6 +90,12 @@ public class BraintreeComponentConfiguration
          */
         private String privateKey;
         /**
+         * The access token granted by a merchant to another in order to process
+         * transactions on their behalf. Used in place of environment, merchant
+         * id, public key and private key fields.
+         */
+        private String accessToken;
+        /**
          * The proxy host
          */
         private String proxyHost;
@@ -158,6 +164,14 @@ public class BraintreeComponentConfiguration
             this.privateKey = privateKey;
         }
 
+        public String getAccessToken() {
+            return accessToken;
+        }
+
+        public void setAccessToken(String accessToken) {
+            this.accessToken = accessToken;
+        }
+
         public String getProxyHost() {
             return proxyHost;
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.