• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PaymentConfirmation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.paypal.android.sdk.payments.PaymentConfirmation的典型用法代码示例。如果您正苦于以下问题:Java PaymentConfirmation类的具体用法?Java PaymentConfirmation怎么用?Java PaymentConfirmation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PaymentConfirmation类属于com.paypal.android.sdk.payments包,在下文中一共展示了PaymentConfirmation类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的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));
}
 
开发者ID:lukamarin,项目名称:paypal-react-native,代码行数:21,代码来源:PayPal.java


示例2: map

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
private PayPalResult map(Result result) {
  switch (result.getResultCode()) {
    case Activity.RESULT_OK:
      final PaymentConfirmation confirmation = result.getData()
          .getParcelableExtra(
              com.paypal.android.sdk.payments.PaymentActivity.EXTRA_RESULT_CONFIRMATION);
      if (confirmation != null && confirmation.getProofOfPayment() != null) {
        return new BillingNavigator.PayPalResult(BillingNavigator.PayPalResult.SUCCESS,
            confirmation.getProofOfPayment()
                .getPaymentId());
      } else {
        return new BillingNavigator.PayPalResult(BillingNavigator.PayPalResult.ERROR, null);
      }
    case Activity.RESULT_CANCELED:
      return new BillingNavigator.PayPalResult(BillingNavigator.PayPalResult.CANCELLED, null);
    case PayPalFuturePaymentActivity.RESULT_EXTRAS_INVALID:
    default:
      return new BillingNavigator.PayPalResult(BillingNavigator.PayPalResult.ERROR, null);
  }
}
 
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:21,代码来源:BillingNavigator.java


示例3: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
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,代码行数:20,代码来源:PayPalMobilePGPlugin.java


示例4: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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.");
        }
    }
}
 
开发者ID:OmarAliSaid,项目名称:android-paypal-example,代码行数:40,代码来源:ShoppingCardActivity.java


示例5: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	// Postpone a Payment-Result to onResumeFragment, back from payment
	// returns null-data.
	PaymentConfirmation confirm = null;
	if (data != null) {
		confirm = data
				.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
	}
	paymentResult = new PaymentResult(resultCode, confirm);
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:13,代码来源:ShopActivity.java


示例6: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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.");
    }
}
 
开发者ID:rutvijkumarshah,项目名称:WatsiAndroidApp,代码行数:31,代码来源:BaseFragmentActivity.java


示例7: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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.");
        }
    }
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:38,代码来源:DonateActivity.java


示例8: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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,代码行数:32,代码来源:GiftDetailsActivity.java


示例9: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
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;
}
 
开发者ID:rafali,项目名称:flickr-uploader,代码行数:29,代码来源:Utils.java


示例10: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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.");
        }
    }
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:57,代码来源:Presenter.java


示例11: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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.");
        }
    }
}
 
开发者ID:LavanyaGanganna,项目名称:Capstoneproject1,代码行数:43,代码来源:PaypalFragment.java


示例12: onResumeFragments

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@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,代码行数:77,代码来源:ShopActivity.java


示例13: PaymentResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
public PaymentResult(int resultCode, PaymentConfirmation confirmation) {
	super();
	this.resultCode = resultCode;
	this.confirmation = confirmation;
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:6,代码来源:ShopActivity.java


示例14: onActivityResult

import com.paypal.android.sdk.payments.PaymentConfirmation; //导入依赖的package包/类
@Override
public void onActivityResult( int requestCode, int resultCode, Intent data )
  {
  if ( requestCode == ACTIVITY_REQUEST_CODE_PAYPAL )
    {
    if ( resultCode == Activity.RESULT_OK )
      {
      PaymentConfirmation paymentConfirmation = data.getParcelableExtra( com.paypal.android.sdk.payments.PaymentActivity.EXTRA_RESULT_CONFIRMATION );

      if ( paymentConfirmation != null )
        {
        try
          {

          ProofOfPayment proofOfPayment = paymentConfirmation.getProofOfPayment();

          if ( proofOfPayment != null )
            {
            String paymentId = proofOfPayment.getPaymentId();

            if ( paymentId != null )
              {
              submitOrderForPrinting( paymentId, KiteSDK.getInstance( getActivity() ).getPayPalAccountId(), PaymentMethod.PAYPAL );
              }
            else
              {
              showErrorDialog( R.string.alert_dialog_message_no_payment_id );
              }
            }
          else
            {
            showErrorDialog( R.string.alert_dialog_message_no_proof_of_payment );
            }

          }
        catch ( Exception exception )
          {
          showErrorDialog( exception.getMessage() );
          }
        }
      else
        {
        showErrorDialog( R.string.alert_dialog_message_no_paypal_confirmation );
        }
      }

    return;
    }


  if ( mCreditCardAgent != null ) mCreditCardAgent.onActivityResult( requestCode, resultCode, data );

  super.onActivityResult( requestCode, resultCode, data );
  }
 
开发者ID:OceanLabs,项目名称:Android-Print-SDK,代码行数:55,代码来源:DefaultPaymentFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Action2类代码示例发布时间:2022-05-21
下一篇:
Java BeanProvider类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap