Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tis-280 add acquirer_region, credit_card_country to cc_payment_details #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Riskified.SDK/Model/OrderElements/CreditCardPaymentDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public CreditCardPaymentDetails(string avsResultCode,
string creditCardToken = null,
DateTimeOffset? storedPaymentCreatedAt = null,
DateTimeOffset? storedPaymentUpdatedAt = null,
int? installments = null)
int? installments = null,
string acquirerRegion = null,
string creditCardCountry = null)
{
AvsResultCode = avsResultCode;
CvvResultCode = cvvResultCode;
Expand All @@ -42,7 +44,9 @@ public CreditCardPaymentDetails(string avsResultCode,
CreditCardToken = creditCardToken;
StoredPaymentCreatedAt = storedPaymentCreatedAt;
StoredPaymentUpdatedAt = storedPaymentUpdatedAt;
Installments = installments;
Installments = installments;
AcquirerRegion = acquirerRegion;
CreditCardCountry = creditCardCountry;
}

/// <summary>
Expand All @@ -61,6 +65,16 @@ public void Validate(Validations validationType = Validations.Weak)

InputValidators.ValidateValuedString(CreditCardBin, "Credit Card Bin");
InputValidators.ValidateValuedString(CreditCardCompany, "Credit Card Company");

if (AcquirerRegion != null && (AcquirerRegion != "EU" && AcquirerRegion != "NONEU"))
{
throw new OrderFieldBadFormatException("Acquirer Region must be either EU or NONEU.");
}

if (CreditCardCountry != null)
{
InputValidators.ValidateCountryOrProvinceCode(CreditCardCountry);
}
}

[JsonProperty(PropertyName = "avs_result_code")]
Expand Down Expand Up @@ -117,6 +131,12 @@ public void Validate(Validations validationType = Validations.Weak)
[JsonProperty(PropertyName = "installments")]
public int? Installments { get; set; }

[JsonProperty(PropertyName = "acquirer_region")]
public string AcquirerRegion { get; set; }

[JsonProperty(PropertyName = "credit_card_country")]
public string CreditCardCountry { get; set; }

}

}