Loyalty2.svc

Sending a Request to Loyalty2.svc
All calls to the Loyalty2.svc require an Authorization header in the HTTP Web Request Headers of the request. The parameters for the request body of each call are outlined in the sections below.

Loyalty2.svc Endpoint
Endpoint
https://{{server}}.brinkpos.net/Loyalty2.svc


HTTP Web Request Headers
Header Name
Header Value
Authorization
Token {{AccessToken}}

For example, if your AccessToken is 'ABC123', then the value of your Authorization header would be Token ABC123.
This call is to push an Adjustment for a customer.

AddManualAdjustment Request
Data Name
Data Type
Data Description
CustomerId
Guid
Specify the Id of the Customer for this adjustment
GroupToken
string
Specify the Token of the Group to add this adjustment
PlanId
int
Specify the Id of the Plan
ReasonId
int
Specify the Id of the adjustment reason
Value
decimal
Specify the amount of the adjustment


AddManualAdjustment Response
Data Name
Data Type
Data Description
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied

  • ResultCodes specific to AddManualAdjustment:
    • 101 = Invalid customer Id (submitted CustomerId is empty or does not exist)
    • 102 = Loyalty adjustment reason Id does not exist (submitted adjustment reason Id does not exist)
    • 103 = Invalid loyalty plan Id (submitted loyalty plan Id does not exist)
    • 104 = No locations are defined for the group (submitted group token did not have any locations defined)
This call is to retrieve an array of ActivityDetail objects for the location.

GetActivity Request
Data Name
Data Type
Data Description
CustomerId
Guid?
Specify the Customer Id of the Customer you would like to retrieve activity for. This is a required field if StartTime is null, but otherwise can be left null.
GroupToken
string
Specify the token of the group you would like to retrieve activity for
RecordOffset
uint
(Optional) Specify the number of the first record to return in the series.

E.g. A maximum of 1,000 records are returned at a time. This field should be '1' for the first page of data and '1,001' for the second page.
StartTime
DateTimeOffset?
Specify the start date and time from which to retrieve activity for. This is a required field if CustomerId is null, but otherwise can be left null.


GetActivity Response
Data Name
Data Type
Data Description
Activity
Array of ActivityDetail
Activity details for a specific Customer or Group within a period of time
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied


This call is to retrieve an array of AdjustmentDetail objects for the location.

GetAdjustmentDetails Request
Data Name
Data Type
Data Description
GroupToken
string
Specify the token of the group you would like to retrieve activity for
IncludeBulkAdjustments
bool
(Optional) Specify True if you would like details for bulk adjustments to be included, False if not. Default is False if not specified.
RecordOffset
uint
(Optional) Specify the number of the first record to return in the series.

E.g. A maximum of 1,000 records are returned at a time. This field should be '1' for the first page of data and '1,001' for the second page.
StartTime
DateTimeOffset
Specify the start date and time from which to retrieve activity for


GetAdjustmentDetails Response
Data Name
Data Type
Data Description
Adjustments
Array of AdjustmentDetail
Adjustment details for this Group
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied


This call is to retrieve an array of AwardRedemption objects for the location.

GetAwardRedemptions Request
Data Name
Data Type
Data Description
CustomerId
Guid?
Specify the Customer Id of the Customer you would like to retrieve activity for. This is a required field if StartTime is null, but otherwise can be left null.
GroupToken
string
Specify the token of the group you would like to retrieve activity for
RecordOffset
uint
Specify the number of the first record to return in the series.

E.g. A maximum of 1,000 records are returned at a time. This field should be 1 for the first page of data and 1,001 for the second page.
StartTime
DateTimeOffset?
Specify the start date and time to retrieve activity for. This is a required field if CustomerId is null, but otherwise can be left null.


GetAwardRedemptions Response
Data Name
Data Type
Data Description
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
Redemptions
Array of AwardRedemption
Award redemptions for a specific Customer or Group within a period of time
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied


This call is to redeem one or more Awards.

RedeemAwards Request
Data Name
Data Type
Data Description
AllowPartialSuccess
bool
Specify True to allow for valid Award Ids to be processed even if invalid or already redeemed Award Ids have been passed in, or False if you would like only complete failure or complete success. Default is False if not specified.
AwardIds
List<int>
Specify one or more Award Ids to mark as redeemed
GroupToken
string
Specify the Token of the Group to add data for


