· 6 years ago · May 29, 2019, 05:10 PM
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5
6namespace Paymentwall
7{
8 public enum ApiType
9 {
10 VirtualCurrency, //Game currency, coins etc
11 DigitalGoods, //(Download able)? stuff like software music etc, Subscriptions & more
12 PaymentCart //Multiple items (like shopping cart)
13 }
14
15 public enum SignatureVersion
16 {
17 One = 1,
18 Two,
19 Three,
20 Default = 3
21 }
22
23 public abstract class Base
24 {
25 /// <summary>
26 /// Paymentwall URL's | Do not change
27 /// </summary>
28 protected const string ChargeURL = "https://api.paymentwall.com/api/pro/v1/charge";
29 protected const string SubscriptionURL = "https://api.paymentwall.com/api/pro/v1/subscription";
30
31 /*
32 * Controllers for APIs
33 */
34 protected const string CONTROLLER_PAYMENT_VIRTUAL_CURRENCY = "ps";
35 protected const string CONTROLELR_PAYMENT_DIGITAL_GOODS = "subscription";
36 protected const string CONTROLLER_PAYMENT_CART = "cart";
37
38 protected List<string> Errors = new List<string>();
39
40 public ApiType ApiType { get; set; }
41
42 /// <summary>
43 /// Paymentwall application key - can be found in your merchant area
44 /// </summary>
45 public string AppKey { get; set; }
46
47 /// <summary>
48 /// Paymentwall secret key - can be found in your merchant area
49 /// </summary>
50 public string SecretKey { get; set; }
51
52 /// <summary>
53 /// Paymentwall Pro API Key
54 /// </summary>
55 public string ProApiKey { get; set; }
56
57 /// <summary>
58 /// Fill the array with the errors found at execution
59 /// </summary>
60 /// <param name="err"> Error description </param>
61 /// <returns></returns>
62 protected int AppendToErrors(string err)
63 {
64 this.Errors.Add(err);
65 return this.Errors.Count;
66 }
67
68 /// <summary>
69 /// Get Error Summary
70 /// </summary>
71 /// <returns></returns>
72 public string GetErrorSummary()
73 {
74 return string.Join("\n", this.Errors);
75 }
76
77 }
78}