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


Java PayPal类代码示例

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


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

示例1: launchDropIn

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
public void launchDropIn(View v) {
    DropInRequest dropInRequest = new DropInRequest()
            .clientToken(mAuthorization)
            .amount("1.00")
            .requestThreeDSecureVerification(Settings.isThreeDSecureEnabled(this))
            .collectDeviceData(Settings.shouldCollectDeviceData(this))
            .googlePaymentRequest(getGooglePaymentRequest())
            .androidPayCart(getAndroidPayCart())
            .androidPayShippingAddressRequired(Settings.isAndroidPayShippingAddressRequired(this))
            .androidPayPhoneNumberRequired(Settings.isAndroidPayPhoneNumberRequired(this))
            .androidPayAllowedCountriesForShipping(Settings.getAndroidPayAllowedCountriesForShipping(this));

    if (Settings.isPayPalAddressScopeRequested(this)) {
        dropInRequest.paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
    }

    startActivityForResult(dropInRequest.getIntent(this), DROP_IN_REQUEST);
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:19,代码来源:MainActivity.java

示例2: getDropInRequest

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
private DropInRequest getDropInRequest() {
    DropInRequest dropInRequest = new DropInRequest()
            .amount("1.00")
            .clientToken(mAuthorization)
            .collectDeviceData(Settings.shouldCollectDeviceData(this))
            .requestThreeDSecureVerification(Settings.isThreeDSecureEnabled(this))
            .androidPayCart(getAndroidPayCart())
            .androidPayShippingAddressRequired(Settings.isAndroidPayShippingAddressRequired(this))
            .androidPayPhoneNumberRequired(Settings.isAndroidPayPhoneNumberRequired(this))
            .androidPayAllowedCountriesForShipping(Settings.getAndroidPayAllowedCountriesForShipping(this));

    if (Settings.isPayPalAddressScopeRequested(this)) {
        dropInRequest.paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
    }

    return dropInRequest;
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:18,代码来源:MainActivity.java

示例3: onPaymentMethodSelected

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
@Override
public void onPaymentMethodSelected(PaymentMethodType type) {
    mLoadingViewSwitcher.setDisplayedChild(0);

    switch (type) {
        case PAYPAL:
            PayPal.authorizeAccount(mBraintreeFragment);
            break;
        case ANDROID_PAY:
            AndroidPay.requestAndroidPay(mBraintreeFragment, mDropInRequest.getAndroidPayCart(),
                    mDropInRequest.isAndroidPayShippingAddressRequired(),
                    mDropInRequest.isAndroidPayPhoneNumberRequired(),
                    mDropInRequest.getAndroidPayAllowedCountriesForShipping());
            break;
        case GOOGLE_PAYMENT:
            GooglePayment.requestPayment(mBraintreeFragment, mDropInRequest.getGooglePaymentRequest());
            break;
        case PAY_WITH_VENMO:
            Venmo.authorizeAccount(mBraintreeFragment);
            break;
        case UNKNOWN:
            Intent intent = new Intent(this, AddCardActivity.class)
                    .putExtra(DropInRequest.EXTRA_CHECKOUT_REQUEST, mDropInRequest);
            startActivityForResult(intent, ADD_CARD_REQUEST_CODE);
            break;
    }
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:28,代码来源:DropInActivity.java

示例4: onPaymentMethodSelected_startsPayPal

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
@Test
public void onPaymentMethodSelected_startsPayPal() {
    mockStatic(PayPal.class);
    doNothing().when(PayPal.class);
    PayPal.authorizeAccount(any(BraintreeFragment.class));

    mActivity.onPaymentMethodSelected(PaymentMethodType.PAYPAL);

    verifyStatic();
    PayPal.authorizeAccount(mActivity.braintreeFragment);
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:12,代码来源:DropInActivityPowerMockTest.java

示例5: includesAllOptions

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
@Test
public void includesAllOptions() {
    Cart cart = Cart.newBuilder()
            .setTotalPrice("5.00")
            .build();
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("10")
                    .setCurrencyCode("USD")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .build())
            .emailRequired(true);

    Intent intent = new DropInRequest()
            .tokenizationKey(TOKENIZATION_KEY)
            .collectDeviceData(true)
            .amount("1.00")
            .androidPayCart(cart)
            .androidPayShippingAddressRequired(true)
            .androidPayPhoneNumberRequired(true)
            .androidPayAllowedCountriesForShipping("GB")
            .disableAndroidPay()
            .googlePaymentRequest(googlePaymentRequest)
            .disableGooglePayment()
            .paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS))
            .disablePayPal()
            .disableVenmo()
            .requestThreeDSecureVerification(true)
            .getIntent(RuntimeEnvironment.application);

    DropInRequest dropInRequest = intent.getParcelableExtra(DropInRequest.EXTRA_CHECKOUT_REQUEST);

    assertEquals(DropInActivity.class.getName(), intent.getComponent().getClassName());
    assertEquals(TOKENIZATION_KEY, dropInRequest.getAuthorization());
    assertTrue(dropInRequest.shouldCollectDeviceData());
    assertEquals("1.00", dropInRequest.getAmount());
    assertEquals("5.00", dropInRequest.getAndroidPayCart().getTotalPrice());
    assertTrue(dropInRequest.isAndroidPayShippingAddressRequired());
    assertTrue(dropInRequest.isAndroidPayPhoneNumberRequired());
    assertFalse(dropInRequest.isAndroidPayEnabled());
    assertEquals("10", dropInRequest.getGooglePaymentRequest().getTransactionInfo().getTotalPrice());
    assertEquals("USD", dropInRequest.getGooglePaymentRequest().getTransactionInfo().getCurrencyCode());
    assertEquals(WalletConstants.TOTAL_PRICE_STATUS_FINAL, dropInRequest.getGooglePaymentRequest().getTransactionInfo().getTotalPriceStatus());
    assertTrue(dropInRequest.getGooglePaymentRequest().isEmailRequired());
    assertFalse(dropInRequest.isGooglePaymentEnabled());
    assertEquals(1, dropInRequest.getAndroidPayAllowedCountriesForShipping().size());
    assertEquals("GB", dropInRequest.getAndroidPayAllowedCountriesForShipping().get(0).getCountryCode());
    assertEquals(Collections.singletonList(PayPal.SCOPE_ADDRESS), dropInRequest.getPayPalAdditionalScopes());
    assertFalse(dropInRequest.isPayPalEnabled());
    assertFalse(dropInRequest.isVenmoEnabled());
    assertTrue(dropInRequest.shouldRequestThreeDSecureVerification());
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:53,代码来源:DropInRequestUnitTest.java

示例6: isParcelable

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
@Test
public void isParcelable() {
    Cart cart = Cart.newBuilder()
            .setTotalPrice("5.00")
            .build();
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("10")
                    .setCurrencyCode("USD")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .build())
            .emailRequired(true);

    DropInRequest dropInRequest = new DropInRequest()
            .tokenizationKey(TOKENIZATION_KEY)
            .collectDeviceData(true)
            .amount("1.00")
            .androidPayCart(cart)
            .androidPayShippingAddressRequired(true)
            .androidPayPhoneNumberRequired(true)
            .androidPayAllowedCountriesForShipping("GB")
            .disableAndroidPay()
            .googlePaymentRequest(googlePaymentRequest)
            .disableGooglePayment()
            .paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS))
            .disablePayPal()
            .disableVenmo()
            .requestThreeDSecureVerification(true);

    Parcel parcel = Parcel.obtain();
    dropInRequest.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    DropInRequest parceledDropInRequest = DropInRequest.CREATOR.createFromParcel(parcel);

    assertEquals(TOKENIZATION_KEY, parceledDropInRequest.getAuthorization());
    assertTrue(parceledDropInRequest.shouldCollectDeviceData());
    assertEquals("1.00", parceledDropInRequest.getAmount());
    assertEquals("5.00", parceledDropInRequest.getAndroidPayCart().getTotalPrice());
    assertTrue(parceledDropInRequest.isAndroidPayShippingAddressRequired());
    assertTrue(parceledDropInRequest.isAndroidPayPhoneNumberRequired());
    assertFalse(parceledDropInRequest.isAndroidPayEnabled());
    assertEquals(1, parceledDropInRequest.getAndroidPayAllowedCountriesForShipping().size());
    assertEquals("GB", parceledDropInRequest.getAndroidPayAllowedCountriesForShipping().get(0).getCountryCode());
    assertEquals("10", dropInRequest.getGooglePaymentRequest().getTransactionInfo().getTotalPrice());
    assertEquals("USD", dropInRequest.getGooglePaymentRequest().getTransactionInfo().getCurrencyCode());
    assertEquals(WalletConstants.TOTAL_PRICE_STATUS_FINAL, dropInRequest.getGooglePaymentRequest().getTransactionInfo().getTotalPriceStatus());
    assertTrue(dropInRequest.getGooglePaymentRequest().isEmailRequired());
    assertFalse(dropInRequest.isGooglePaymentEnabled());
    assertEquals(Collections.singletonList(PayPal.SCOPE_ADDRESS), parceledDropInRequest.getPayPalAdditionalScopes());
    assertFalse(parceledDropInRequest.isPayPalEnabled());
    assertFalse(parceledDropInRequest.isVenmoEnabled());
    assertTrue(parceledDropInRequest.shouldRequestThreeDSecureVerification());
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:54,代码来源:DropInRequestUnitTest.java

