use of com.braintreepayments.api.models.PayPalConfiguration in project braintree_android by braintree.
the class PayPal method populateRequestData.
private static <T extends Request> T populateRequestData(BraintreeFragment fragment, T request) {
PayPalConfiguration paypalConfiguration = fragment.getConfiguration().getPayPal();
String environment;
switch(paypalConfiguration.getEnvironment()) {
case "live":
environment = EnvironmentManager.LIVE;
break;
case "offline":
environment = EnvironmentManager.MOCK;
break;
default:
environment = paypalConfiguration.getEnvironment();
break;
}
String clientId = paypalConfiguration.getClientId();
if (clientId == null && EnvironmentManager.MOCK.equals(environment)) {
clientId = "FAKE-PAYPAL-CLIENT-ID";
}
request.environment(environment).clientId(clientId).cancelUrl(fragment.getReturnUrlScheme(), "cancel").successUrl(fragment.getReturnUrlScheme(), "success");
return request;
}
Aggregations