Im running automation where we want to to increment the quantity of a customers subscription plan by 1. Ive been testing with different update bodies but even though I get the "successfully updated" message on calling the update method, the quantity does not increase.
See code below for an example:
info foundSubscriptionID;
getSubscriptionResponse = invokeurl
[
url :subscriptionURL
type :GET
connection:"subscriptions_connection"
];
subscription = getSubscriptionResponse.get("subscription");
plan = subscription.get("plan");
planTotal = plan.get("total");
planTotalDouble = planTotal.toDecimal();
planPrice = plan.get("price");
planPriceDecimal = planPrice.toDecimal();
// Update the total amount
planTotalDouble = planTotalDouble + planPriceDecimal;
plan.put("total", planTotalDouble);
planQuantity = plan.get("quantity");
planQuantityNumber = planQuantity.toNumber();
planQuantityNumber = planQuantityNumber + 1;
//replace quantity of old plan with new plan;
plan.put("quantity",planQuantityNumber);
subscription.put("plan",plan);
info plan;
updateSubscriptionResponse =zoho.subscriptions.update("subscriptions",organizationID,foundSubscriptionID,subscription,"subscriptions_connection");
Another version I tried using just quantity:
otherUpdateBody = {"quantity":planQuantityNumber};
updateSubscriptionResponse = zoho.subscriptions.update("subscriptions",organizationID,foundSubscriptionID,otherUpdateBody,"subscriptions_connection");
What would be the best way to update a plans quantity in a subscription from deluge?