Developer forum

Forum » Development » Add new (Loyalty point) transaction trough API

Add new (Loyalty point) transaction trough API

Kim Søjborg Pedersen
Reply

Hi, is there a method for adding a point transaction to the EcomLoyaltyUserTransaction table?

I see you can do it manually through the backend, but can't find a method for that in the Dynamicweb.Ecommerce.Loyalty namespace https://doc.dynamicweb.com/api/html/4b7e9ebb-41cf-6141-622d-933ab0d1e973.htm#! 

Have a nice day
Kim

 

 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kim

Create a new UserTransaction and call loyalty service CreateTransaction.

Create a UserTransaction:

Dim transaction As New UserTransaction() With {

                    .UserId = order.CustomerAccessUserId,

                    .RewardId = line.RewardPoints.Reward.Id,

                    .TransactionDate = Date.Now,

                    .Points = Math.Abs(Converter.ToDouble(line.RewardPoints.Points)),

                    .Comment = If(String.IsNullOrEmpty(order.Comment), $"Order ID: {order.Id}", order.Comment),

                      .ObjectType = TransactionObjectType.User,

                      .ObjectElement = '123'

                }

BR Nicolai

Votes for this answer: 1
 
Kim Søjborg Pedersen
Reply

Hi Nicolai,

Thanks, in what namespace do I find UserTransaction() ? I think you should check the search function in the API its not working very well :)

BR
Kim

 
Nicolai Pedersen
Reply

Hi Kim

It is in the namespace you linked above and the only class found when searching the API docs :-)

BR Nicolai

Capture.PNG
 
Kim Søjborg Pedersen
Reply

That's really strange, try see my search result, I cant find anything useful

Screenshot_2019-04-29_at_12.37.49.png
 
Nicolai Pedersen
Reply

Looks odd... I have no idea what that can be...!

 

You must be logged in to post in the forum