|
15 | 15 | // ----------------------------------------------------------------------------- |
16 | 16 |
|
17 | 17 | using System.ComponentModel.DataAnnotations; |
| 18 | +using JetBrains.Annotations; |
18 | 19 |
|
19 | 20 | #nullable disable |
20 | 21 |
|
@@ -46,14 +47,20 @@ public class BeneficiaryCreate : IValidatableObject |
46 | 47 |
|
47 | 48 | [Required(ErrorMessage = "Destination is required.")] |
48 | 49 | public CounterpartyCreate Destination { get; set; } |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// Optional reference that will be used by default as TheirReference when creating payouts to this beneficiary |
| 53 | + /// if no TheirReference is specified for the payout. |
| 54 | + /// </summary> |
| 55 | + [CanBeNull] public string TheirReference { get; set; } |
49 | 56 |
|
50 | 57 | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
51 | 58 | { |
52 | 59 | var payout = ToPayout(); |
53 | 60 | payout.Amount = 0.01M; |
54 | 61 | // Use dummy valid values for references. Beneficiaries can have invalid references as |
55 | 62 | // they will be forced to fix them when the payout is created. |
56 | | - payout.TheirReference = "GoodRef"; |
| 63 | + payout.TheirReference = TheirReference ?? "GoodRef"; |
57 | 64 | payout.YourReference = "GoodRef"; |
58 | 65 | return payout.Validate(validationContext); |
59 | 66 | } |
@@ -91,7 +98,8 @@ public Dictionary<string, string> ToDictionary() |
91 | 98 | { nameof(ID), ID.ToString() }, |
92 | 99 | { nameof(MerchantID), MerchantID.ToString() }, |
93 | 100 | { nameof(Name), Name }, |
94 | | - { nameof(Currency), Currency.ToString() } |
| 101 | + { nameof(Currency), Currency.ToString() }, |
| 102 | + { nameof(TheirReference), TheirReference} |
95 | 103 | }; |
96 | 104 |
|
97 | 105 | if (Destination != null) |
|
0 commit comments