当前位置: 首页>>代码示例>>Java>>正文


Java PaymentActivity.RESULT_PAYMENT_INVALID属性代码示例

本文整理汇总了Java中com.paypal.android.sdk.payments.PaymentActivity.RESULT_PAYMENT_INVALID属性的典型用法代码示例。如果您正苦于以下问题:Java PaymentActivity.RESULT_PAYMENT_INVALID属性的具体用法?Java PaymentActivity.RESULT_PAYMENT_INVALID怎么用?Java PaymentActivity.RESULT_PAYMENT_INVALID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.paypal.android.sdk.payments.PaymentActivity的用法示例。


在下文中一共展示了PaymentActivity.RESULT_PAYMENT_INVALID属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActivityResult

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (resultCode == Activity.RESULT_OK) {
        PaymentConfirmation confirmation = null;
        if (intent.hasExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION)) {
            confirmation = intent
                    .getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
            this.callbackContext.success(confirmation.toJSONObject());
        } else {
            this.callbackContext
                    .error("payment was ok but no confirmation");
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        this.callbackContext.error("payment cancelled");
    } else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {
        this.callbackContext.error("payment invalid");
    } else {
        this.callbackContext.error(resultCode);
    }
}
 
开发者ID:slykar,项目名称:phonegap-paypal,代码行数:19,代码来源:PayPalMobilePGPlugin.java

示例2: onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
        if (confirm != null) {
            try {
                Log.i("paymentExample", confirm.toJSONObject().toString(4));

                String serverUserId = getAccountServerId();

                ParseObject gameScore = new ParseObject("Payment");
                gameScore.put("gift_Id", g.getServerId());
                gameScore.put("person_Id", serverUserId);
                gameScore.put("quantity", g.getPrice());
                gameScore.put("token_paypal", confirm.getProofOfPayment().getPaymentIdentifier());
                gameScore.saveInBackground();


                setUpUiBuyed(confirm.getPayment().getAmount());


            } catch (JSONException e) {
                Log.e("paymentExample", "an extremely unlikely failure occurred: ", e);
            }
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        Log.i("paymentExample", "The user canceled.");
    } else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {
        Log.i("paymentExample", "An invalid payment was submitted. Please see the docs.");
    }
}
 
开发者ID:AdriaBergeAguilar,项目名称:BattlehackBarcelonaWedList,代码行数:31,代码来源:GiftDetailsActivity.java

示例3: onResumeFragments

@Override
protected void onResumeFragments() {
	super.onResumeFragments();
	// Process a PaymentResult from onActivityResult
	if (paymentResult != null) {
		int resultCode = paymentResult.resultCode;
		PaymentConfirmation confirm = paymentResult.confirmation;
		paymentResult = null;
		if (resultCode == Activity.RESULT_OK && confirm != null) {
			if (selectedPriceId == null) {
				MessageDialog.show(R.string.shop_activity_missingprice,
						this);
				return;
			}

			JSONObject paymentJson = confirm.toJSONObject();
			// Save Payment, so that payment can be verified later.
			Account account = new Account(accountName,
					Constants.ACCOUNT_TYPE);
			AccountManager accountManager = AccountManager.get(this);
			SyncUtils.savePayment(account, accountManager, paymentJson,
					selectedPriceId);

			SyncUtils.startPaymentVerification();
			// Start Timer to verify Payment if Verification could not be
			// done now.
			PaymentVerificationService
					.startVerificationTimer(getApplicationContext());

			// Send Confirmation to server
			boolean verifStarted = false;
			try {
				String jsonData = paymentJson.toString(1);
				VerifyPaymentProgressDialog progressDialog = VerifyPaymentProgressDialog
						.newInstance(selectedPriceId, jsonData, accountName);
				progressDialog.show(this.getSupportFragmentManager(),
						"VerifyPaymentProgressDialog");
				if (Log.isLoggable(TAG, Log.DEBUG)) {
					Log.d(TAG, "PaymentConfirmation: " + jsonData);
				}
				verifStarted = true;
			} catch (JSONException e) {
				MessageDialog.show(R.string.shop_activity_invalidsyntax,
						this);
				Log.e(TAG, "Failed to convert Payment to JSON.", e);
				SyncUtils.savePayment(account, accountManager, null, null);
			} finally {
				if (!verifStarted) {
					SyncUtils.stopPaymentVerification();
				}
			}
		} else if (resultCode == Activity.RESULT_CANCELED) {
			Log.i(TAG, "The user canceled the payment-flow");
		} else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {
			MessageDialog.show(R.string.shop_activity_invalidpayment, this);
			Log.i(TAG, "An invalid payment was submitted.");
		} else {
			MessageDialog.show(R.string.shop_activity_invalidpayment, this);
			Log.e(TAG, "PaymentResult is unknown. Result:" + resultCode
					+ " Confirmation:" + confirm);
		}
	}
	getSupportLoaderManager().initLoader(LOADID_PRICES, null, this);
	View progressBar = findViewById(R.id.progressBar);
	View reloadBtn = findViewById(R.id.reloadBtn);
	reloadBtn.setVisibility(View.GONE);
	progressBar.setVisibility(View.VISIBLE);
	getListView().setEmptyView(progressBar);

	// Show a Message from a delayed Verification
	String msg = getIntent().getStringExtra(PARM_MSG);
	if (msg != null) {
		MessageDialog.show(msg, this);
		getIntent().removeExtra(PARM_MSG);
	}
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:76,代码来源:ShopActivity.java


注:本文中的com.paypal.android.sdk.payments.PaymentActivity.RESULT_PAYMENT_INVALID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。