/// <exception cref="GPClientException"></exception> public SupercashBatchResult CreateSupercashCouponBatch(SupercashBatchRequest batchRequest) { var restRequest = CreateRestRequest(@"/supercash/coupon/batch", "application/json"); var jsonData = serializeToJson(batchRequest); restRequest.AddParameter("application/json", jsonData, ParameterType.RequestBody); var response = Client.Execute(restRequest); return(ProcessResponse <SupercashBatchResult>(response)); }
public void GPConnectorTestCreateSupercashCouponBatch() { var connector = new GPConnector(TestUtils.API_URL, TestUtils.CLIENT_ID, TestUtils.CLIENT_SECRET); var batchRequest = new SupercashBatchRequest { GoId = TestUtils.GOID, BatchNotificationUrl = "http://www.notify.cz/super", Defaults = new SupercashBatchItem { SubType = SubType.POSTPAID, Amounts = new List <long> { 300, 400, 500, 600, 700, 800, 900, 1000 }, OrderDescription = "Supercash Coupon Batch Test" }, Coupons = new List <SupercashBatchItem> { new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123457", BuyerPhone = "+420777666111", Amounts = new List <long> { 100 } }, new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123458", BuyerPhone = "+420777666222", Amounts = new List <long> { 200 } }, new SupercashBatchItem { BuyerEmail = "*****@*****.**", CustomId = "ID-123459", BuyerPhone = "+420777666333", Amounts = new List <long> { 300 } } } }; try { var result = connector.GetAppToken().CreateSupercashCouponBatch(batchRequest); Assert.NotNull(result); Console.WriteLine(result.ToString()); } catch (GPClientException ex) { Console.WriteLine("Create Supercash Coupon Batch ERROR"); var err = ex.Error; var date = err.DateIssued; foreach (var element in err.ErrorMessages) { // } } }