net.rimlib.blackberry.api.payment
Class PurchaseArgumentsBuilder

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

public final class PurchaseArgumentsBuilder
extends Object

Builds a PurchaseArguments object used for initiating a digital good purchase via 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

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(String digitalGoodId)
          Sets the ID of the digital good to be purchased.
 PurchaseArgumentsBuilder withDigitalGoodName(String digitalGoodName)
          Sets the name of the digital good to be purchased.
 PurchaseArgumentsBuilder withDigitalGoodSku(String digitalGoodSku)
          Sets the SKU of the digital good to be purchased.
 PurchaseArgumentsBuilder withMetadata(String metadata)
          Sets the metadata to be associated with the purchase.
 PurchaseArgumentsBuilder withPurchasingAppIcon(net.rim.device.api.system.Bitmap purchasingAppIcon)
          Sets the icon of the application requesting the purchase.
 PurchaseArgumentsBuilder withPurchasingAppName(String purchasingAppName)
          Sets the name of the application requesting the purchase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PurchaseArgumentsBuilder

public PurchaseArgumentsBuilder()
Creates a new builder.

Method Detail

withDigitalGoodId

public PurchaseArgumentsBuilder withDigitalGoodId(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.

withDigitalGoodSku

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

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

withDigitalGoodName

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

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

withPurchasingAppName

public PurchaseArgumentsBuilder withPurchasingAppName(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(net.rim.device.api.system.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(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.

build

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

Returns:
A new PurchaseArguments object.


Copyright © 2010 Research In Motion Limited. All Rights Reserved.