Skip to content

Commit a09f2f9

Browse files
authored
Merge pull request #7 from snavinch/master
+ March 2021 SDK Release
2 parents 759ed12 + 80e904b commit a09f2f9

File tree

36 files changed

+417
-128
lines changed

36 files changed

+417
-128
lines changed

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.Test/Model/PtsV2PaymentsPost201ResponseProcessingInformationTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ public void BankTransferOptionsTest()
7373
// TODO unit test for the property 'BankTransferOptions'
7474
}
7575
/// <summary>
76+
/// Test the property 'PaymentSolution'
77+
/// </summary>
78+
[Test]
79+
public void PaymentSolutionTest()
80+
{
81+
// TODO unit test for the property 'PaymentSolution'
82+
}
83+
/// <summary>
7684
/// Test the property 'EnhancedDataEnabled'
7785
/// </summary>
7886
[Test]

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.Test/Model/Ptsv2paymentsDeviceInformationTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ public void FingerprintSessionIdTest()
9797
// TODO unit test for the property 'FingerprintSessionId'
9898
}
9999
/// <summary>
100+
/// Test the property 'UseRawFingerprintSessionId'
101+
/// </summary>
102+
[Test]
103+
public void UseRawFingerprintSessionIdTest()
104+
{
105+
// TODO unit test for the property 'UseRawFingerprintSessionId'
106+
}
107+
/// <summary>
100108
/// Test the property 'RawData'
101109
/// </summary>
102110
[Test]

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.Test/Model/Ptsv2paymentsTokenInformationTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ public void ShippingAddressTest()
9696
{
9797
// TODO unit test for the property 'ShippingAddress'
9898
}
99+
/// <summary>
100+
/// Test the property 'NetworkTokenOption'
101+
/// </summary>
102+
[Test]
103+
public void NetworkTokenOptionTest()
104+
{
105+
// TODO unit test for the property 'NetworkTokenOption'
106+
}
99107

100108
}
101109

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.Test/Model/Riskv1authenticationsBuyerInformationTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ public void Riskv1authenticationsBuyerInformationInstanceTest()
6464
//Assert.IsInstanceOfType<Riskv1authenticationsBuyerInformation> (instance, "variable 'instance' is a Riskv1authenticationsBuyerInformation");
6565
}
6666

67+
/// <summary>
68+
/// Test the property 'MerchantCustomerId'
69+
/// </summary>
70+
[Test]
71+
public void MerchantCustomerIdTest()
72+
{
73+
// TODO unit test for the property 'MerchantCustomerId'
74+
}
6775
/// <summary>
6876
/// Test the property 'PersonalIdentification'
6977
/// </summary>

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.Test/Model/Riskv1decisionsDeviceInformationTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ public void FingerprintSessionIdTest()
9797
// TODO unit test for the property 'FingerprintSessionId'
9898
}
9999
/// <summary>
100+
/// Test the property 'UseRawFingerprintSessionId'
101+
/// </summary>
102+
[Test]
103+
public void UseRawFingerprintSessionIdTest()
104+
{
105+
// TODO unit test for the property 'UseRawFingerprintSessionId'
106+
}
107+
/// <summary>
100108
/// Test the property 'HttpBrowserEmail'
101109
/// </summary>
102110
[Test]

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Client/ApiClient.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using Newtonsoft.Json;
2222
using RestSharp;
2323
using AuthenticationSdk.core;
24+
using System.Security.Cryptography.X509Certificates;
2425

