本文整理汇总了Java中com.paypal.android.sdk.payments.PayPalService类的典型用法代码示例。如果您正苦于以下问题:Java PayPalService类的具体用法?Java PayPalService怎么用?Java PayPalService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PayPalService类属于com.paypal.android.sdk.payments包,在下文中一共展示了PayPalService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(Build.VERSION.SDK_INT < 8){
Toast.makeText(this, getString(R.string.error_SYS_Billing), Toast.LENGTH_LONG).show();
return;
}
Intent paypalIntent = new Intent(this, PayPalService.class);
paypalIntent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(paypalIntent);
final Intent intent = getIntent();
packageName = intent.getStringExtra("packageName");
token = intent.getStringExtra("token");
}
示例2: handleActivityResult
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
public void handleActivityResult(final int requestCode, final int resultCode, final Intent data) {
if (requestCode != paymentIntentRequestCode) { return; }
if (resultCode == Activity.RESULT_OK) {
PaymentConfirmation confirm =
data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if (confirm != null) {
successCallback.invoke(
confirm.toJSONObject().toString(),
confirm.getPayment().toJSONObject().toString()
);
}
} else if (resultCode == Activity.RESULT_CANCELED) {
errorCallback.invoke(ERROR_USER_CANCELLED);
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
errorCallback.invoke(ERROR_INVALID_CONFIG);
}
currentActivity.stopService(new Intent(currentActivity, PayPalService.class));
}
示例3: profileSharing
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@ReactMethod
public void profileSharing(final ReadableMap payPalConfig, Callback callback) {
Activity currentActivity = this.getCurrentActivity();
if (currentActivity == null) {
return;
}
this.callback = callback;
PayPalConfiguration config = this.createPayPalConfiguration(payPalConfig);
this.startPayPalService(config, currentActivity);
Intent intent = new Intent(currentActivity, PayPalProfileSharingActivity.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
intent.putExtra(PayPalProfileSharingActivity.EXTRA_REQUESTED_SCOPES, this.getOauthScopes(payPalConfig));
currentActivity.startActivityForResult(intent, REQUEST_CODE_PROFILE_SHARING);
}
示例4: onBuyPressed
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
public void onBuyPressed(View pressed) {
/*
* PAYMENT_INTENT_SALE will cause the payment to complete immediately.
* Change PAYMENT_INTENT_SALE to
* - PAYMENT_INTENT_AUTHORIZE to only authorize payment and capture funds later.
* - PAYMENT_INTENT_ORDER to create a payment for authorization and capture
* later via calls from your server.
*
* Also, to include additional payment details and an item list, see getStuffToBuy() below.
*/
PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);
/*
* See getStuffToBuy(..) for examples of some available payment options.
*/
Intent intent = new Intent(SampleActivity.this, PaymentActivity.class);
// send the same configuration for restart resiliency
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, REQUEST_CODE_PAYMENT);
}
示例5: onCreate
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payments);
String[] tickerSymbols = new String[] { "Beef&Broccoli: $9", "Noodle Soup: $10", "Fried Rice: $8"};
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
tickerSymbols));
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
//paypal functionality
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
startService(intent);
}
示例6: startPayPalService
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
public void startPayPalService() {
Intent intent = new Intent(getContext(), PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, PayPalSettings.PAYPAL_CONFIG);
view.startPayPalService(intent);
}
示例7: donatePayPalClicked
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
public void donatePayPalClicked() {
//Getting the amount from editText
String paymentAmount = view.getPaymentAmount();
//Check if it is empty
if (paymentAmount.isEmpty()) {
view.setPaymentAmountError(getContext().getString(R.string.empty_payment_amount));
return;
}
//Creating a paypalpayment
PayPalPayment payment = new PayPalPayment(new BigDecimal(String.valueOf(paymentAmount))
, "USD", getContext().getString(R.string.paiment_app_detail),
PayPalPayment.PAYMENT_INTENT_SALE);
//Creating Paypal Payment activity intent
Intent intent = new Intent(getContext(), PaymentActivity.class);
//putting the paypal configuration to the intent
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, PayPalSettings.PAYPAL_CONFIG);
//Puting paypal payment to the intent
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment);
//Starting the intent activity for result
//the request code will be used on the method onActivityResult
view.startActivityWithResult(intent, PAYPAL_REQUEST_CODE);
view.setBtnPayEnabled(false);
}
示例8: onDestroy
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
protected void onDestroy() {
stopService(new Intent(this, PayPalService.class));
super.onDestroy();
if (execute != null && !execute.isCancelled()) {
execute.cancel(false);
}
}
示例9: onCreate
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.profile_activity);
ManageActivityUtils.addActivity(this);
//如果安卓5.0设置状态栏为orange
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getResources().getColor(R.color.orange));
}
//初始化控件ID
initIDS();
sp = this.getSharedPreferences("address", MODE_PRIVATE);
editor = sp.edit();
//获取isfirst的值,如果没有值就赋予为true
ifFirst = sp.getString("ifFirst", "true");
if (ifFirst.equals("true")) {
editor.putString("ifFirst", "true");
}
editor.commit();
//获取传递过来的allMessageOrderListBean
allMessageOrderListBean = (AllMessageOrderListBean) getIntent().getSerializableExtra("allMessageBean");
//将总价设置进来
tv_Totalamount.setText(allMessageOrderListBean.getAmount() + "");
//需要先开启paypal的服务
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(intent);
}
示例10: paymentRequest
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@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);
}
示例11: navigateToPayPalForResult
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
public void navigateToPayPalForResult(int requestCode, String currency, String description,
double amount) {
final Bundle bundle = new Bundle();
bundle.putParcelable(PayPalService.EXTRA_PAYPAL_CONFIGURATION,
new PayPalConfiguration().environment(BuildConfig.PAYPAL_ENVIRONMENT)
.clientId(BuildConfig.PAYPAL_KEY)
.merchantName(marketName));
bundle.putParcelable(com.paypal.android.sdk.payments.PaymentActivity.EXTRA_PAYMENT,
new PayPalPayment(new BigDecimal(amount), currency, description,
PayPalPayment.PAYMENT_INTENT_SALE));
activityNavigator.navigateForResult(com.paypal.android.sdk.payments.PaymentActivity.class,
requestCode, bundle);
}
示例12: startPayPalService
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
private void startPayPalService(PayPalConfiguration config, Activity currentActivity) {
if (currentActivity == null) {
return;
}
Intent intent = new Intent(currentActivity, PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
currentActivity.startService(intent);
}
示例13: stopPayPalService
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
private void stopPayPalService(Activity currentActivity) {
if (currentActivity == null) {
return;
}
currentActivity.stopService(new Intent(currentActivity, PayPalService.class));
}
示例14: onCreate
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(intent);
}
示例15: onFuturePaymentPressed
import com.paypal.android.sdk.payments.PayPalService; //导入依赖的package包/类
public void onFuturePaymentPressed(View pressed) {
Intent intent = new Intent(SampleActivity.this, PayPalFuturePaymentActivity.class);
// send the same configuration for restart resiliency
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startActivityForResult(intent, REQUEST_CODE_FUTURE_PAYMENT);
}