From d2f419faab8905b7809370d03345abd110fb83a9 Mon Sep 17 00:00:00 2001 From: scannillo Date: Thu, 25 Jun 2020 06:29:55 -0500 Subject: [PATCH] Change /client-token to /id-token; add entry_point to id-token request --- README.md | 2 +- .../braintreep4psamplemerchant/PayPalTokenClient.java | 1 + .../braintree/braintreep4psamplemerchant/RestController.java | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 67fdff8..494e78f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository represents a sample merchant server for a merchant integrating w ## Build and run locally To build and run locally, use the command: `./mvnw spring-boot:run -Dspring-boot.run.profiles=local`. Running this command will install Maven and all necessary dependencies. -If everything worked, you should be able to hit `http://localhost:5000/client-token?countryCode=US`. +If everything worked, you should be able to hit `http://localhost:5000/id-token?countryCode=US`. ## Switching Merchant Account/ Authentication diff --git a/src/main/java/com/braintree/braintreep4psamplemerchant/PayPalTokenClient.java b/src/main/java/com/braintree/braintreep4psamplemerchant/PayPalTokenClient.java index 4c461c9..e621b62 100644 --- a/src/main/java/com/braintree/braintreep4psamplemerchant/PayPalTokenClient.java +++ b/src/main/java/com/braintree/braintreep4psamplemerchant/PayPalTokenClient.java @@ -47,6 +47,7 @@ private IdToken getToken(final String authorizationHeader) { MultiValueMap body = new LinkedMultiValueMap<>(); body.add("grant_type", "client_credentials"); body.add("response_type", "id_token"); + body.add("entry_point", "paypal_native_sdk"); HttpEntity> request = new HttpEntity<>(body, headers); ResponseEntity response = restTemplate.postForEntity( diff --git a/src/main/java/com/braintree/braintreep4psamplemerchant/RestController.java b/src/main/java/com/braintree/braintreep4psamplemerchant/RestController.java index 4eadf67..1ace695 100644 --- a/src/main/java/com/braintree/braintreep4psamplemerchant/RestController.java +++ b/src/main/java/com/braintree/braintreep4psamplemerchant/RestController.java @@ -15,8 +15,8 @@ public RestController(OrdersV2Client ordersV2Client, PayPalTokenClient payPalTok this.payPalTokenClient = payPalTokenClient; } - @GetMapping(path = "/client-token") - IdToken getClientToken(@RequestParam(value = "countryCode") String countryCode) { + @GetMapping(path = "/id-token") + IdToken getIDToken(@RequestParam(value = "countryCode") String countryCode) { System.out.println("******************************"); System.out.println("REQUEST to /v1/oauth2/token:"); System.out.println("Country code: " + countryCode);