-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathSubMerchants.cs
More file actions
130 lines (115 loc) · 4.61 KB
/
SubMerchants.cs
File metadata and controls
130 lines (115 loc) · 4.61 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using OneOf;
using TrueLayer.Common;
using TrueLayer.Serialization;
namespace TrueLayer.Payments.Model
{
using UltimateCounterpartyUnion = OneOf<SubMerchants.BusinessDivision, SubMerchants.BusinessClient>;
/// <summary>
/// Represents sub-merchants information for payment requests
/// </summary>
public class SubMerchants
{
/// <summary>
/// Creates a new <see cref="SubMerchants"/> instance
/// </summary>
/// <param name="ultimateCounterparty">The ultimate counterparty information</param>
public SubMerchants(UltimateCounterpartyUnion ultimateCounterparty)
{
UltimateCounterparty = ultimateCounterparty;
}
/// <summary>
/// Gets the ultimate counterparty information
/// </summary>
public UltimateCounterpartyUnion UltimateCounterparty { get; }
/// <summary>
/// Represents a business division counterparty
/// </summary>
[JsonDiscriminator("business_division")]
public class BusinessDivision
{
/// <summary>
/// Creates a new <see cref="BusinessDivision"/> instance
/// </summary>
/// <param name="id">UUID generated by you</param>
/// <param name="name">Name of the division</param>
public BusinessDivision(string id, string name)
{
Type = "business_division";
Id = id.NotNullOrWhiteSpace(nameof(id));
Name = name.NotNullOrWhiteSpace(nameof(name));
}
/// <summary>
/// Gets the type of the counterparty
/// </summary>
public string Type { get; }
/// <summary>
/// Gets the UUID generated by you
/// </summary>
public string Id { get; }
/// <summary>
/// Gets the name of the division
/// </summary>
public string Name { get; }
}
/// <summary>
/// Represents a business client counterparty
/// </summary>
[JsonDiscriminator("business_client")]
public class BusinessClient
{
/// <summary>
/// Creates a new <see cref="BusinessClient"/> instance
/// </summary>
/// <param name="tradingName">Trading name of the merchant</param>
/// <param name="commercialName">Commercial name different from trading name (optional)</param>
/// <param name="url">Business website URL (optional)</param>
/// <param name="mcc">Merchant category code (optional)</param>
/// <param name="registrationNumber">Business registration number (optional if address provided)</param>
/// <param name="address">Business address (optional)</param>
public BusinessClient(
string tradingName,
string? commercialName = null,
string? url = null,
string? mcc = null,
string? registrationNumber = null,
Address? address = null)
{
Type = "business_client";
TradingName = tradingName.NotNullOrWhiteSpace(nameof(tradingName));
CommercialName = commercialName.NotEmptyOrWhiteSpace(nameof(commercialName));
Url = url.NotEmptyOrWhiteSpace(nameof(url));
Mcc = mcc.NotEmptyOrWhiteSpace(nameof(mcc));
RegistrationNumber = registrationNumber.NotEmptyOrWhiteSpace(nameof(registrationNumber));
Address = address;
}
/// <summary>
/// Gets the type of the counterparty
/// </summary>
public string Type { get; }
/// <summary>
/// Gets the trading name of the merchant
/// </summary>
public string TradingName { get; }
/// <summary>
/// Gets the commercial name different from trading name
/// </summary>
public string? CommercialName { get; }
/// <summary>
/// Gets the business website URL
/// </summary>
public string? Url { get; }
/// <summary>
/// Gets the merchant category code
/// </summary>
public string? Mcc { get; }
/// <summary>
/// Gets the business registration number
/// </summary>
public string? RegistrationNumber { get; }
/// <summary>
/// Gets the business address
/// </summary>
public Address? Address { get; }
}
}
}