public class SubscriptionFacadeClient extends AbstractSubscriptionFacadeClient
This class provides common methods that this and other utility class to the Subscription facade can use. This class also provides a set of convenient Java API to represent particular Subscription operations. This set of Java API also include APIs for Web based requests to transform the name value pair request into the appropriate request documents. It also provides a set of methods which are used by the order component to create subscriptions and recurring orders. These methods are not similar to the traditional web methods in terms of the map they receive as input and should not be called directly from the web.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
CHANGE_VERB_ACTION_ADD, CHANGE_VERB_ACTION_CHANGE, CHANGE_VERB_ACTION_CREATE, CHANGE_VERB_ACTION_DELETE, CHANGE_VERB_ACTION_UPDATE
Constructor and Description |
---|
SubscriptionFacadeClient()
Creates an instance of the client to communicate with the Subscription facade.
|
SubscriptionFacadeClient(BusinessContextType businessContext,
javax.security.auth.callback.CallbackHandler callbackHandler)
Creates an instance of the client to communicate with the Subscription facade.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map |
activateSubscription(java.util.Map inputParameters)
Activates a subscription or recurring order.
|
java.util.Map |
cancelSubscription(java.util.Map inputParameters)
Cancels a subscription.
|
java.util.Map |
createRecurringOrder(java.util.Map inputParameters)
Creates a recurring order.
|
java.util.Map |
createSubscriptions(java.util.Map inputParameters)
Creates the subscription entry for all the subscription items that are
present in the order .
|
changeSubscription, getSubscription, getSubscription, getSubscription, processSubscription
createActionExpression, createChangeVerb, createGetVerb, createGetVerb, createProcessVerb, createSyncVerb
public static final java.lang.String COPYRIGHT
public SubscriptionFacadeClient()
public SubscriptionFacadeClient(BusinessContextType businessContext, javax.security.auth.callback.CallbackHandler callbackHandler)
businessContext
- The default business context to associate with the messages
when making requests.callbackHandler
- Used for authentication purposes so the controller can give
the authentication information to the transport when required.public java.util.Map createRecurringOrder(java.util.Map inputParameters) throws SubscriptionException
ProcessSubscription
request with action code
as Create
.The SubscriptionType
object are built
using the buildSubscriptionDataObject
method.
The following parameters are mandatory in the input map.
buildFulfillmentSchedule(Map, Boolean, String)
for the parameters expected in the map.The following parameters are optional depending on the recurring order being placed.
buildPaymentSchedule(Map, Boolean, String)
for the parameters expected in the map.
Map parameters = new HashMap();
parameters.put("currency", new String[] {"USD"});
parameters.put("totalCost", new String[] {"300.00"});
parameters.put("orderId", new String[] {"10003"});
parameters.put("state", "Active");
Map ffmScheduleMap = new HashMap();
ffmScheduleMap.put("startDate", new String[] {"2010-10-16T07:32:48.437Z"});
ffmScheduleMap.put("timePeriod", new String[] {"100"});
ffmScheduleMap.put("timePeriodUOM", new String[] {"DAY"});
ffmScheduleMap.put("ffmFrequency", new String[] {"12"});
ffmScheduleMap.put("fulfillmentFrequencyUOM", new String[] {"DAY"});
ffmScheduleMap.put("numOfFulfillments", new String[] {"100"});
parameters.put("fulfillmentSchedule",ffmScheduleMap);
Map paymentScheduleMap = new HashMap();
paymentScheduleMap.put("paymentFrequency", new String[] {"15"});
paymentScheduleMap.put("paymentFrequencyUOM", new String[] {"DAY"});
parameters.put("paymentSchedule",paymentScheduleMap);
inputParameters
- The map of input parameterspopulateSubscriptionResponse
method.SubscriptionException
- When the operation was not successful.SubscriptionFacadeClient#buildSubscriptionDataObject(Map, Boolean, String)}
public java.util.Map createSubscriptions(java.util.Map inputParameters) throws SubscriptionException
ProcessSubscription
request with action code
as Create
. For all the subscription items in the map, this
method creates separate SubscriptionType
objects and
associates separate action expressions for each of them. The
SubscriptionType
objects are built using the
buildSubscriptionDataObject
method.
The following parameters are mandatory in the input map.
Each map in the subscription items list provides all the details of the item. The details provided are:
buildFulfillmentSchedule(Map, Boolean, String)
for the parameters expected in the map.
buildPaymentSchedule(Map, Boolean, String)
for the parameters expected in the map.
Map parameters = new HashMap();
List subscriptionItems = new ArrayList();
Map subscriptionItem = new HashMap();
subscriptionItem.put("currency", new String[] {"USD"});
subscriptionItem.put("totalCost", new String[] {"200.00"});
subscriptionItem.put("quantity", new String[] {"2"});
subscriptionItem.put("catalogEntryId", new String[] {"10005"});
subscriptionItem.put("orderItemId", new String[] {"10004"});
subscriptionItem.put("state", "Active");
Map ffmScheduleMap = new HashMap();
ffmScheduleMap.put("startDate", new String[] {"2010-10-16T07:32:48.437Z"});
ffmScheduleMap.put("timePeriod", new String[] {"100"});
ffmScheduleMap.put("timePeriodUOM", new String[] {"DAY"});
ffmScheduleMap.put("ffmFrequency", new String[] {"12"});
ffmScheduleMap.put("fulfillmentFrequencyUOM", new String[] {"DAY"});
ffmScheduleMap.put("numOfFulfillments", new String[] {"100"});
subscriptionItem.put("fulfillmentSchedule",ffmScheduleMap);
Map paymentScheduleMap = new HashMap();
paymentScheduleMap.put("paymentFrequency", new String[] {"15"});
paymentScheduleMap.put("paymentFrequencyUOM", new String[] {"DAY"});
subscriptionItem.put("paymentSchedule",paymentScheduleMap);
subscriptionItems.add(subscriptionItem);
parameters.put("subscriptionItems",subscriptionItems);
parameters.put("orderId",new String[] {"20001"});
inputParameters
- The map of input parameterspopulateSubscriptionResponse
method.SubscriptionException
- When the operation was not successful.SubscriptionFacadeClient#buildSubscriptionDataObject(Map, Boolean, String)}
{@link SubscriptionFacadeClient#buildSubscriptionPurchaseDetails(Map, Boolean, String)}
public java.util.Map activateSubscription(java.util.Map inputParameters) throws SubscriptionException
ProcessSubscription
request with action code as Activate
.
The following parameters are mandatory in the input map.
SubscriptionFacadeClient client = new SubscriptionFacadeClient();
Map map = new HashMap();
map.put("subscriptionId", new String[] {"10101"});
client.activateSubscription(map);
SubscriptionFacadeClient client = new SubscriptionFacadeClient();
Map map = new HashMap();
map.put("orderId", new String[] {"1003"});
map.put("orderItemId", new String[] {"1002"});
client.activateSubscription(map);
inputParameters
- inputParameters The map of input parameterspopulateSubscriptionResponse
method.SubscriptionException
- When the operation was not successful.public java.util.Map cancelSubscription(java.util.Map inputParameters) throws SubscriptionException
ProcessSubscription
request with action code as Cancel
.
The below parameter is mandatory in the input map.
SubscriptionFacadeClient client = new SubscriptionFacadeClient();
Map map = new HashMap();
map.put("subscriptionId", new String[] {"10101"});
client.cancelSubscription(map);
inputParameters
- The map of input parameterspopulateSubscriptionResponse
method.SubscriptionException
- When the operation was not successful.