Skip to content

Commit

Permalink
Merge pull request #172 from vtex-apps/fix/country-code
Browse files Browse the repository at this point in the history
allow two digit country codes
  • Loading branch information
btalma authored Jun 25, 2024
2 parents 0cc6b18 + 9094940 commit 802fe80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Accept two digit country codes

## [1.22.0] - 2024-06-03

### Fixed
Expand Down
9 changes: 8 additions & 1 deletion dotnet/Services/CybersourcePaymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,14 @@ public string GetCountryCode(string country)
string retval = string.Empty;
if (!string.IsNullOrEmpty(country))
{
retval = CybersourceConstants.CountryCodesMapping[country];
if (country.Length == 2)
{
retval = country;
}
else if (country.Length == 3)
{
retval = CybersourceConstants.CountryCodesMapping[country];
}
}

return retval;
Expand Down

0 comments on commit 802fe80

Please sign in to comment.