RedeemAwards Response
Data Name
Data Type
Data Description
AlreadyRedeemedAwardIds
List<int>
Requested Award Ids that have already been marked as redeemed out of those submitted
InvalidAwardIds
List<int>
Requested Award Ids that are invalid out of those submitted
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied
SuccessfulAwardIds
List<int>
Requested Award Ids that have been successfully marked as redeemed out of those submitted
Global Type
All the Types available in Loyalty2.svc will be displayed below.

ActivityDetail Type
Data Name
Data Type
Data Description
CustomerId
Guid
Id of the customer for this ActivityDetail
LocationId
Guid
Id of the location for this ActivityDetail
OrderId
long
Maps to the Id of the Order for this ActivityDetail
PlanId
int
Id of the plan for this ActivityDetail
Time
DateTimeOffset
Time of activity for this ActivityDetail in the location's local time
Type
byte
Returns one of the following:
  • 0 = NewCard (a new card was issued)
  • 1 = GrantValue (value was added to a card)
  • 2 = RedeemValue (value was redeemed from a card)
  • 3 = ManualAdjustment (a manual adjustment was added)
Value
decimal
Amount for this ActivityDetail

AdjustmentDetail Type
Data Name
Data Type
Data Description
ActivityType
int
Returns one of the following:
  • 0 = NewCard (a new card was issued)
  • 1 = GrantValue (value was added to a card)
  • 2 = RedeemValue (value was redeemed from a card)
  • 3 = ManualAdjustment (a manual adjustment was added)
CustomerId
Guid
Id of the customer for this AdjustmentDetail
IsBulkAdjustment
bool
True if adjustment was part of a bulk operation, False if not
Notes
string
Special instructions or notes for this AdjustmentDetail
PlanId
int
Id of the plan for this AdjustmentDetail
ReasonId
int
Id for the adjustment reason for this AdjustmentDetail
RewardId
int?
Id for the reward for this AdjustmentDetail, if applicable
RewardValue
decimal?
Amount of the reward for this AdjustmentDetail, if applicable
Time
DateTimeOffset
Time of this AdjustmentDetail using the location's local time
Value
decimal
Amount of the adjustment

