com.paypal.android.sdk.payments.PayPalConfiguration Java Examples

The following examples show how to use com.paypal.android.sdk.payments.PayPalConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasePurchaseActivity.java    From aptoide-client with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
    valuesToVerify = new ValuesToVerify();
    valuesToVerify.currency = this.currency;
    valuesToVerify.price = this.price;
    valuesToVerify.tax = this.tax;
    valuesToVerify.repo = repo;
    if (alreadyRegistered) {
        final String correlationId = PayPalConfiguration.getApplicationCorrelationId(BasePurchaseActivity.this);
        PayProductRequestPayPal request = new PayProductRequestPayPal();
        request.setToken(token);
        request.setRepo(repo);
        request.setProductId(productId);
        request.setPrice(String.valueOf(price));
        request.setCurrency(currency);
        if(simcc!=null && simcc.length()>0){
            request.setSimCountryCode(simcc);
        }
        request.setCorrelationId(correlationId);
        request.setRetryPolicy(noRetryPolicy);
        requestsetExtra(request);

        DialogFragment df = new ProgressDialogFragment();
        df.show(getSupportFragmentManager(), "pleaseWaitDialog");
        df.setCancelable(false);
        spiceManager.execute(request, new PurchaseRequestListener());
    } else {
        Intent ppIntent = new Intent(BasePurchaseActivity.this, PayPalFuturePaymentActivity.class);
        startActivityForResult(ppIntent, REQUEST_CODE_FUTURE_PAYMENT);
        spiceManager.removeDataFromCache(IabSimpleResponseJson.class, "authorization-" + token);
    }
}
 
Example #2
Source File: PayPal.java    From react-native-paypal with MIT License 5 votes vote down vote up
@Override public Map<String, Object> getConstants() {
  final Map<String, Object> constants = new HashMap<>();

  constants.put("NO_NETWORK", PayPalConfiguration.ENVIRONMENT_NO_NETWORK);
  constants.put("SANDBOX", PayPalConfiguration.ENVIRONMENT_SANDBOX);
  constants.put("PRODUCTION", PayPalConfiguration.ENVIRONMENT_PRODUCTION);
  constants.put(ERROR_USER_CANCELLED, ERROR_USER_CANCELLED);
  constants.put(ERROR_INVALID_CONFIG, ERROR_INVALID_CONFIG);

  return constants;
}
 
Example #3
Source File: PayPal.java    From react-native-paypal with MIT License 5 votes vote down vote up
@ReactMethod
public void paymentRequest(
  final ReadableMap payPalParameters,
  final Callback successCallback,
  final Callback errorCallback
) {
  this.successCallback = successCallback;
  this.errorCallback = errorCallback;

  final String environment = payPalParameters.getString("environment");
  final String clientId = payPalParameters.getString("clientId");
  final String price = payPalParameters.getString("price");
  final String currency = payPalParameters.getString("currency");
  final String description = payPalParameters.getString("description");

  PayPalConfiguration config =
    new PayPalConfiguration().environment(environment).clientId(clientId);

  startPayPalService(config);

  PayPalPayment thingToBuy =
    new PayPalPayment(new BigDecimal(price), currency, description,
                      PayPalPayment.PAYMENT_INTENT_SALE);

  Intent intent =
    new Intent(activityContext, PaymentActivity.class)
    .putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config)
    .putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

  currentActivity.startActivityForResult(intent, paymentIntentRequestCode);
}
 
Example #4
Source File: PayPal.java    From react-native-paypal with MIT License 4 votes vote down vote up
private void startPayPalService(PayPalConfiguration config) {
  Intent intent = new Intent(currentActivity, PayPalService.class);
  intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
  currentActivity.startService(intent);
}