示例7: launchFuturePayment

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
public void launchFuturePayment(View v) {
    setProgressBarIndeterminateVisibility(true);

    PayPalOverrides.setFuturePaymentsOverride(true);
    PayPal.authorizeAccount(mBraintreeFragment);
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:7,代码来源:PayPalActivity.java

示例8: launchFuturePaymentAddressScope

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
public void launchFuturePaymentAddressScope(View v) {
    setProgressBarIndeterminateVisibility(true);

    PayPalOverrides.setFuturePaymentsOverride(true);
    PayPal.authorizeAccount(mBraintreeFragment, Collections.singletonList(PayPal.SCOPE_ADDRESS));
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:7,代码来源:PayPalActivity.java

示例9: launchSinglePayment

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
public void launchSinglePayment(View v) {
    setProgressBarIndeterminateVisibility(true);

    PayPal.requestOneTimePayment(mBraintreeFragment, getPayPalRequest("1.00"));
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:6,代码来源:PayPalActivity.java

示例10: launchBillingAgreement

import com.braintreepayments.api.PayPal; //导入依赖的package包/类
public void launchBillingAgreement(View v) {
    setProgressBarIndeterminateVisibility(true);

    PayPal.requestBillingAgreement(mBraintreeFragment, getPayPalRequest(null));
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:6,代码来源:PayPalActivity.java


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