AwardRedemption Type
Data Name
Data Type
Data Description
AwardId
int
Id of the award for this AwardRedemption
Id
int
Id of the redemption for this AwardRedemption
LocationId
Guid
Id of the location for this AwardRedemption
OrderId
long
Maps to the Id of the Order for this AwardRedemption
Time
DateTimeOffset
Time of adjustment for this AwardRedemption in the location's local time
Value
decimal
Amount for this AwardRedemption

                    
                        
                        
                        
                        
AddManualAdjustment Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Loyalty2_AddManualAdjustment.Loyalty2ServiceReference; namespace Loyalty2_AddManualAdjustment { class Program { static void Main(string[] args) { //Connect to Loyalty2 service client var client = new LoyaltyWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include token in HTTP Web Request Header var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["Authorization"] = @"Token {{AccessToken}}"; Guid customerId = Empty.Guid; String groupToken = @"GroupToken"; int planId = 123; int reasonId = 123; decimal value = 123M; //Include all parameters in request body var request = new AddManualAdjustmentRequest() { CustomerId = customerId, GroupToken = groupToken, PlanId = planId, ReasonId = reasonId, Value = value, }; //Make AddManualAdjustment call var response = client.AddManualAdjustment(request); if (response.ResultCode == 0) { Console.WriteLine("Success!"); Console.WriteLine("---------------------------"); Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
AddManualAdjustment Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference8; using System.ServiceModel; using System.ServiceModel.Channels; namespace Loyalty2_AddManualAdjustment { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLoyaltyServiceClient() { services.AddTransient<ILoyaltyWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILoyaltyWebService2> factory = new ChannelFactory<ILoyaltyWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLoyaltyServiceClient(); ILoyaltyWebService2 client = services.BuildServiceProvider().GetRequiredService<ILoyaltyWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; Guid customerId = new Guid("fd405d23-ce88-4385-98a9-f496014439b9"); String groupToken = "b05c3b2d265c4b04826606d2f63fbd96"; int planId = 4005247; int reasonId = 1; decimal value = 20; //Include all parameters in request body var request = new AddManualAdjustmentRequest() { CustomerId = customerId, GroupToken = groupToken, PlanId = planId, ReasonId = reasonId, Value = value, }; //Make AddManualAdjustment call var response = client.AddManualAdjustmentAsync(request); Console.WriteLine("AddManualAdjustment"); Console.WriteLine("-------------------"); if (response.Result.ResultCode == 0) { Console.WriteLine("Success!"); Console.WriteLine("---------------------------"); Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.Result.ResultCode); Console.WriteLine("Message: " + response.Result.Message); Console.ReadKey(); } } } catch (Exception ex) { Console.WriteLine("Error calling AddManualAdjustment operation: " + ex.Message); } } } }
AddManualAdjustment Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/loyalty/v2" xmlns:pos="http://schemas.datacontract.org/2004/07/Pos.Web.Service.Loyalty.Version2.Operations"> <soapenv:Header/> <soapenv:Body> <v2:AddManualAdjustment> <v2:request> <pos:CustomerId>00000000-0000-0000-0000-000000000000</pos:CustomerId> <pos:GroupToken>GroupToken</pos:GroupToken> <pos:PlanId>123</pos:PlanId> <pos:ReasonId>456</pos:ReasonId> <pos:Value>789</pos:Value> </v2:request> </v2:AddManualAdjustment> </soapenv:Body> </soapenv:Envelope>
AddManualAdjustment Sample Code
from zeep import Client from zeep.transports import Transport import requests from decimal import Decimal import uuid accessToken = 'AccessToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'Authorization': "Token {}".format(accessToken)}) transport = Transport(session=session) #Connect to Loyalty2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/loyalty/v2}BasicHttpBinding_ILoyaltyWebService2', 'https://{YourStack}.brinkpos.net/loyalty2.svc' ) #Prepare the dynamic type for AddManualAdjustmentRequest reqType = client.get_type('ns2:AddManualAdjustmentRequest') customerId = uuid.UUID('{00000000-0000-0000-0000-000000000000}') groupToken = 'GroupToken' planId = 123 reasonId = 123 value = Decimal(123) #Include all parameters in request body req = reqType( CustomerId=customerId, GroupToken=groupToken, PlanId=planId, ReasonId=reasonId, Value=value, ) try: #Make AddManualAdjustment call res = service.AddManualAdjustment(req) #If call is successful if res.ResultCode == 0: print('Success!') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
GetActivity Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Loyalty2_GetActivity.Loyalty2ServiceReference; namespace Loyalty2_GetActivity { class Program { static void Main(string[] args) { //Connect to Loyalty2 service client var client = new LoyaltyWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include token in HTTP Web Request Header var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["Authorization"] = @"Token {{AccessToken}}"; String groupToken = @"GroupToken"; DateTimeOffset startTime = new DateTimeOffset(2001, 01, 01, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 1; Guid customerId = new Guid(); //Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body var request = new GetActivityRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, CustomerId = customerId, }; //Make GetActivity call var response = client.GetActivity(request); //If call is successful if (response.ResultCode == 0) { if (response.Activity.Length > 0) { //Loop through collection of ActivityDetail objects returned foreach (var detail in response.Activity) { Console.WriteLine("CustomerId: " + detail.CustomerId); Console.WriteLine("LocationId: " + detail.LocationId); Console.WriteLine("OrderId: " + detail.OrderId); Console.WriteLine("PlanId: " + detail.PlanId); Console.WriteLine("Time: " + detail.Time); Console.WriteLine("Type: " + detail.Type); Console.WriteLine("Value: " + detail.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Activity Details"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
GetActivity Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference8; using System.ServiceModel; using System.ServiceModel.Channels; namespace Loyalty2_GetActivity { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLoyaltyServiceClient() { services.AddTransient<ILoyaltyWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILoyaltyWebService2> factory = new ChannelFactory<ILoyaltyWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLoyaltyServiceClient(); ILoyaltyWebService2 client = services.BuildServiceProvider().GetRequiredService<ILoyaltyWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; String groupToken = "b05c3b2d265c4b04826606d2f63fbd96"; DateTimeOffset startTime = new DateTimeOffset(2022, 02, 09, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 0; Guid customerId = new Guid("fd405d23-ce88-4385-98a9-f496014439b9"); //Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body var request = new GetActivityRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, CustomerId = customerId, }; //Make GetActivity call var response = client.GetActivityAsync(request); Console.WriteLine("GetActivity"); Console.WriteLine("------------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine(response.Result.ResultCode); if (response.Result.Activity.Length > 0) { //Loop through collection of ActivityDetail objects returned foreach (var detail in response.Result.Activity) { Console.WriteLine("CustomerId: " + detail.CustomerId); Console.WriteLine("LocationId: " + detail.LocationId); Console.WriteLine("OrderId: " + detail.OrderId); Console.WriteLine("PlanId: " + detail.PlanId); Console.WriteLine("Time: " + detail.Time); Console.WriteLine("Type: " + detail.Type); Console.WriteLine("Value: " + detail.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Activity Details"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } } } catch (Exception ex) { Console.WriteLine("Error calling GetActivity operation: " + ex.Message); } } } }
GetActivity Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/loyalty/v2" xmlns:sys="http://schemas.datacontract.org/2004/07/System"> <soapenv:Header/> <soapenv:Body> <v2:GetActivity> <v2:request> <v2:CustomerId>00000000-0000-0000-0000-000000000000</v2:CustomerId> <v2:GroupToken>GroupToken</v2:GroupToken> <v2:RecordOffset>1</v2:RecordOffset> <v2:StartTime> <sys:DateTime>2001-01-01</sys:DateTime> <sys:OffsetMinutes>0</sys:OffsetMinutes> </v2:StartTime> </v2:request> </v2:GetActivity> </soapenv:Body> </soapenv:Envelope>
GetActivity Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime import uuid accessToken = 'AccessToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'Authorization': "Token {}".format(accessToken)}) transport = Transport(session=session) #Connect to Loyalty2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/loyalty/v2}BasicHttpBinding_ILoyaltyWebService2', 'https://{YourStack}.brinkpos.net/loyalty2.svc' ) #Prepare the dynamic type for GetActivityRequest datetimeOffsetType = client.get_type('ns5:DateTimeOffset') reqType = client.get_type('ns1:GetActivityRequest') groupToken = 'GroupToken' startTime = datetimeOffsetType( DateTime=datetime(2001, 1, 1), OffsetMinutes=0 ) recordOffset = 1 customerId = uuid.UUID('{00000000-0000-0000-0000-000000000000}') #Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body req = reqType( GroupToken=groupToken, StartTime=startTime, RecordOffset=recordOffset, CustomerId=customerId, ) try: #Make GetActivity call res = service.GetActivity(req) #If call is successful if res.ResultCode == 0: if res.Activity != None: #Loop through collection of ActivityDetail objects returned for detail in res.Activity.ActivityDetail: print('CustomerId: ' + str(detail.CustomerId)) print('LocationId: ' + str(detail.LocationId)) print('OrderId: ' + str(detail.OrderId)) print('PlanId: ' + str(detail.PlanId)) print('Time: ' + str(detail.Time)) print('Type: ' + str(detail.Type)) print('Value: ' + str(detail.Value)) print('---------------------------') else: print('No Activity Details') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
GetAdjustmentDetails Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Loyalty2_GetAdjustmentDetails.Loyalty2ServiceReference; namespace Loyalty2_GetAdjustmentDetails { class Program { static void Main(string[] args) { //Connect to Loyalty2 service client var client = new LoyaltyWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include token in HTTP Web Request Header var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["Authorization"] = @"Token {{AccessToken}}"; String groupToken = @"GroupToken"; DateTimeOffset startTime = new DateTimeOffset(2001, 01, 01, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 1; bool includeBulkAdjustments = true; //Include GroupToken and StartTime parameters (RecordOffset and IncludeBulkAdjustments optional) in request body var request = new GetAdjustmentDetailsRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, IncludeBulkAdjustments = includeBulkAdjustments, }; //Make GetAdjustmentDetails call var response = client.GetAdjustmentDetails(request); //If call is successful if (response.ResultCode == 0) { if (response.Adjustments.Length > 0) { //Loop through collection of AdjustmentDetail objects returned foreach (var detail in response.Adjustments) { Console.WriteLine("Activity Type: " + detail.ActivityType); Console.WriteLine("CustomerId: " + detail.CustomerId); Console.WriteLine("IsBulkAdjustment: " + detail.IsBulkAdjustment); Console.WriteLine("Notes: " + detail.Notes); Console.WriteLine("PlanId: " + detail.PlanId); Console.WriteLine("ReasonId: " + detail.ReasonId); Console.WriteLine("RewardId: " + detail.RewardId); Console.WriteLine("RewardValue: " + detail.RewardValue); Console.WriteLine("Time: " + detail.Time); Console.WriteLine("Value: " + detail.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Adjustment Details"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
GetAdjustmentDetails Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference8; using System.ServiceModel; using System.ServiceModel.Channels; namespace Loyalty2_GetAdjustmentDetails { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLoyaltyServiceClient() { services.AddTransient<ILoyaltyWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILoyaltyWebService2> factory = new ChannelFactory<ILoyaltyWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLoyaltyServiceClient(); ILoyaltyWebService2 client = services.BuildServiceProvider().GetRequiredService<ILoyaltyWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; String groupToken = "b05c3b2d265c4b04826606d2f63fbd96"; DateTimeOffset startTime = new DateTimeOffset(2024, 04, 12, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 0; bool includeBulkAdjustments = true; //Include GroupToken and StartTime parameters (RecordOffset and IncludeBulkAdjustments optional) in request body var request = new GetAdjustmentDetailsRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, IncludeBulkAdjustments = includeBulkAdjustments, }; //Make GetAdjustmentDetails call var response = client.GetAdjustmentDetailsAsync(request); Console.WriteLine("GetAdjustmentDetails"); Console.WriteLine("--------------------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine(response.Result.ResultCode); if (response.Result.Adjustments.Length > 0) { //Loop through collection of AdjustmentDetail objects returned foreach (var detail in response.Result.Adjustments) { Console.WriteLine("Activity Type: " + detail.ActivityType); Console.WriteLine("CustomerId: " + detail.CustomerId); Console.WriteLine("IsBulkAdjustment: " + detail.IsBulkAdjustment); Console.WriteLine("Notes: " + detail.Notes); Console.WriteLine("PlanId: " + detail.PlanId); Console.WriteLine("ReasonId: " + detail.ReasonId); Console.WriteLine("RewardId: " + detail.RewardId); Console.WriteLine("RewardValue: " + detail.RewardValue); Console.WriteLine("Time: " + detail.Time); Console.WriteLine("Value: " + detail.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Adjustment Details"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } } } catch (Exception ex) { Console.WriteLine("Error calling GetAdjustmentDetails operation: " + ex.Message); } } } }
GetAdjustmentDetails Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/loyalty/v2" xmlns:sys="http://schemas.datacontract.org/2004/07/System"> <soapenv:Header/> <soapenv:Body> <v2:GetAdjustmentDetails> <v2:request> <v2:GroupToken>GroupToken</v2:GroupToken> <v2:IncludeBulkAdjustments>true</v2:IncludeBulkAdjustments> <v2:RecordOffset>1</v2:RecordOffset> <v2:StartTime> <sys:DateTime>2001-01-01</sys:DateTime> <sys:OffsetMinutes>0</sys:OffsetMinutes> </v2:StartTime> </v2:request> </v2:GetAdjustmentDetails> </soapenv:Body> </soapenv:Envelope>
GetAdjustmentDetails Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime accessToken = 'AccessToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'Authorization': "Token {}".format(accessToken)}) transport = Transport(session=session) #Connect to Loyalty2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/loyalty/v2}BasicHttpBinding_ILoyaltyWebService2', 'https://{YourStack}.brinkpos.net/loyalty2.svc' ) #Prepare the dynamic type for GetAdjustmentDetailsRequest datetimeOffsetType = client.get_type('ns5:DateTimeOffset') reqType = client.get_type('ns1:GetAdjustmentDetailsRequest') groupToken = 'GroupToken' startTime = datetimeOffsetType( DateTime=datetime(2001, 1, 1), OffsetMinutes=0 ) recordOffset = 1 includeBulkAdjustments = True #Include GroupToken and StartTime parameters (RecordOffset and IncludeBulkAdjustments optional) in request body req = reqType( GroupToken=groupToken, StartTime=startTime, RecordOffset=recordOffset, IncludeBulkAdjustments=includeBulkAdjustments, ) try: #Make GetAdjustmentDetails call res = service.GetAdjustmentDetails(req) #If call is successful if res.ResultCode == 0: if res.Adjustments != None: #Loop through collection of AdjustmentDetail objects returned for detail in res.Adjustments.AdjustmentDetail: print('ActivityType: ' + str(detail.ActivityType)) print('CustomerId: ' + str(detail.CustomerId)) print('IsBulkAdjustment: ' + str(detail.IsBulkAdjustment)) print('Notes: ' + str(detail.Notes)) print('PlanId: ' + str(detail.PlanId)) print('ReasonId: ' + str(detail.ReasonId)) print('RewardId: ' + str(detail.RewardId)) print('RewardValue: ' + str(detail.RewardValue)) print('Time: ' + str(detail.Time)) print('Value: ' + str(detail.Value)) print('---------------------------') else: print('No Adjustment Details') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
GetAwardRedemptions Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Loyalty2_GetAwardRedemptions.Loyalty2ServiceReference; namespace Loyalty2_GetAwardRedemptions { class Program { static void Main(string[] args) { //Connect to Loyalty2 service client var client = new LoyaltyWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include token in HTTP Web Request Header var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["Authorization"] = @"Token {{AccessToken}}"; String groupToken = @"GroupToken"; DateTimeOffset startTime = new DateTimeOffset(2001, 01, 01, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 1; Guid customerId = new Guid(); //Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body var request = new GetAwardRedemptionsRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, CustomerId = customerId, }; //Make GetAwardRedemptions call var response = client.GetAwardRedemptions(request); //If call is successful if (response.ResultCode == 0) { if (response.Redemptions != null) { //Loop through collection of AwardRedemption objects returned foreach (var redemption in response.Redemptions) { Console.WriteLine("Id: " + redemption.Id); Console.WriteLine("AwardId: " + redemption.AwardId); Console.WriteLine("LocationId: " + redemption.LocationId); Console.WriteLine("OrderId: " + redemption.OrderId); Console.WriteLine("Time: " + redemption.Time); Console.WriteLine("Value: " + redemption.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Award Redemptions"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
GetAwardRedemptions Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference8; using System.ServiceModel; using System.ServiceModel.Channels; namespace Loyalty2_GetAwardRedemptions { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLoyaltyServiceClient() { services.AddTransient<ILoyaltyWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILoyaltyWebService2> factory = new ChannelFactory<ILoyaltyWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLoyaltyServiceClient(); ILoyaltyWebService2 client = services.BuildServiceProvider().GetRequiredService<ILoyaltyWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; String groupToken = "b05c3b2d265c4b04826606d2f63fbd96"; DateTimeOffset startTime = new DateTimeOffset(2024, 04, 12, 0, 0, 0, new TimeSpan(0)); uint recordOffset = 0; Guid customerId = new Guid(); //Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body var request = new GetAwardRedemptionsRequest() { GroupToken = groupToken, StartTime = startTime, RecordOffset = recordOffset, CustomerId = customerId, }; //Make GetAwardRedemptions call var response = client.GetAwardRedemptionsAsync(request); Console.WriteLine("GetAwardRedemptions"); Console.WriteLine("---------------------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine(response.Result.ResultCode); if (response.Result.Redemptions != null) { //Loop through collection of AwardRedemption objects returned foreach (var redemption in response.Result.Redemptions) { Console.WriteLine("Id: " + redemption.Id); Console.WriteLine("AwardId: " + redemption.AwardId); Console.WriteLine("LocationId: " + redemption.LocationId); Console.WriteLine("OrderId: " + redemption.OrderId); Console.WriteLine("Time: " + redemption.Time); Console.WriteLine("Value: " + redemption.Value); Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Award Redemptions"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } } } catch (Exception ex) { Console.WriteLine("Error calling GetAwardRedemptions operation: " + ex.Message); } } } }
GetAwardRedemptions Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/loyalty/v2" xmlns:sys="http://schemas.datacontract.org/2004/07/System"> <soapenv:Header/> <soapenv:Body> <v2:GetAwardRedemptions> <v2:request> <v2:CustomerId>00000000-0000-0000-0000-000000000000</v2:CustomerId> <v2:GroupToken>GroupToken</v2:GroupToken> <v2:RecordOffset>1</v2:RecordOffset> <v2:StartTime> <sys:DateTime>2001-01-01</sys:DateTime> <sys:OffsetMinutes>0</sys:OffsetMinutes> </v2:StartTime> </v2:request> </v2:GetAwardRedemptions> </soapenv:Body> </soapenv:Envelope>
GetAwardRedemptions Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime import uuid accessToken = 'AccessToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'Authorization': "Token {}".format(accessToken)}) transport = Transport(session=session) #Connect to Loyalty2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/loyalty/v2}BasicHttpBinding_ILoyaltyWebService2', 'https://{YourStack}.brinkpos.net/loyalty2.svc' ) #Prepare the dynamic type for GetAwardRedemptionsRequest datetimeOffsetType = client.get_type('ns5:DateTimeOffset') reqType = client.get_type('ns1:GetAwardRedemptionsRequest') groupToken = 'GroupToken' startTime = datetimeOffsetType( DateTime=datetime(2001, 1, 1), OffsetMinutes=0 ) recordOffset = 1 customerId = uuid.UUID('{00000000-0000-0000-0000-000000000000}') #Include GroupToken and StartTime parameters (RecordOffset and CustomerId optional) in request body req = reqType( GroupToken=groupToken, StartTime=startTime, RecordOffset=recordOffset, CustomerId=customerId, ) try: #Make GetAwardRedemptions call res = service.GetAwardRedemptions(req) #If call is successful if res.ResultCode == 0: if res.Redemptions != None: #Loop through collection of AwardRedemption objects returned for redemption in res.Redemptions.AwardRedemption: print('Id: ' + str(redemption.Id)) print('AwardId: ' + str(redemption.AwardId)) print('LocationId: ' + str(redemption.LocationId)) print('OrderId: ' + str(redemption.OrderId)) print('Time: ' + str(redemption.Time)) print('Value: ' + str(redemption.Value)) print('---------------------------') else: print('No Award Redemptions') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
RedeemAwards Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Loyalty2_RedeemAwards.Loyalty2ServiceReference; namespace Loyalty2_RedeemAwards { class Program { static void Main(string[] args) { //Connect to Loyalty2 service client var client = new LoyaltyWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include token in HTTP Web Request Header var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["Authorization"] = @"Token {{AccessToken}}"; String groupToken = @"GroupToken"; int[] awardIds = new int[]{ 1, 2, 3}; bool allowPartialSuccess = true; //Include GroupToken and AwardIds parameters (AllowPartialSuccess optional) in request body var request = new RedeemAwardsRequest() { GroupToken = groupToken, AwardIds = awardIds, AllowPartialSuccess = allowPartialSuccess, }; //Make RedeemAwards call var response = client.RedeemAwards(request); //If call is only partially successful or unsuccessful if (response.ResultCode != 0) { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.WriteLine("---------------------------"); } else { Console.WriteLine("Success!"); Console.WriteLine("---------------------------"); } //List status of the awards if (response.AlreadyRedeemedAwardIds.Length > 0) { Console.WriteLine("AlreadyRedeemedAwardIds:"); foreach (var id in response.AlreadyRedeemedAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Already Redeemed Awards"); } Console.WriteLine("---------------------------"); if (response.InvalidAwardIds.Length > 0) { Console.WriteLine("InvalidAwardIds:"); foreach (var id in response.InvalidAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Invalid Awards"); } Console.WriteLine("---------------------------"); if (response.SuccessfulAwardIds.Length > 0) { Console.WriteLine("SuccessfulAwardIds:"); foreach (var id in response.SuccessfulAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Successful Awards"); } Console.WriteLine("---------------------------"); Console.WriteLine("End"); Console.ReadKey(); } } } }
RedeemAwards Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference8; using System.ServiceModel; using System.ServiceModel.Channels; namespace Loyalty2_RedeemAwards { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLoyaltyServiceClient() { services.AddTransient<ILoyaltyWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILoyaltyWebService2> factory = new ChannelFactory<ILoyaltyWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLoyaltyServiceClient(); ILoyaltyWebService2 client = services.BuildServiceProvider().GetRequiredService<ILoyaltyWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; String groupToken = "b05c3b2d265c4b04826606d2f63fbd96"; int[] awardIds = new int[] { 1, 2, 3 }; bool allowPartialSuccess = true; var request = new RedeemAwardsRequest() { GroupToken = groupToken, AwardIds = awardIds, AllowPartialSuccess = allowPartialSuccess, }; //Make RedeemAwards call var response = client.RedeemAwardsAsync(request); Console.WriteLine("RedeemAwards"); Console.WriteLine("-------------"); //If call is only partially successful or unsuccessful if (response.Result.ResultCode != 0) { Console.WriteLine("Error Code: " + response.Result.ResultCode); Console.WriteLine("Message: " + response.Result.Message); Console.WriteLine("---------------------------"); } else { Console.WriteLine("Success!"); Console.WriteLine("---------------------------"); } //List status of the awards if (response.Result.AlreadyRedeemedAwardIds.Length > 0) { Console.WriteLine("AlreadyRedeemedAwardIds:"); foreach (var id in response.Result.AlreadyRedeemedAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Already Redeemed Awards"); } Console.WriteLine("---------------------------"); if (response.Result.InvalidAwardIds.Length > 0) { Console.WriteLine("InvalidAwardIds:"); foreach (var id in response.Result.InvalidAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Invalid Awards"); } Console.WriteLine("---------------------------"); if (response.Result.SuccessfulAwardIds.Length > 0) { Console.WriteLine("SuccessfulAwardIds:"); foreach (var id in response.Result.SuccessfulAwardIds) { Console.WriteLine("\t" + id); } } else { Console.WriteLine("No Successful Awards"); } Console.WriteLine("---------------------------"); Console.WriteLine("End"); Console.ReadKey(); } } catch (Exception ex) { Console.WriteLine("Error calling RedeemAwards operation: " + ex.Message); } } } }
RedeemAwards Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/loyalty/v2" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <soapenv:Header/> <soapenv:Body> <v2:RedeemAwards> <v2:request> <v2:AllowPartialSuccess>true</v2:AllowPartialSuccess> <v2:AwardIds> <!--Zero or more repetitions:--> <arr:int>1</arr:int> <arr:int>2</arr:int> <arr:int>3</arr:int> </v2:AwardIds> <v2:GroupToken>GroupToken</v2:GroupToken> </v2:request> </v2:RedeemAwards> </soapenv:Body> </soapenv:Envelope>
RedeemAwards Sample Code
from zeep import Client from zeep.transports import Transport import requests accessToken = 'AccessToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'Authorization': "Token {}".format(accessToken)}) transport = Transport(session=session) #Connect to Loyalty2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/loyalty/v2}BasicHttpBinding_ILoyaltyWebService2', 'https://{YourStack}.brinkpos.net/loyalty2.svc' ) #Prepare the dynamic type for RedeemAwardsRequest arrayOfIntType = client.get_type('ns6:ArrayOfint') reqType = client.get_type('ns1:RedeemAwardsRequest') awardIds = [1, 2, 3] awardIdsArray = arrayOfIntType(int=awardIds) groupToken = 'GroupToken' allowPartialSuccess = True #Include GroupToken and AwardIds parameters (AllowPartialSuccess optional) in request body req = reqType( GroupToken=groupToken, AwardIds=awardIdsArray, AllowPartialSuccess=allowPartialSuccess, ) try: #Make RedeemAwards call res = service.RedeemAwards(req) #If call is only partially successful or unsuccessful if res.ResultCode != 0: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) print('---------------------------') else: print('Success!') print('---------------------------') #List status of the awards if res.AlreadyRedeemedAwardIds != None: print('AlreadyRedeemedAwardIds:') for id in res.AlreadyRedeemedAwardIds.int: print('\t' + str(id)) else: print('No Already Redeemed Awards') print('---------------------------') if res.InvalidAwardIds != None: print('InvalidAwardIds:') for id in res.InvalidAwardIds.int: print('\t' + str(id)) else: print('No Invalid Awards') print('---------------------------') if res.SuccessfulAwardIds != None: print('SuccessfulAwardIds:') for id in res.SuccessfulAwardIds.int: print('\t' + str(id)) else: print('No Successful Awards') print('---------------------------') print('End') except Exception as e: print(e)