-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
47 lines (39 loc) · 1.66 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace ExampleImplementation
{
using System;
using System.Collections.Generic;
using System.Net;
using AuthenticatedEncryption;
using Newtonsoft.Json;
public class Program
{
public static void Main(string[] args)
{
var domain = "INSERT YOUR DOMAIN HERE";
var cryptKeyString = "INSERT YOUR CRYPT KEY HERE";
var authKeyString = "INSERT YOUR AUTH KEY HERE";
var order = new Order
{
Email = "INSERT CONSUMER EMAIL ADDRESS",
Name = "INSERT CONSUMER NAME",
Ref = "INSERT ORDER REFERENCE NUMBER",
Skus = new List<string> { "INSERT SKUS HERE" },
Tags = new List<string> { "INSERT TAGS HERE" }
};
var jsonEncodedOrder = JsonConvert.SerializeObject(order);
var cryptKey = Convert.FromBase64String(cryptKeyString);
var authKey = Convert.FromBase64String(authKeyString);
var cipherText = AuthenticatedEncryption.Encrypt(jsonEncodedOrder, cryptKey, authKey);
var urlEncodedCipherText = WebUtility.UrlEncode(cipherText);
Console.WriteLine($"https://www.trustpilot.com/evaluate-bgl/{domain}?p={urlEncodedCipherText}");
}
public class Order
{
public string Email { get; set; }
public string Name { get; set; }
public string Ref { get; set; }
public List<string> Skus { get; set; }
public List<string> Tags { get; set; }
}
}
}