diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java index 0437304d..c3be1798 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java @@ -58,6 +58,8 @@ public static final class Token { public static final String TOKEN_PROP_VENDORNUMBER = "vendorNumber"; public static final String TOKEN_PROP_SHOP_URL = "shopURL"; public static final String TOKEN_PROP_PRIVATE_KEY = "privateKey"; + public static final String TOKEN_PROP_BUNDLE_NUMBER = "bundleNumber"; + public static final String TOKEN_PROP_BUNDLE_PRICE = "bundlePrice"; } public static final class Vendor { diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/service/BundleService.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/service/BundleService.java index c8e1190c..916e2875 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/service/BundleService.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/service/BundleService.java @@ -120,11 +120,13 @@ public static void delete(final Context context, final String number) * @param context determines the vendor on whose behalf the call is performed * @param number bundle number * @param licenseeNumber licensee number + * @param transactionNumber transaction number * @return collection of created licenses. * @throws NetLicensingException any subclass of {@linkplain NetLicensingException}. These exceptions will be transformed to the * corresponding service response messages. */ - public static Page obtain(final Context context, final String number, final String licenseeNumber) + public static Page obtain(final Context context, final String number, final String licenseeNumber, + final String transactionNumber) throws NetLicensingException { CheckUtils.paramNotEmpty(number, "number"); CheckUtils.paramNotEmpty(licenseeNumber, "licenseeNumber"); @@ -134,8 +136,28 @@ public static Page obtain(final Context context, final String number, f final Form form = new Form(); form.param(Constants.Licensee.LICENSEE_NUMBER, licenseeNumber); - final Netlicensing response = NetLicensingService.getInstance().request(context, HttpMethod.POST, endpoint, form, null); + if (StringUtils.isNotBlank(transactionNumber)) { + form.param(Constants.Transaction.TRANSACTION_NUMBER, transactionNumber); + } + + final Netlicensing response = NetLicensingService.getInstance() + .request(context, HttpMethod.POST, endpoint, form, null); return entityFactory.createPage(response, License.class); } + + /** + * Obtain bundle(create licenses from a bundle license templates). + * + * @param context determines the vendor on whose behalf the call is performed + * @param number bundle number + * @param licenseeNumber licensee number + * @return collection of created licenses. + * @throws NetLicensingException any subclass of {@linkplain NetLicensingException}. These exceptions will be transformed to the + * corresponding service response messages. + */ + public static Page obtain(final Context context, final String number, final String licenseeNumber) + throws NetLicensingException { + return obtain(context, number,licenseeNumber, null); + } }