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


Java TransactionInfo类代码示例

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


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

示例1: requestPayment

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
public void requestPayment(View view) {
    // Disables the button to prevent multiple clicks.
    mPwgButton.setClickable(false);

    // The price provided to the API should include taxes and shipping.
    // This price is not displayed to the user.
    String price = PaymentsUtil.microsToString(mBikeItem.getPriceMicros() + mShippingCost);

    TransactionInfo transaction = PaymentsUtil.createTransaction(price);
    PaymentDataRequest request = PaymentsUtil.createPaymentDataRequest(transaction);
    Task<PaymentData> futurePaymentData = mPaymentsClient.loadPaymentData(request);

    // Since loadPaymentData may show the UI asking the user to select a payment method, we use
    // AutoResolveHelper to wait for the user interacting with it. Once completed,
    // onActivityResult will be called with the result.
    AutoResolveHelper.resolveTask(futurePaymentData, this, LOAD_PAYMENT_DATA_REQUEST_CODE);
}
 
开发者ID:android-pay,项目名称:paymentsapi-quickstart,代码行数:18,代码来源:CheckoutActivity.java

示例2: GooglePaymentRequest

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
protected GooglePaymentRequest(Parcel in) {
    mTransactionInfo = in.readParcelable(TransactionInfo.class.getClassLoader());
    byte emailRequired = in.readByte();
    mEmailRequired = emailRequired == 0 ? null : emailRequired == 1;
    byte phoneNumberRequired = in.readByte();
    mPhoneNumberRequired = phoneNumberRequired == 0 ? null : phoneNumberRequired == 1;
    byte billingAddressRequired = in.readByte();
    mBillingAddressRequired = billingAddressRequired == 0 ? null : billingAddressRequired == 1;
    if (in.readByte() == 0) {
        mBillingAddressFormat = null;
    } else {
        mBillingAddressFormat = in.readInt();
    }
    byte shippingAddressRequired = in.readByte();
    mShippingAddressRequired = shippingAddressRequired == 0 ? null : shippingAddressRequired == 1;
    mShippingAddressRequirements = in.readParcelable(ShippingAddressRequirements.class.getClassLoader());
    byte allowPrepaidCards = in.readByte();
    mAllowPrepaidCards = allowPrepaidCards == 0 ? null : allowPrepaidCards == 1;
    byte uiRequired = in.readByte();
    mUiRequired = uiRequired == 0 ? null : uiRequired == 1;
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:GooglePaymentRequest.java

示例3: requestPayment_sendsAnalyticsEvent

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void requestPayment_sendsAnalyticsEvent() throws Exception {
    BraintreeFragment fragment = getSetupFragment();
    doNothing().when(fragment).startActivityForResult(any(Intent.class), anyInt());
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("1.00")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .setCurrencyCode("USD")
                    .build());

    GooglePayment.requestPayment(fragment, googlePaymentRequest);

    InOrder order = inOrder(fragment);
    order.verify(fragment).sendAnalyticsEvent("google-payment.selected");
    order.verify(fragment).sendAnalyticsEvent("google-payment.started");
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:18,代码来源:GooglePaymentTest.java

示例4: launchGooglePayment

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
public void launchGooglePayment(View v) {
    setProgressBarIndeterminateVisibility(true);

    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setCurrencyCode(Settings.getGooglePaymentCurrency(this))
                    .setTotalPrice("1.00")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .build())
            .allowPrepaidCards(Settings.areGooglePaymentPrepaidCardsAllowed(this))
            .billingAddressFormat(WalletConstants.BILLING_ADDRESS_FORMAT_FULL)
            .billingAddressRequired(Settings.isGooglePaymentBillingAddressRequired(this))
            .emailRequired(Settings.isGooglePaymentEmailRequired(this))
            .phoneNumberRequired(Settings.isGooglePaymentPhoneNumberRequired(this))
            .shippingAddressRequired(Settings.isGooglePaymentShippingAddressRequired(this))
            .shippingAddressRequirements(ShippingAddressRequirements.newBuilder()
                    .addAllowedCountryCodes(Settings.getGooglePaymentAllowedCountriesForShipping(this))
                    .build())
            .uiRequired(true);

    GooglePayment.requestPayment(mBraintreeFragment, googlePaymentRequest);
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:23,代码来源:GooglePaymentActivity.java

示例5: createPaymentDataRequest

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
/**
 * Builds {@link PaymentDataRequest} to be consumed by {@link PaymentsClient#loadPaymentData}.
 *
 * @param transactionInfo contains the price for this transaction.
 */
public static PaymentDataRequest createPaymentDataRequest(TransactionInfo transactionInfo) {
    PaymentMethodTokenizationParameters.Builder paramsBuilder =
            PaymentMethodTokenizationParameters.newBuilder()
                    .setPaymentMethodTokenizationType(
                            WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
                    .addParameter("gateway", Constants.GATEWAY_TOKENIZATION_NAME);
    for (Pair<String, String> param : Constants.GATEWAY_TOKENIZATION_PARAMETERS) {
        paramsBuilder.addParameter(param.first, param.second);
    }

    return createPaymentDataRequest(transactionInfo, paramsBuilder.build());
}
 
开发者ID:android-pay,项目名称:paymentsapi-quickstart,代码行数:18,代码来源:PaymentsUtil.java

示例6: createPaymentDataRequestDirect

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
/**
 * Builds {@link PaymentDataRequest} for use with DIRECT integration to be consumed by
 * {@link PaymentsClient#loadPaymentData}.
 * <p>
 * Please refer to the documentation for more information about DIRECT integration. The type of
 * integration you use depends on your payment processor.
 *
 * @param transactionInfo contains the price for this transaction.
 */
public static PaymentDataRequest createPaymentDataRequestDirect(TransactionInfo transactionInfo) {
    PaymentMethodTokenizationParameters params =
            PaymentMethodTokenizationParameters.newBuilder()
                    .setPaymentMethodTokenizationType(
                            WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_DIRECT)

                    // Omitting the publicKey will result in a request for unencrypted data.
                    // Please refer to the documentation for more information on unencrypted
                    // requests.
                    .addParameter("publicKey", Constants.DIRECT_TOKENIZATION_PUBLIC_KEY)
                    .build();

    return createPaymentDataRequest(transactionInfo, params);
}
 
开发者ID:android-pay,项目名称:paymentsapi-quickstart,代码行数:24,代码来源:PaymentsUtil.java

示例7: getGooglePaymentRequest

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
private GooglePaymentRequest getGooglePaymentRequest() {
    return new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("1.00")
                    .setCurrencyCode("USD")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .build())
            .emailRequired(true);
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:10,代码来源:MainActivity.java

示例8: requestPayment_startsActivityWithOptionalValues

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void requestPayment_startsActivityWithOptionalValues() {
    BraintreeFragment fragment = getSetupFragment();
    doNothing().when(fragment).startActivityForResult(any(Intent.class), anyInt());
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .allowPrepaidCards(true)
            .billingAddressFormat(1)
            .billingAddressRequired(true)
            .emailRequired(true)
            .phoneNumberRequired(true)
            .shippingAddressRequired(true)
            .shippingAddressRequirements(ShippingAddressRequirements.newBuilder().addAllowedCountryCode("USA").build())
            .uiRequired(true)
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("1.00")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .setCurrencyCode("USD")
                    .build());

    GooglePayment.requestPayment(fragment, googlePaymentRequest);

    ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
    verify(fragment).startActivityForResult(captor.capture(), eq(BraintreeRequestCodes.GOOGLE_PAYMENT));
    Intent intent = captor.getValue();
    PaymentDataRequest paymentDataRequest = intent.getParcelableExtra(EXTRA_PAYMENT_DATA_REQUEST);
    CardRequirements cardRequirements = paymentDataRequest.getCardRequirements();
    assertNotNull(cardRequirements);
    assertTrue(cardRequirements.allowPrepaidCards());
    assertEquals(1, cardRequirements.getBillingAddressFormat());
    assertTrue(cardRequirements.isBillingAddressRequired());
    assertTrue(paymentDataRequest.isEmailRequired());
    assertTrue(paymentDataRequest.isPhoneNumberRequired());
    assertTrue(paymentDataRequest.isShippingAddressRequired());
    assertNotNull(paymentDataRequest.getShippingAddressRequirements());
    assertNotNull(paymentDataRequest.getShippingAddressRequirements().getAllowedCountryCodes());
    assertTrue(paymentDataRequest.getShippingAddressRequirements().getAllowedCountryCodes().contains("USA"));
    assertTrue(paymentDataRequest.isUiRequired());
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:39,代码来源:GooglePaymentTest.java

示例9: returnsAllValues

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void returnsAllValues() {
    ShippingAddressRequirements shippingAddressRequirements = ShippingAddressRequirements.newBuilder().build();
    TransactionInfo transactionInfo = TransactionInfo.newBuilder()
            .setCurrencyCode("USD")
            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_NOT_CURRENTLY_KNOWN)
            .build();

    GooglePaymentRequest request = new GooglePaymentRequest()
            .allowPrepaidCards(true)
            .billingAddressFormat(WalletConstants.BILLING_ADDRESS_FORMAT_FULL)
            .billingAddressRequired(true)
            .emailRequired(true)
            .phoneNumberRequired(true)
            .shippingAddressRequired(true)
            .shippingAddressRequirements(shippingAddressRequirements)
            .transactionInfo(transactionInfo)
            .uiRequired(true);

    assertEquals(true, request.getAllowPrepaidCards().booleanValue());
    assertEquals(WalletConstants.BILLING_ADDRESS_FORMAT_FULL, request.getBillingAddressFormat().intValue());
    assertEquals(true, request.isBillingAddressRequired().booleanValue());
    assertEquals(true, request.isEmailRequired().booleanValue());
    assertEquals(true, request.isPhoneNumberRequired().booleanValue());
    assertEquals(true, request.isShippingAddressRequired().booleanValue());
    assertEquals(shippingAddressRequirements, request.getShippingAddressRequirements());
    assertEquals(transactionInfo, request.getTransactionInfo());
    assertEquals(true, request.isUiRequired().booleanValue());
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:30,代码来源:GooglePaymentRequestUnitTest.java

示例10: parcelsCorrectly_allFieldsPopulated_null

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void parcelsCorrectly_allFieldsPopulated_null() {
    GooglePaymentRequest request = new GooglePaymentRequest();

    TransactionInfo info = TransactionInfo.newBuilder()
            .setCurrencyCode("USD")
            .setTotalPrice("10")
            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
            .build();

    request.transactionInfo(info);
    request.billingAddressFormat(WalletConstants.BILLING_ADDRESS_FORMAT_FULL);

    ShippingAddressRequirements requirements = ShippingAddressRequirements.newBuilder()
            .addAllowedCountryCode("US")
            .build();

    request.shippingAddressRequirements(requirements);

    Parcel parcel = Parcel.obtain();
    request.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);

    GooglePaymentRequest parceled = GooglePaymentRequest.CREATOR.createFromParcel(parcel);

    assertEquals("USD", parceled.getTransactionInfo().getCurrencyCode());
    assertEquals("10", parceled.getTransactionInfo().getTotalPrice());
    assertEquals(WalletConstants.TOTAL_PRICE_STATUS_FINAL, parceled.getTransactionInfo().getTotalPriceStatus());
    assertNull(parceled.isEmailRequired());
    assertNull(parceled.isPhoneNumberRequired());
    assertNull(parceled.isShippingAddressRequired());
    assertNull(parceled.isBillingAddressRequired());
    assertEquals(WalletConstants.BILLING_ADDRESS_FORMAT_FULL, (int) parceled.getBillingAddressFormat());
    assertTrue(parceled.getShippingAddressRequirements().getAllowedCountryCodes().contains("US"));
    assertNull(parceled.getAllowPrepaidCards());
    assertNull(parceled.isUiRequired());
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:38,代码来源:GooglePaymentRequestUnitTest.java

示例11: includesAllOptions

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的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

示例12: isParcelable

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的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

示例13: getTransactionInfo

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
public TransactionInfo getTransactionInfo() {
    return mTransactionInfo;
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:4,代码来源:GooglePaymentRequest.java

示例14: requestPayment_startsActivity

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void requestPayment_startsActivity() {
    BraintreeFragment fragment = getSetupFragment();
    doNothing().when(fragment).startActivityForResult(any(Intent.class), anyInt());
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
            .transactionInfo(TransactionInfo.newBuilder()
                    .setTotalPrice("1.00")
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .setCurrencyCode("USD")
                    .build());

    GooglePayment.requestPayment(fragment, googlePaymentRequest);

    ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
    verify(fragment).startActivityForResult(captor.capture(), eq(BraintreeRequestCodes.GOOGLE_PAYMENT));
    Intent intent = captor.getValue();
    assertEquals(GooglePaymentActivity.class.getName(), intent.getComponent().getClassName());
    assertEquals(WalletConstants.ENVIRONMENT_TEST, intent.getIntExtra(EXTRA_ENVIRONMENT, -1));
    PaymentDataRequest paymentDataRequest = intent.getParcelableExtra(EXTRA_PAYMENT_DATA_REQUEST);
    assertEquals(googlePaymentRequest.getTransactionInfo(), paymentDataRequest.getTransactionInfo());
    assertEquals(2, paymentDataRequest.getAllowedPaymentMethods().size());
    assertTrue(paymentDataRequest.getAllowedPaymentMethods().contains(WalletConstants.PAYMENT_METHOD_CARD));
    assertTrue(paymentDataRequest.getAllowedPaymentMethods().contains(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD));
    assertFalse(paymentDataRequest.isEmailRequired());
    assertFalse(paymentDataRequest.isPhoneNumberRequired());
    List<Integer> allowedCardNetworks = paymentDataRequest.getCardRequirements().getAllowedCardNetworks();
    assertEquals(4, allowedCardNetworks.size());
    assertTrue(allowedCardNetworks.contains(WalletConstants.CARD_NETWORK_VISA));
    assertTrue(allowedCardNetworks.contains(WalletConstants.CARD_NETWORK_DISCOVER));
    assertTrue(allowedCardNetworks.contains(WalletConstants.CARD_NETWORK_MASTERCARD));
    assertTrue(allowedCardNetworks.contains(WalletConstants.CARD_NETWORK_AMEX));
    assertEquals(WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY,
            paymentDataRequest.getPaymentMethodTokenizationParameters().getPaymentMethodTokenizationType());

    Bundle expectedParameters = GooglePayment.getTokenizationParameters(fragment)
            .getParameters();
    Bundle actualParameters = paymentDataRequest.getPaymentMethodTokenizationParameters().getParameters();
    assertEquals(expectedParameters.getString("gateway"), actualParameters.getString("gateway"));
    assertEquals(expectedParameters.getString("braintree:merchantId"), actualParameters.getString("braintree:merchantId"));
    assertEquals(expectedParameters.getString("braintree:authorizationFingerprint"),
            actualParameters.getString("braintree:authorizationFingerprint"));
    assertEquals(expectedParameters.getString("braintree:apiVersion"), actualParameters.getString("braintree:apiVersion"));
    assertEquals(expectedParameters.getString("braintree:sdkVersion"), actualParameters.getString("braintree:sdkVersion"));
    assertEquals(expectedParameters.getString("braintree:metadata"), actualParameters.getString("braintree:metadata"));
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:46,代码来源:GooglePaymentTest.java

示例15: parcelsCorrectly_allFieldsPopulated_truthy

import com.google.android.gms.wallet.TransactionInfo; //导入依赖的package包/类
@Test
public void parcelsCorrectly_allFieldsPopulated_truthy() {
    GooglePaymentRequest request = new GooglePaymentRequest();

    TransactionInfo info = TransactionInfo.newBuilder()
            .setCurrencyCode("USD")
            .setTotalPrice("10")
            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
            .build();

    request.transactionInfo(info);
    request.emailRequired(true);
    request.phoneNumberRequired(true);
    request.shippingAddressRequired(true);
    request.billingAddressRequired(true);
    request.billingAddressFormat(WalletConstants.BILLING_ADDRESS_FORMAT_FULL);

    ShippingAddressRequirements requirements = ShippingAddressRequirements.newBuilder()
            .addAllowedCountryCode("US")
            .build();

    request.shippingAddressRequirements(requirements);
    request.allowPrepaidCards(true);
    request.uiRequired(true);

    Parcel parcel = Parcel.obtain();
    request.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);

    GooglePaymentRequest parceled = GooglePaymentRequest.CREATOR.createFromParcel(parcel);

    assertEquals("USD", parceled.getTransactionInfo().getCurrencyCode());
    assertEquals("10", parceled.getTransactionInfo().getTotalPrice());
    assertEquals(WalletConstants.TOTAL_PRICE_STATUS_FINAL, parceled.getTransactionInfo().getTotalPriceStatus());
    assertTrue(parceled.isEmailRequired());
    assertTrue(parceled.isPhoneNumberRequired());
    assertTrue(parceled.isShippingAddressRequired());
    assertTrue(parceled.isBillingAddressRequired());
    assertEquals(WalletConstants.BILLING_ADDRESS_FORMAT_FULL, (int) parceled.getBillingAddressFormat());
    assertTrue(parceled.getShippingAddressRequirements().getAllowedCountryCodes().contains("US"));
    assertTrue(parceled.getAllowPrepaidCards());
    assertTrue(parceled.isUiRequired());
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:44,代码来源:GooglePaymentRequestUnitTest.java


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