Click or drag to resize

LoyaltyCampaignOfferClientInsertCampaignOffer Method

Create a new Campaign Offer, from the submitted values.

Syntax
C#
public Result InsertCampaignOffer(
	ManagementGroupRequestOfCampaignOffer request
)

Parameters

request
Type: LoyaltyServiceManagementGroupRequestOfCampaignOffer

Return Value

Type: Result
Examples
C#
using (var svc = new LoyaltyService.LoyaltyCampaignOfferClient())
{
  var request = new LoyaltyService.ManagementGroupRequestOfCampaignOffer();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var campaignOffer = new LoyaltyService.CampaignOffer();
  var offerRSN = Guid.NewGuid();
  campaignOffer.RSN = offerRSN;//Required
  campaignOffer.Partner_RSN = new Guid("58b10599-0f33-4481-87e3-b4b7ebbcde08");;//Required - RSN of partner
  campaignOffer.OfferName = "10% off all bags";//Required
  campaignOffer.DisplayValue = "10% off all bags";//Required
  campaignOffer.DisplayOrder = 2;//Optional
  campaignOffer.OfferCode = "OFFER_BAGS10";//Optional
  campaignOffer.Active = true;//Optional
  campaignOffer.ActiveFrom = DateTime.Now;//Optional
  campaignOffer.ActiveTo = DateTime.Now.AddMonths(1);//Optional
  campaignOffer.Visible = true;//Optional
  campaignOffer.VisibleFrom = DateTime.Now;//Optional
  campaignOffer.VisibleTo = DateTime.Now.AddMonths(1);//Optional
  campaignOffer.OfferPrice = 12.34m;//Optional
  campaignOffer.StandardPrice = 56.78m;//Optional
  campaignOffer.OfferDetailHeading = "Get 10% off all bags!";//Optional
  campaignOffer.OfferDetailText = "Wide selection of bags at a 10% discount";//Optional
  campaignOffer.URL = "";//Optional
  campaignOffer.AvailableToAllOutlets = false;//Optional
  campaignOffer.BonusPointsType_KeyCode = "2";//Optional - Valid values are : "1", "2", "3", "4" or "extrapoints"
  campaignOffer.BonusPoints_ExtraPointsValue = 5.00m;//Optional - only used if BonusPointsType_KeyCode set to "extrapoints"
  campaignOffer.PointsPrice = 12.34m;//Optional
  campaignOffer.CostPrice = 8.35m;//Optional
  campaignOffer.UseHomeStoreAsFulfilmentPartner = false;//Optional
  campaignOffer.FreightShippingHandlingRequiredOnOrder = false;//Optional
  campaignOffer.BillTo = new Guid("0724d29d-6984-4f9f-b215-04b837163596");;//Optional - RSN of partner
  campaignOffer.FulfilmentPartner_RSN = new Guid("6142590a-49db-48cc-8820-1ba8bdc7217b");;//Optional - RSN of partner
  campaignOffer.FulfilmentType = "SHOPPINGCARTPRODUCTOPTIONALWITHSIZEORCOLOUR";//Required - Valid values are : "NONPERSONALISEDOFFER" or "SHOPPINGCARTPRODUCTOPTIONALWITHSIZEORCOLOUR"
  campaignOffer.OfferMakeup = "SINGLEPRODUCTCODE";//Optional - Valid values are : "SINGLEPRODUCTCODE" or "MULTIPLESIZECOLOURS". Required when FulfilmentType set to "SHOPPINGCARTPRODUCTOPTIONALWITHSIZEORCOLOUR"
  campaignOffer.ProductCode = "Product_123";//Optional - only used if OfferMakeup set to "SINGLEPRODUCTCODE"
  campaignOffer.AdminFeeRequiredOnOrder = true;//Optional
  campaignOffer.ParentCampaignOffer_RSN = Guid.Empty;//Optional - RSN of parent campaign offer
  campaignOffer.ProductSize = "";//Optional
  campaignOffer.ProductColour = "";//Optional
  campaignOffer.MaximumMemberOrders = 0;//Optional
  campaignOffer.MaximumStockOrders = 0;//Optional
  campaignOffer.BonusPoints_Combined_TransactionQuantity_Every_RuleActive = false;//Optional
  campaignOffer.BonusPoints_Combined_TransactionQuantity_Every = 0;//Optional
  campaignOffer.BonusPoints_Combined_TransactionQuantity_EqualOrOver_RuleActive = false;//Optional
  campaignOffer.BonusPoints_Combined_TransactionQuantity_EqualOrOver = 0;//Optional
  campaignOffer.BonusPoints_Combined_TransactionValue_Every_RuleActive = false;//Optional
  campaignOffer.BonusPoints_Combined_TransactionValue_Every = 0;//Optional
  campaignOffer.BonusPoints_Combined_TransactionValue_EqualOrOver_RuleActive = false;//Optional
  campaignOffer.BonusPoints_Combined_TransactionValue_EqualOrOver = 0;//Optional
  campaignOffer.AvailableSizeList = new string[] { "S", "M", "L" };
  campaignOffer.AvailableColourList = new string[] { "Black", "Red", "White" };
  campaignOffer.ChildCampaignOfferPriceOverride = true;//Optional

  var galleryImage = new LoyaltyService.GalleryImage();
  galleryImage.Entity_RSN = offerRSN;//Required - RSN of offer being inserted
  galleryImage.DisplayValue = "RedBag.jpg";//Required
  galleryImage.DisplayOrder = 1;//Optional
  galleryImage.FeaturedImage = true;//Optional
  galleryImage.SourceImage_RSN = new Guid("29D8E0A0-58FD-42B5-B857-E1FAC0B8B60D");//Required
  galleryImage.ThumbnailImage_RSN = new Guid("CFF53DB5-2BC1-4FF7-9603-BCAD3E716FA5");//Required
  galleryImage.PrimaryImage_RSN = new Guid("43BB4703-5DC4-478F-B14F-D70C4A86DDCC");//Required
  //galleryImage.RSN ignored
  campaignOffer.GalleryImages = new LoyaltyService.GalleryImage[] { galleryImage };//Optional

  campaignOffer.PartnerOutlet_RSNs = new Guid[] { new Guid("bf1418de-81cf-445a-9d8e-bd0f66640d35"); };//Optional - RSNs of partner outlets
  campaignOffer.Category_RSNs = new Guid[] { new Guid("da0a8c82-8645-4f53-8f62-12199cf90953"); };//Optional - RSNs of campaign offer categories

  var productStub = new LoyaltyService.ProductStub();
  productStub.RSN = new Guid("15035160-f742-4fd6-992c-015e9b7f64c8");;//Required - RSN of product
  //productStub.DisplayValue ignored
  //productStub.ProductCode ignored
  //productStub.ProductName ignored
  campaignOffer.Products = new LoyaltyService.ProductStub[] { };//Optional

  var productCategory = new LoyaltyService.ProductCategory();
  productCategory.RSN = new Guid("a0fc3d40-e304-4793-bac2-e88e5207ba98");;//Required
  // all other productCategory properties ignored
  campaignOffer.ProductCategories = new LoyaltyService.ProductCategory[] { productCategory };//Optional

  var productDepartment = new LoyaltyService.ProductDepartment();
  productDepartment.RSN = new Guid("bc99d093-fb8d-43bb-8332-6c3c5b303340");;//Required
  // all other productDepartment properties ignored
  campaignOffer.ProductDepartments = new LoyaltyService.ProductDepartment[] { productDepartment };//Optional

  var productBrand = new LoyaltyService.ProductBrand();
  productBrand.RSN = new Guid("4bdf5284-1cda-4c6b-8295-7d06264540ae");;//Required
  // all other productBrand properties ignored
  campaignOffer.ProductBrands = new LoyaltyService.ProductBrand[] { productBrand };//Optional

  var program = new LoyaltyService.ProgramStub();
  program.RSN = new Guid("010185ba-88b8-4296-9bd6-6cd9e333e965");;//Required
  // all other program properties ignored
  campaignOffer.Programs = new LoyaltyService.ProgramStub[] { program };//Optional

  //add campaignOffer to request
  request.Value = campaignOffer;

  LoyaltyService.Result result = svc.InsertCampaignOffer(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded.
  }
  else
  {
    //Request failed
    throw new Exception(result.FaultDescription);
  }
}
See Also