本文整理汇总了Java中com.paypal.android.sdk.payments.ShippingAddress类的典型用法代码示例。如果您正苦于以下问题:Java ShippingAddress类的具体用法?Java ShippingAddress怎么用?Java ShippingAddress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShippingAddress类属于com.paypal.android.sdk.payments包,在下文中一共展示了ShippingAddress类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShippingAddress
import com.paypal.android.sdk.payments.ShippingAddress; //导入依赖的package包/类
/*****************************************************
*
* Returns a PayPal shipping address.
*
*****************************************************/
protected ShippingAddress getShippingAddress()
{
Address shippingAddress = mOrder.getShippingAddress();
if ( shippingAddress != null )
{
return (
new ShippingAddress()
.recipientName( shippingAddress.getRecipientName() )
.line1( shippingAddress.getLine1() )
.line2( shippingAddress.getLine2() )
.city( shippingAddress.getCity() )
.state( shippingAddress.getStateOrCounty() )
.postalCode( shippingAddress.getZipOrPostalCode() )
.countryCode( shippingAddress.getCountry().iso2Code().toUpperCase() ) );
}
return ( null );
}
示例2: addAppProvidedShippingAddress
import com.paypal.android.sdk.payments.ShippingAddress; //导入依赖的package包/类
private void addAppProvidedShippingAddress(PayPalPayment paypalPayment) {
ShippingAddress shippingAddress =
new ShippingAddress().recipientName("Mom Parker").line1("52 North Main St.")
.city("Austin").state("TX").postalCode("78729").countryCode("US");
paypalPayment.providedShippingAddress(shippingAddress);
}
示例3: onPayPalClicked
import com.paypal.android.sdk.payments.ShippingAddress; //导入依赖的package包/类
/*****************************************************
*
* Called when pay by PayPal is clicked.
*
*****************************************************/
public void onPayPalClicked( View view )
{
SingleCurrencyAmounts totalCost = getTotalCost();
if ( totalCost != null )
{
// Authorise the payment. Payment is actually taken on the server
// TODO: Remove the credit card payment option
PayPalPayment payment = new PayPalPayment(
totalCost.getAmount(),
totalCost.getCurrencyCode(),
"Product",
PayPalPayment.PAYMENT_INTENT_AUTHORIZE );
// Add any shipping address
ShippingAddress shippingAddress = getShippingAddress();
if ( shippingAddress != null ) payment.providedShippingAddress( getShippingAddress() );
Intent intent = new Intent( getActivity(), com.paypal.android.sdk.payments.PaymentActivity.class );
intent.putExtra( com.paypal.android.sdk.payments.PaymentActivity.EXTRA_PAYMENT, payment );
startActivityForResult( intent, ACTIVITY_REQUEST_CODE_PAYPAL );
}
}