LoyaltyPartnerClientLoadSaleTransactionBatch Method |
Submitting a single file or multiple files containing Transactions.
If more than 1 file is being submitted, the set the value for BatchOfOldSalesTransaction.Final = 1
Optimum number of Transaction rows per file is 20.
This method is a step in the workflow for Transaction File Batch submission.
public ResultOfBatch LoadSaleTransactionBatch( ManagementGroupRequestOfBatchOfOldSaleTransaction request )
using (var svc = new LoyaltyService.LoyaltyPartnerClient()) { var request = new LoyaltyService.ManagementGroupRequestOfBatchOfOldSaleTransaction(); request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin var batchOfOldSaleTransaction = new LoyaltyService.BatchOfOldSaleTransaction(); batchOfOldSaleTransaction.Final = false;//Required - set this to true if this is the final batch item load batchOfOldSaleTransaction.Key = new Guid("54fd4d4f-dc22-46de-bc70-84200cd4d6a1");;//Required - RSN of the batch var oldSaleTransaction = new LoyaltyService.OldSaleTransaction(); oldSaleTransaction.TransactionID = "Transaction ID"; //Optional - Must be unique. Will be generated if not supplied oldSaleTransaction.PartnerID = "DEMO_ID_123"; //Requied - Must be a valid Partner ID oldSaleTransaction.TerminalID = "Terminal_ID_1"; //Optional oldSaleTransaction.CashierCode = "Cashier_Code_1"; //Optional oldSaleTransaction.ClientVersion = "Client_Version"; //Optional oldSaleTransaction.CardNumber = "21000005"; //Required oldSaleTransaction.TransactionDate = DateTime.Now; //Required - cannot be a future date oldSaleTransaction.TransactionSaleValue = 1234.56M; //Required - must be a value between -100000.00 and 100000.00 oldSaleTransaction.TransactionNotes = "Please process transaction with haste"; //Optional oldSaleTransaction.ProductCode = "Product_123"; //Optional oldSaleTransaction.ItemDescription = "Red Bag"; //Optional oldSaleTransaction.Category = "Products";//Optional oldSaleTransaction.Quantity = 2; //Optional oldSaleTransaction.Department = "Bags"; //Optional oldSaleTransaction.DiscountReason = "Loyal customer"; //Optional oldSaleTransaction.CustomerAccountID = "CA_123";//Optional - links the transaction to a customer account oldSaleTransaction.ProductBrand = "Bag Makers";//Optional oldSaleTransaction.ProductCode = "Product_123"; //Optional var transactionCustomFields = new LoyaltyService.ProfileCustomFieldValues(); transactionCustomFields.CustomText_1 = string.Empty; //Optional CustomText_2 - CustomText_15 available transactionCustomFields.CustomBoolean_1 = false; //Optional CustomBoolean_2 - CustomBoolean_20 available transactionCustomFields.CustomDate_1 = DateTime.MinValue; //Optional CustomDate_2 - CustomDate_15 available transactionCustomFields.CustomDecimal_1 = 0.0M; //Optional CustomDecimal_2 - CustomDecimal_5 available transactionCustomFields.CustomInteger_1 = 0; //Optional CustomInteger_2 - CustomInteger_10 available oldSaleTransaction.CustomFieldValues = transactionCustomFields;//Optional //add transaction to batch items batchOfOldSaleTransaction.Items = new LoyaltyService.OldSaleTransaction[] { oldSaleTransaction }; //add batchOfOldSaleTransaction to request request.Value = batchOfOldSaleTransaction; LoyaltyService.ResultOfBatch result = svc.LoadSaleTransactionBatch(request); if (result.FaultCode == 0) { //Request succeeded } else { //Request failed throw new Exception(result.FaultDescription); } }