本文整理匯總了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 );
}
}