net.rimlib.blackberry.api.paymentsdk
Class PurchaseArgumentsBuilder

java.lang.Object
  extended by net.rimlib.blackberry.api.paymentsdk.PurchaseArgumentsBuilder

public class PurchaseArgumentsBuilder
extends java.lang.Object

Builds a PurchaseArguments object used for initiating a digital good purchase using PaymentEngine.purchase(PurchaseArguments). A PurchaseArguments object is created by instantiating a builder, invoking any number of the withXXX() methods to set the desired arguments, and invoking the build() method. The withXXX() methods return a reference to the builder object so they can be chained together for better readability as seen in the following example:

 PurchaseArgumentsBuilder arguments = new PurchaseArgumentsBuilder()
                                      .withDigitalGoodId( "1234" )
                                      .withDigitalGoodName( "My Digital Good" )
                                      .withPurchasingAppName( "My Application" );
 PaymentEngine engine = PaymentEngine.getInstance();
 engine.purchase( arguments.build() );
 

Required Arguments

Optional Arguments

The optional purchase arguments are used to customize the purchase experience for the end user.

See Also:
PaymentEngine, PurchaseArguments

Field Summary
static java.lang.String PURCHASE_VENDOR_CONTENT_ID
           
static java.lang.String PURCHASE_VENDOR_CUSTOMER_ID
           
static java.lang.String REQUESTID_REQUESTOR_PID
           
static java.lang.String REQUESTOID_PAYER_DISPLAY_NAME
           
static java.lang.String REQUESTOID_REQUESTOR_DISPLAY_NAME
           
static java.lang.String REQUESTOID_URL_DISPLAY_NAME_OF_URL
           
static java.lang.String REQUESTOID_URL_TO_LAUNCH_VENDOR_APPLICATION
           
 
Constructor Summary
PurchaseArgumentsBuilder()
          Creates a new builder.
 
Method Summary
 PurchaseArguments build()
          Builds a PurchaseArguments object containing all the arguments set with the withXXX methods.
 PurchaseArgumentsBuilder withDigitalGoodId(java.lang.String digitalGoodId)
          Sets the ID of the digital good to be purchased.
 PurchaseArgumentsBuilder withDigitalGoodName(java.lang.String digitalGoodName)
          Sets the name of the digital good to be purchased.
 PurchaseArgumentsBuilder withDigitalGoodSku(java.lang.String digitalGoodSku)
          Sets the SKU of the digital good to be purchased.
 PurchaseArgumentsBuilder withMetadata(java.lang.String metadata)
          Sets the metadata to be associated with the purchase.
 PurchaseArgumentsBuilder withProperty(java.lang.String tag, java.lang.String value)
          Sets additional properties that will be passed to the Payment Service with the given tag and value.
 PurchaseArgumentsBuilder withPurchasingAppIcon(Bitmap purchasingAppIcon)
          Sets the icon of the application requesting the purchase.
 PurchaseArgumentsBuilder withPurchasingAppName(java.lang.String purchasingAppName)
          Sets the name of the application requesting the purchase.
 PurchaseArgumentsBuilder withVendorCustomerId(java.lang.String vendorid)
          Sets the PID (from the vendor's separate BlackBerry ID for this user), provided by the vendor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PURCHASE_VENDOR_CUSTOMER_ID

public static final java.lang.String PURCHASE_VENDOR_CUSTOMER_ID
See Also:
Constant Field Values

PURCHASE_VENDOR_CONTENT_ID

public static final java.lang.String PURCHASE_VENDOR_CONTENT_ID
See Also:
Constant Field Values

REQUESTID_REQUESTOR_PID

public static final java.lang.String REQUESTID_REQUESTOR_PID
See Also:
Constant Field Values

REQUESTOID_REQUESTOR_DISPLAY_NAME

public static final java.lang.String REQUESTOID_REQUESTOR_DISPLAY_NAME
See Also:
Constant Field Values

REQUESTOID_PAYER_DISPLAY_NAME

public static final java.lang.String REQUESTOID_PAYER_DISPLAY_NAME
See Also:
Constant Field Values

REQUESTOID_URL_DISPLAY_NAME_OF_URL

public static final java.lang.String REQUESTOID_URL_DISPLAY_NAME_OF_URL
See Also:
Constant Field Values

REQUESTOID_URL_TO_LAUNCH_VENDOR_APPLICATION

public static final java.lang.String REQUESTOID_URL_TO_LAUNCH_VENDOR_APPLICATION
See Also:
Constant Field Values
Constructor Detail

PurchaseArgumentsBuilder

public PurchaseArgumentsBuilder()
Creates a new builder.

Method Detail

withDigitalGoodId

public PurchaseArgumentsBuilder withDigitalGoodId(java.lang.String digitalGoodId)
Sets the ID of the digital good to be purchased.

Parameters:
digitalGoodId - The digital good's ID.
Returns:
A reference to the current builder for method chaining.

withVendorCustomerId

public PurchaseArgumentsBuilder withVendorCustomerId(java.lang.String vendorid)
Sets the PID (from the vendor's separate BlackBerry ID for this user), provided by the vendor. For purchase.

Parameters:
vendorid - The PID (from the vendor's separate BlackBerry ID for this user), provided by the vendor. For purchase. Optional parameter.
Returns:
A reference to the current builder for method chaining.

withDigitalGoodName

public PurchaseArgumentsBuilder withDigitalGoodName(java.lang.String digitalGoodName)
Sets the name of the digital good to be purchased.

Parameters:
digitalGoodName - The digital good's name. This value is found on the vendor portal and is assigned by the system. You can use this value OR the user defined SKU to specify the digital good.
Returns:
A reference to the current builder for method chaining.

withPurchasingAppName

public PurchaseArgumentsBuilder withPurchasingAppName(java.lang.String purchasingAppName)
Sets the name of the application requesting the purchase.

Parameters:
purchasingAppName - The purchasing application's name.
Returns:
A reference to the current builder for method chaining.

withPurchasingAppIcon

public PurchaseArgumentsBuilder withPurchasingAppIcon(Bitmap purchasingAppIcon)
Sets the icon of the application requesting the purchase.

Parameters:
purchasingAppIcon - The purchasing application's icon.
Returns:
A reference to the current builder for method chaining.

withMetadata

public PurchaseArgumentsBuilder withMetadata(java.lang.String metadata)
Sets the metadata to be associated with the purchase.

Parameters:
metadata - The metadata to be associated with the purchase.
Returns:
A reference to the current builder for method chaining.

withDigitalGoodSku

public PurchaseArgumentsBuilder withDigitalGoodSku(java.lang.String digitalGoodSku)
Sets the SKU of the digital good to be purchased.

Parameters:
digitalGoodSku - The digital good's SKU. This is what ever value you chose on the portal for the SKU.
Returns:
A reference to the current builder for method chaining.

withProperty

public PurchaseArgumentsBuilder withProperty(java.lang.String tag,
                                             java.lang.String value)
Sets additional properties that will be passed to the Payment Service with the given tag and value. Tags and values that are supported and how there are handled will be published by the Payment server.

Parameters:
tag - The key to send to the server and associate with the value.
value - The value to send to the server and associate with the key. This tag value pair will be both be passed to the server.
Returns:
A reference to the current builder for method chaining.
Throws:
A - ReservedKeyUsed exception if the tag is already used by the system.

build

public PurchaseArguments build()
Builds a PurchaseArguments object containing all the arguments set with the withXXX methods.

Returns:
A new PurchaseArguments object.