Skip to content

Commit

Permalink
Revert "[CHORE] Merge main to develop" (#1613)
Browse files Browse the repository at this point in the history
Reverts #1611 

This override changes on develop
  • Loading branch information
JiahuiWho authored Jan 9, 2025
2 parents aa11602 + bebb64e commit a9f6f06
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 172 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ subprojects {

allprojects {
group = "org.stellar.anchor-sdk"
version = "3.0.1"
version = "3.0.0"

tasks.jar {
manifest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,17 @@ static void validateSep38(AssetService assetService, Sep38Info sep38Info, String
}
}

// Validate country codes
// TODO: Enable validate country codes in version 3.x because 2.x does not conform to the ISO
// country code
/*
if (sep38Info.getCountryCodes() != null) {
for (String country : sep38Info.getCountryCodes()) {
if (!isCountryCodeValid(country))
throw new InvalidConfigException(
String.format("Invalid country code %s defined for asset %s.", country, assetId));
}
}

*/
if (sep38Info.getBuyDeliveryMethods() != null) {
// Validate methods
for (DeliveryMethod method : sep38Info.getBuyDeliveryMethods()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ items:
# - stellar:USDC:GBN4NNCDGJO4XW4KQU3CBIESUJWFVBUZPOKUZHT7W7WRB7CWOA7BXVQF
exchangeable_assets:

# The list of the ISO 3166-1 alpha-2 country codes that the asset is available in.
# The list of the country codes that the asset is available in.
# Example:
# - US
# - CA
# - USA
# - CAN
country_codes:

# An array of objects describing the methods a client can use to sell/deliver funds to the anchor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ internal class DefaultAssetServiceTest {
"stellar:USDC:GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP"
],
"country_codes": [
"US"
"USA"
],
"sell_delivery_methods": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class InfoResponseTest {

val fiatUSD = assetMap["iso4217:USD"]
assertNotNull(fiatUSD)
assertEquals(listOf("US"), fiatUSD!!.countryCodes)
assertEquals(listOf("USA"), fiatUSD!!.countryCodes)
val wantSellDeliveryMethod =
Sep38Info.DeliveryMethod("WIRE", "Send USD directly to the Anchor's bank account.")
assertEquals(listOf(wantSellDeliveryMethod), fiatUSD.sellDeliveryMethods)
Expand Down
30 changes: 15 additions & 15 deletions core/src/test/kotlin/org/stellar/anchor/sep38/Sep38ServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Sep38ServiceTest {

val fiatUSD = assetMap[fiatUSD]
assertNotNull(fiatUSD)
assertEquals(listOf("US"), fiatUSD!!.countryCodes)
assertEquals(listOf("USA"), fiatUSD!!.countryCodes)
val wantSellDeliveryMethod =
Sep38Info.DeliveryMethod("WIRE", "Send USD directly to the Anchor's bank account.")
assertEquals(listOf(wantSellDeliveryMethod), fiatUSD.sellDeliveryMethods)
Expand Down Expand Up @@ -236,7 +236,7 @@ class Sep38ServiceTest {
.sellAsset(fiatUSD)
.buyAsset("stellar:JPYC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5")
.sellAmount("100")
.countryCode("US")
.countryCode("USA")
.sellDeliveryMethod("WIRE")
.build()
every { mockRateIntegration.getRate(getRateReq1) } returns
Expand All @@ -248,7 +248,7 @@ class Sep38ServiceTest {
.sellAsset(fiatUSD)
.buyAsset(stellarUSDC)
.sellAmount("100")
.countryCode("US")
.countryCode("USA")
.sellDeliveryMethod("WIRE")
.build()
every { mockRateIntegration.getRate(getRateReq2) } returns
Expand All @@ -258,7 +258,7 @@ class Sep38ServiceTest {

// test happy path with all the parameters
var gotResponse: GetPricesResponse? = null
assertDoesNotThrow { gotResponse = sep38Service.getPrices(fiatUSD, "100", "WIRE", null, "US") }
assertDoesNotThrow { gotResponse = sep38Service.getPrices(fiatUSD, "100", "WIRE", null, "USA") }
val wantResponse = GetPricesResponse()
wantResponse.addAsset(stellarJPYC, 2, "1.1")
wantResponse.addAsset(stellarUSDC, 2, "2.1")
Expand Down Expand Up @@ -393,13 +393,13 @@ class Sep38ServiceTest {

// unsupported country_code
getPriceRequestBuilder = getPriceRequestBuilder.buyDeliveryMethod(null)
getPriceRequestBuilder = getPriceRequestBuilder.countryCode("BR")
getPriceRequestBuilder = getPriceRequestBuilder.countryCode("BRA")
ex = assertThrows { sep38Service.getPrice(null, getPriceRequestBuilder.build()) }
assertInstanceOf(BadRequestException::class.java, ex)
assertEquals("Unsupported country code", ex.message)

// unsupported (null) context
getPriceRequestBuilder = getPriceRequestBuilder.countryCode("US")
getPriceRequestBuilder = getPriceRequestBuilder.countryCode("USA")
ex = assertThrows { sep38Service.getPrice(null, getPriceRequestBuilder.build()) }
assertInstanceOf(BadRequestException::class.java, ex)
assertEquals("Unsupported context. Should be one of [sep6, sep31].", ex.message)
Expand Down Expand Up @@ -497,7 +497,7 @@ class Sep38ServiceTest {
.sellAsset(fiatUSD)
.buyAsset(stellarUSDC)
.sellAmount("100")
.countryCode("US")
.countryCode("USA")
.sellDeliveryMethod("WIRE")
.build()
every { mockRateIntegration.getRate(getRateReq) } returns
Expand All @@ -512,7 +512,7 @@ class Sep38ServiceTest {
.sellAmount("100")
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.countryCode("US")
.countryCode("USA")
.context(SEP6)
.build()
var gotResponse: GetPriceResponse? = null
Expand All @@ -537,7 +537,7 @@ class Sep38ServiceTest {
.sellAsset(fiatUSD)
.buyAsset(stellarUSDC)
.buyAmount("100")
.countryCode("US")
.countryCode("USA")
.sellDeliveryMethod("WIRE")
.build()

Expand All @@ -553,7 +553,7 @@ class Sep38ServiceTest {
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.buyAmount("100")
.countryCode("US")
.countryCode("USA")
.context(SEP31)
.build()
var gotResponse: GetPriceResponse? = null
Expand Down Expand Up @@ -788,7 +788,7 @@ class Sep38ServiceTest {
.sellAmount("1.23")
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.countryCode("BR")
.countryCode("BRA")
.build()
)
}
Expand All @@ -804,7 +804,7 @@ class Sep38ServiceTest {
.sellAmount("1.23")
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.countryCode("US")
.countryCode("USA")
.expireAfter("2022-04-18T23:33:24.629719Z")
.build()
)
Expand Down Expand Up @@ -1063,7 +1063,7 @@ class Sep38ServiceTest {
.sellAmount("100")
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.countryCode("US")
.countryCode("USA")
.expireAfter(now.toString())
.build()
)
Expand Down Expand Up @@ -1167,7 +1167,7 @@ class Sep38ServiceTest {
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.buyAmount("100")
.countryCode("US")
.countryCode("USA")
.expireAfter(now.toString())
.build()
)
Expand Down Expand Up @@ -1279,7 +1279,7 @@ class Sep38ServiceTest {
.sellDeliveryMethod("WIRE")
.buyAssetName(stellarUSDC)
.buyAmount(requestBuyAmount)
.countryCode("US")
.countryCode("USA")
.expireAfter(now.toString())
.build()
)
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/test_assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"stellar:USDC:GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP"
],
"country_codes": [
"US"
"USA"
],
"decimals": 4,
"sell_delivery_methods": [
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/test_assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ items:
- stellar:JPYC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
- stellar:USDC:GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP
country_codes:
- US
- USA
sell_delivery_methods:
- name: WIRE
description: Send USD directly to the Anchor's bank account.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![License](https://badgen.net/badge/license/Apache%202/blue?icon=github&label=License)](https://github.com/stellar/java-stellar-anchor-sdk/blob/develop/LICENSE)
[![GitHub Version](https://badgen.net/github/release/stellar/java-stellar-anchor-sdk?icon=github&label=Latest%20release)](https://github.com/stellar/java-stellar-anchor-sdk/releases)
[![Docker](https://badgen.net/badge/Latest%20Release/v3.0.1/blue?icon=docker)](https://hub.docker.com/r/stellar/anchor-platform/tags?page=1&name=3.0.1)
[![Docker](https://badgen.net/badge/Latest%20Release/v3.0.0/blue?icon=docker)](https://hub.docker.com/r/stellar/anchor-platform/tags?page=1&name=3.0.0)
![Develop Branch](https://github.com/stellar/java-stellar-anchor-sdk/actions/workflows/on_push_to_develop.yml/badge.svg?branch=develop)

<div style="text-align: center">
Expand Down
Loading

0 comments on commit a9f6f06

Please sign in to comment.