本文整理汇总了Java中com.paypal.android.sdk.payments.PaymentActivity.RESULT_EXTRAS_INVALID属性的典型用法代码示例。如果您正苦于以下问题:Java PaymentActivity.RESULT_EXTRAS_INVALID属性的具体用法?Java PaymentActivity.RESULT_EXTRAS_INVALID怎么用?Java PaymentActivity.RESULT_EXTRAS_INVALID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.paypal.android.sdk.payments.PaymentActivity
的用法示例。
在下文中一共展示了PaymentActivity.RESULT_EXTRAS_INVALID属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleActivityResult
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));
}
示例2: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_PAYMENT) {
if (resultCode == Activity.RESULT_OK) {
PaymentConfirmation confirm =
data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if (confirm != null) {
try {
Log.i(TAG, confirm.toJSONObject().toString(4));
Log.i(TAG, confirm.getPayment().toJSONObject().toString(4));
/**
* TODO: send 'confirm' (and possibly confirm.getPayment() to your server for verification
* or consent completion.
* See https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
* for more details.
*
* For sample mobile backend interactions, see
* https://github.com/paypal/rest-api-sdk-python/tree/master/samples/mobile_backend
*/
String payment_id = confirm.toJSONObject().getJSONObject("response").getString("id");
verifyPaymentOnServer(payment_id , confirm);
displayResultText("PaymentConfirmation info received from PayPal");
} catch (JSONException e) {
Log.e(TAG, "an extremely unlikely failure occurred: ", e);
}
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Log.i(TAG, "The user canceled.");
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
Log.i(
TAG,
"An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
}
}
}
示例3: 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 {
showThankYouNote();
ParseObject confirmation = new ParseObject("PaymentConfirmatons");
confirmation.put("donorName", getUserFullName());
confirmation.put("donorEmail", getUserEmail());
confirmation.put("patient", Patient.createWithoutData(Patient.class, getPatientId()));
confirmation.put("amount", getDonationAmount());
confirmation.put("confirmation", confirm.toJSONObject().toString(4));
confirmation.put("isAnonymous", isAnonymousDonation());
confirmation.saveInBackground();
prefs.clear();
} catch (JSONException e) {
Log.e(TAG_PAYPAL, "an extremely unlikely failure occurred: ", e);
}
}
}
else if (resultCode == Activity.RESULT_CANCELED) {
Log.i(TAG_PAYPAL, "The user canceled.");
}
else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
Log.i(TAG_PAYPAL, "An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
}
}
示例4: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_PAYMENT) {
if (resultCode == Activity.RESULT_OK) {
PaymentConfirmation confirm =
data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if (confirm != null) {
try {
Log.i("TAG", confirm.toJSONObject().toString(4));
Log.i("TAG", confirm.getPayment().toJSONObject().toString(4));
/**
* TODO: send 'confirm' (and possibly confirm.getPayment() to your server for verification
* or consent completion.
* See https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
* for more details.
*
* For sample mobile backend interactions, see
* https://github.com/paypal/rest-api-sdk-python/tree/master/samples/mobile_backend
*/
Toast.makeText(
getApplicationContext(),
"PaymentConfirmation info received from PayPal", Toast.LENGTH_LONG)
.show();
} catch (JSONException e) {
Log.e("TAG", "an extremely unlikely failure occurred: ", e);
}
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Log.i("TAG", "The user canceled.");
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
Log.i(
"TAG",
"An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
}
}
}
示例5: onActivityResult
public static boolean onActivityResult(int requestCode, int resultCode, Intent data) {
boolean consumed = false;
if (requestCode == PAYPAL_REQUEST_CODE_PAYMENT) {
consumed = true;
if (resultCode == Activity.RESULT_OK) {
PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if (confirm != null) {
String paypal_result_confirmation = confirm.toJSONObject().toString();
LOG.info(paypal_result_confirmation);
Utils.setStringProperty("paypal_result_confirmation", paypal_result_confirmation);
validatePaypalPayment(paypal_result_confirmation);
// TODO: send 'confirm' to your server for verification
// or consent
// completion.
// see
// https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
// for more details.
}
} else if (resultCode == Activity.RESULT_CANCELED) {
LOG.info("The user canceled.");
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
LOG.warn("An invalid Payment was submitted. Please see the docs.");
}
} else if (IabHelper.get(false) != null && IabHelper.get(false).handleActivityResult(requestCode, resultCode, data)) {
consumed = true;
}
return consumed;
}
示例6: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
//If the result is from paypal
if (requestCode == PAYPAL_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
//If the result is OK i.e. user has not canceled the payment
//Getting the payment confirmation
PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
//if confirmation is not null
if (confirm != null) {
try {
//Getting the payment details
JSONObject paypalDetailsJson = confirm.toJSONObject();
JSONObject paypalResponseJson = paypalDetailsJson.getJSONObject("response");
Payment payment = new Payment();
payment.setPaymentId(paypalResponseJson.getString("id"));
payment.setAmount(view.getPaymentAmount());
payment.setTimestamp(System.currentTimeMillis());
//Sending payment info on Firebase
//Registering an payment on server
model.savePaymentInfo(payment);
showLog("PAYPAL: SUCCESS");
showLog("PAYPAL: state -> " + paypalResponseJson.getString("state"));
showLog("PAYPAL: id -> " + paypalResponseJson.getString("id"));
//Show dialog <Payment Success>
new InfoDialogCustom()
.create(getContext(), getContext().getString(R.string.payment_success_title_info),
getContext().getString(R.string.payment_success_description_info))
.setOnOkClickedListener(new IDialogInfoOkClickedListener() {
@Override
public void onOkClick() {
view.clearPaymentAmount();
view.setBtnPayEnabled(true);
}
})
.show(600);
} catch (JSONException e) {
showLog("an extremely unlikely failure occurred: " + e);
}
}
} else if (resultCode == Activity.RESULT_CANCELED) {
showLog("The user canceled.");
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
showLog("An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
}
}
}
示例7: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//If the result is from paypal
if (requestCode == PAYPAL_REQUEST_CODE) {
//If the result is OK i.e. user has not canceled the payment
if (resultCode == Activity.RESULT_OK) {
//Getting the payment confirmation
PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
//if confirmation is not null
if (confirm != null) {
String state = confirm.getProofOfPayment().getState();
if (state.equals(getString(R.string.approved))) {
enablebutton(false);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
emails = sharedPreferences.getString(getString(R.string.emailaddr), null);
for (int i = 0; i < StartersListClass.starterclasses.size(); i++) {
titles.add(StartersListClass.starterclasses.get(i).getTitles());
prices.add(StartersListClass.starterclasses.get(i).getPrices());
}
new EndpointsAsyncTask().execute();
} else {
Toast.makeText(getContext(), R.string.errorpay, Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(getContext(), R.string.confirmnull, Toast.LENGTH_LONG).show();
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Log.i("paymentExample", "The user canceled.");
} else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
Log.i("paymentExample", "An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
}
}
}