Beispiel #1
0
 public async Task UpdateCrossSaleOfferTest()
 {
     var requestTester = GetRequestTester();
     var offerId       = "1";
     var updateRequest = new CrossSaleOfferUpdateRequest()
     {
         CrossSaleOfferId = offerId,
         CompanyName      = "new name",
         Template         = CrossSaleOfferTemplate.ImageAndText
     };
     await requestTester.TestMethod <CrossSaleOffer>(
         async (api) =>
     {
         await api.UpdateCrossSaleOffer(updateRequest);
     },
         new RequestDescriptor()
     {
         Method    = HttpMethod.Post,
         Action    = "cross-sale-offers/" + offerId,
         Parameter = updateRequest
     }
         );
 }
Beispiel #2
0
        public async Task UpdateCrossSaleOfferTest()
        {
            try
            {
                var createRequest = GetCreateRequest();
                var offer         = await _gateway.CreateCrossSaleOffer(createRequest);

                var updateRequest = new CrossSaleOfferUpdateRequest()
                {
                    CrossSaleOfferId = offer.Id,
                    CompanyName      = "new name",
                    Template         = CrossSaleOfferTemplate.ImageAndText,
                    ImageData        = "iVBORw0KGgoAAAANSUhEUgAAAEEAAAAaCAIAAABn3KYmAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVFhH7c8BDQAwEAOh+Tfd2eCTwwFv93UwdDB0MHQwdDB0MHQwdDB0MHQwdDB0MNw/bB/PbLtQntZXkAAAAABJRU5ErkJggg==",
                    Charge           = new CrossSaleOfferRequestCharge()
                    {
                        Amount   = 20,
                        Capture  = false,
                        Currency = "PLN"
                    },
                    Description     = "new description",
                    Title           = "new title",
                    CompanyLocation = "DE"
                };
                var updatedOffer = await _gateway.UpdateCrossSaleOffer(updateRequest);

                Assert.AreEqual(updateRequest.CompanyLocation, updatedOffer.CompanyLocation);
                Assert.AreEqual(updateRequest.Description, updatedOffer.Description);
                Assert.AreEqual(updateRequest.CompanyName, updatedOffer.CompanyName);
                Assert.AreEqual(updateRequest.Charge.Amount, updatedOffer.Charge.Amount);
                Assert.AreEqual(updateRequest.Title, updatedOffer.Title);
                Assert.AreEqual(updateRequest.Template, updatedOffer.Template);
            }
            catch (SecurionPayException exc)
            {
                HandleApiException(exc);
            }
        }
        public async Task <CrossSaleOffer> UpdateCrossSaleOffer(CrossSaleOfferUpdateRequest request)
        {
            var url = CROSS_SALE_OFFER_PATH + "/" + request.CrossSaleOfferId;

            return(await SendRequest <CrossSaleOffer>(HttpMethod.Post, url, request));
        }