2526
namespace CyberSource.Client
2627
{
@@ -202,7 +203,18 @@ private RestRequest PrepareRequest(
202203
{
203204
if (postBody.GetType() == typeof(String))
204205
{
205-
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
206+
if (contentType == "application/x-www-form-urlencoded")
207+
{
208+
var bodyParams = JsonConvert.DeserializeObject<Dictionary<string, string>>((string)postBody);
209+
foreach (KeyValuePair<string, string> param in bodyParams)
210+
{
211+
request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost);
212+
}
213+
}
214+
else
215+
{
216+
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
217+
}
206218
}
207219
else if (postBody.GetType() == typeof(byte[]))
208220
{
@@ -342,6 +354,18 @@ public Object CallApi(
342354
RestClient.Proxy = Configuration.Proxy;
343355
}
344356

357+
// Adding Client Cert
358+
if(Equals(bool.Parse(Configuration.MerchantConfigDictionaryObj["enableClientCert"]), true))
359+
{
360+
string clientCertDirectory = Configuration.MerchantConfigDictionaryObj["clientCertDirectory"];
361+
string clientCertFile = Configuration.MerchantConfigDictionaryObj["clientCertFile"];
362+
string clientCertPassword = Configuration.MerchantConfigDictionaryObj["clientCertPassword"];
363+
string fileName = Path.Combine(clientCertDirectory, clientCertFile);
364+
// Importing Certificates
365+
var certificate = new X509Certificate2(fileName, clientCertPassword);
366+
RestClient.ClientCertificates = new X509CertificateCollection { certificate };
367+
}
368+
345369
InterceptRequest(request);
346370
response = (RestResponse) RestClient.Execute(request);
347371
InterceptResponse(request, response);
@@ -764,6 +788,11 @@ public void CallAuthenticationHeaders(string requestType, string requestTarget,
764788
if (merchantConfig.IsPostRequest || merchantConfig.IsPutRequest || merchantConfig.IsPatchRequest)
765789
authenticationHeaders.Add("Digest", httpSign.Digest);
766790
}
791+
else if (merchantConfig.IsOAuthTokenAuthType)
792+
{
793+
var oAuthToken = authorize.GetOAuthToken();
794+
authenticationHeaders.Add("Authorization", oAuthToken.AccessToken);
795+
}
767796

768797
if (!string.IsNullOrEmpty(Configuration.ClientId))
769798
{

cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Model/PtsV2PaymentsPost201ResponseProcessingInformation.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ public partial class PtsV2PaymentsPost201ResponseProcessingInformation : IEquat
3434
/// Initializes a new instance of the <see cref="PtsV2PaymentsPost201ResponseProcessingInformation" /> class.
3535
/// </summary>
3636
/// <param name="BankTransferOptions">BankTransferOptions.</param>
37+
/// <param name="PaymentSolution">Type of digital payment solution for the transaction. Possible Values: - &#x60;visacheckout&#x60;: Visa Checkout. This value is required for Visa Checkout transactions. For details, see &#x60;payment_solution&#x60; field description in [Visa Checkout Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/VCO_SCMP_API/html/) - &#x60;001&#x60;: Apple Pay. - &#x60;004&#x60;: Cybersource In-App Solution. - &#x60;005&#x60;: Masterpass. This value is required for Masterpass transactions on OmniPay Direct. For details, see \&quot;Masterpass\&quot; in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/) - &#x60;006&#x60;: Android Pay. - &#x60;007&#x60;: Chase Pay. - &#x60;008&#x60;: Samsung Pay. - &#x60;012&#x60;: Google Pay. - &#x60;014&#x60;: Mastercard credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token. - &#x60;015&#x60;: Visa credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token. .</param>
3738
/// <param name="EnhancedDataEnabled">The possible values for the reply field are: - &#x60;true&#x60; : the airline data was included in the request to the processor. - &#x60;false&#x60; : the airline data was not included in the request to the processor. Returned by authorization, capture, or credit services. .</param>
38-
public PtsV2PaymentsPost201ResponseProcessingInformation(PtsV2PaymentsPost201ResponseProcessingInformationBankTransferOptions BankTransferOptions = default(PtsV2PaymentsPost201ResponseProcessingInformationBankTransferOptions), bool? EnhancedDataEnabled = default(bool?))
39+
public PtsV2PaymentsPost201ResponseProcessingInformation(PtsV2PaymentsPost201ResponseProcessingInformationBankTransferOptions BankTransferOptions = default(PtsV2PaymentsPost201ResponseProcessingInformationBankTransferOptions), string PaymentSolution = default(string), bool? EnhancedDataEnabled = default(bool?))
3940
{
4041
this.BankTransferOptions = BankTransferOptions;
42+
this.PaymentSolution = PaymentSolution;
4143
this.EnhancedDataEnabled = EnhancedDataEnabled;
4244
}
4345

@@ -47,6 +49,13 @@ public partial class PtsV2PaymentsPost201ResponseProcessingInformation : IEquat
4749
[DataMember(Name="bankTransferOptions", EmitDefaultValue=false)]
4850
public PtsV2PaymentsPost201ResponseProcessingInformationBankTransferOptions BankTransferOptions { get; set; }
4951

52+
/// <summary>
53+
/// Type of digital payment solution for the transaction. Possible Values: - &#x60;visacheckout&#x60;: Visa Checkout. This value is required for Visa Checkout transactions. For details, see &#x60;payment_solution&#x60; field description in [Visa Checkout Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/VCO_SCMP_API/html/) - &#x60;001&#x60;: Apple Pay. - &#x60;004&#x60;: Cybersource In-App Solution. - &#x60;005&#x60;: Masterpass. This value is required for Masterpass transactions on OmniPay Direct. For details, see \&quot;Masterpass\&quot; in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/) - &#x60;006&#x60;: Android Pay. - &#x60;007&#x60;: Chase Pay. - &#x60;008&#x60;: Samsung Pay. - &#x60;012&#x60;: Google Pay. - &#x60;014&#x60;: Mastercard credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token. - &#x60;015&#x60;: Visa credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token.
54+
/// </summary>
55+
/// <value>Type of digital payment solution for the transaction. Possible Values: - &#x60;visacheckout&#x60;: Visa Checkout. This value is required for Visa Checkout transactions. For details, see &#x60;payment_solution&#x60; field description in [Visa Checkout Using the SCMP API.](https://apps.cybersource.com/library/documentation/dev_guides/VCO_SCMP_API/html/) - &#x60;001&#x60;: Apple Pay. - &#x60;004&#x60;: Cybersource In-App Solution. - &#x60;005&#x60;: Masterpass. This value is required for Masterpass transactions on OmniPay Direct. For details, see \&quot;Masterpass\&quot; in the [Credit Card Services Using the SCMP API Guide.](https://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_SCMP_API/html/) - &#x60;006&#x60;: Android Pay. - &#x60;007&#x60;: Chase Pay. - &#x60;008&#x60;: Samsung Pay. - &#x60;012&#x60;: Google Pay. - &#x60;014&#x60;: Mastercard credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token. - &#x60;015&#x60;: Visa credential on file (COF) payment network token. Returned in authorizations that use a payment network token associated with a TMS token. </value>
56+
[DataMember(Name="paymentSolution", EmitDefaultValue=false)]
57+
public string PaymentSolution { get; set; }
58+
5059
/// <summary>
5160
/// The possible values for the reply field are: - &#x60;true&#x60; : the airline data was included in the request to the processor. - &#x60;false&#x60; : the airline data was not included in the request to the processor. Returned by authorization, capture, or credit services.
5261
/// </summary>
@@ -63,6 +72,7 @@ public override string ToString()
6372
var sb = new StringBuilder();
6473
sb.Append("class PtsV2PaymentsPost201ResponseProcessingInformation {\n");
6574
sb.Append(" BankTransferOptions: ").Append(BankTransferOptions).Append("\n");
75+
sb.Append(" PaymentSolution: ").Append(PaymentSolution).Append("\n");
6676
sb.Append(" EnhancedDataEnabled: ").Append(EnhancedDataEnabled).Append("\n");
6777
sb.Append("}\n");
6878
return sb.ToString();
@@ -105,6 +115,11 @@ public bool Equals(PtsV2PaymentsPost201ResponseProcessingInformation other)
105115
this.BankTransferOptions != null &&
106116
this.BankTransferOptions.Equals(other.BankTransferOptions)
107117
) &&
118+
(
119+
this.PaymentSolution == other.PaymentSolution ||
120+
this.PaymentSolution != null &&
121+
this.PaymentSolution.Equals(other.PaymentSolution)
122+
) &&
108123
(
109124
this.EnhancedDataEnabled == other.EnhancedDataEnabled ||
110125
this.EnhancedDataEnabled != null &&
@@ -125,6 +140,8 @@ public override int GetHashCode()
125140
// Suitable nullity checks etc, of course :)
126141
if (this.BankTransferOptions != null)
127142
hash = hash * 59 + this.BankTransferOptions.GetHashCode();
143+
if (this.PaymentSolution != null)
144+
hash = hash * 59 + this.PaymentSolution.GetHashCode();
128145
if (this.EnhancedDataEnabled != null)
129146
hash = hash * 59 + this.EnhancedDataEnabled.GetHashCode();
130147
return hash;
@@ -138,6 +155,12 @@ public override int GetHashCode()
138155
/// <returns>Validation Result</returns>
139156
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
140157
{
158+
// PaymentSolution (string) maxLength
159+
if(this.PaymentSolution != null && this.PaymentSolution.Length >= 12)
160+
{
161+
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PaymentSolution, length must be less than or equal to 12.", new [] { "PaymentSolution" });
162+
}
163+
141164
yield break;
142165
}
143166
}

0 commit comments

Comments
 (0)