-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discovered and fixed some issues along the way. The most important is the removal of HRK as supported currency in Revolut and Wise. HRK was replaced by the Euro in 2023. The presence of HRK was preventing the Revolut and Wise FiatPaymentRails enums from being properly initialized (they were throwing NullPointerException).
- Loading branch information
Showing
10 changed files
with
354 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
account/src/test/java/bisq/account/accounts/AchTransferAccountTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package bisq.account.accounts; | ||
|
||
import bisq.account.protobuf.Account; | ||
import bisq.account.protobuf.AccountPayload; | ||
import bisq.account.protobuf.BankAccount; | ||
import bisq.account.protobuf.BankAccountPayload; | ||
import bisq.account.protobuf.CountryBasedAccount; | ||
import bisq.account.protobuf.CountryBasedAccountPayload; | ||
import bisq.account.protobuf.FiatPaymentMethod; | ||
import bisq.account.protobuf.PaymentMethod; | ||
import bisq.common.protobuf.Country; | ||
import bisq.common.protobuf.Region; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static java.lang.System.currentTimeMillis; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.data.Offset.offset; | ||
|
||
class AchTransferAccountTest { | ||
|
||
private static final Account PROTO = Account.newBuilder() | ||
.setAccountName("accountName") | ||
.setCreationDate(123) | ||
.setPaymentMethod(PaymentMethod.newBuilder() | ||
.setName("ACH_TRANSFER") | ||
.setFiatPaymentMethod(FiatPaymentMethod.newBuilder())) | ||
.setAccountPayload(AccountPayload.newBuilder() | ||
.setId("id") | ||
.setPaymentMethodName("ACH_TRANSFER") | ||
.setCountryBasedAccountPayload(CountryBasedAccountPayload.newBuilder() | ||
.setCountryCode("countryCode") | ||
.setBankAccountPayload(BankAccountPayload.newBuilder() | ||
.setBankName("bankName") | ||
.setAchTransferAccountPayload( | ||
bisq.account.protobuf.AchTransferAccountPayload.newBuilder()))) | ||
) | ||
.setCountryBasedAccount(CountryBasedAccount.newBuilder() | ||
.setCountry(Country.newBuilder() | ||
.setCode("countryCode") | ||
.setName("countryName") | ||
.setRegion(Region.newBuilder() | ||
.setCode("regionCode") | ||
.setName("regionName"))) | ||
.setBankAccount(BankAccount.newBuilder() | ||
.setAchTransferAccount(bisq.account.protobuf.AchTransferAccount.newBuilder()))) | ||
.build(); | ||
|
||
private static final AchTransferAccount ACCOUNT = new AchTransferAccount( | ||
"accountName", | ||
new AchTransferAccountPayload("id", "ACH_TRANSFER", "countryCode", null, "bankName", null, null, null, null), | ||
new bisq.common.locale.Country( | ||
"countryCode", | ||
"countryName", | ||
new bisq.common.locale.Region("regionCode", "regionName"))); | ||
|
||
@Test | ||
void toProto() { | ||
var result = ACCOUNT.toProto(); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate_", "memoizedHashCode") | ||
.isEqualTo(PROTO); | ||
} | ||
|
||
@Test | ||
void fromProto() { | ||
var result = AchTransferAccount.fromProto(PROTO); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate") | ||
.isEqualTo(ACCOUNT); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
account/src/test/java/bisq/account/accounts/F2FAccountTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package bisq.account.accounts; | ||
|
||
import bisq.account.protobuf.Account; | ||
import bisq.account.protobuf.AccountPayload; | ||
import bisq.account.protobuf.CountryBasedAccount; | ||
import bisq.account.protobuf.CountryBasedAccountPayload; | ||
import bisq.account.protobuf.F2FAccount; | ||
import bisq.account.protobuf.F2FAccountPayload; | ||
import bisq.account.protobuf.FiatPaymentMethod; | ||
import bisq.account.protobuf.PaymentMethod; | ||
import bisq.common.protobuf.Country; | ||
import bisq.common.protobuf.Region; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static java.lang.System.currentTimeMillis; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.data.Offset.offset; | ||
|
||
class F2FAccountTest { | ||
|
||
private static final Account PROTO = Account.newBuilder() | ||
.setAccountName("accountName") | ||
.setCreationDate(123) | ||
.setPaymentMethod(PaymentMethod.newBuilder() | ||
.setName("F2F") | ||
.setFiatPaymentMethod(FiatPaymentMethod.newBuilder().build()) | ||
.build()) | ||
.setAccountPayload(AccountPayload.newBuilder() | ||
.setId("id") | ||
.setPaymentMethodName("F2F") | ||
.setCountryBasedAccountPayload(CountryBasedAccountPayload.newBuilder() | ||
.setCountryCode("countryCode") | ||
.setF2FAccountPayload(F2FAccountPayload.newBuilder() | ||
.setCity("city") | ||
.setContact("contact") | ||
.setExtraInfo("extraInfo"))) | ||
) | ||
.setCountryBasedAccount(CountryBasedAccount.newBuilder() | ||
.setCountry(Country.newBuilder() | ||
.setCode("countryCode") | ||
.setName("countryName") | ||
.setRegion(Region.newBuilder() | ||
.setCode("regionCode") | ||
.setName("regionName"))) | ||
.setF2FAccount(F2FAccount.newBuilder()) | ||
) | ||
.build(); | ||
|
||
private static final bisq.account.accounts.F2FAccount ACCOUNT = new bisq.account.accounts.F2FAccount( | ||
"accountName", | ||
new bisq.account.accounts.F2FAccountPayload("id", "F2F", "countryCode", "city", "contact", "extraInfo"), | ||
new bisq.common.locale.Country( | ||
"countryCode", | ||
"countryName", | ||
new bisq.common.locale.Region("regionCode", "regionName"))); | ||
|
||
@Test | ||
void toProto() { | ||
var result = ACCOUNT.toProto(); | ||
assertThat(result).usingRecursiveComparison() | ||
.ignoringFields("accountPayload_.memoizedHashCode", "memoizedHashCode", "creationDate_") | ||
.isEqualTo(PROTO); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
} | ||
|
||
@Test | ||
void fromProto() { | ||
var result = bisq.account.accounts.F2FAccount.fromProto(PROTO); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate") | ||
.isEqualTo(ACCOUNT); | ||
assertThat(result.getCreationDate()).isCloseTo(System.currentTimeMillis(), offset(1000L)); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
account/src/test/java/bisq/account/accounts/RevolutAccountTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package bisq.account.accounts; | ||
|
||
import bisq.account.protobuf.Account; | ||
import bisq.account.protobuf.AccountPayload; | ||
import bisq.account.protobuf.FiatPaymentMethod; | ||
import bisq.account.protobuf.PaymentMethod; | ||
import bisq.account.protobuf.RevolutAccount; | ||
import bisq.account.protobuf.RevolutAccountPayload; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static java.lang.System.currentTimeMillis; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.data.Offset.offset; | ||
|
||
class RevolutAccountTest { | ||
|
||
private static final Account PROTO = Account.newBuilder() | ||
.setAccountName("accountName") | ||
.setCreationDate(123) | ||
.setPaymentMethod( | ||
PaymentMethod.newBuilder() | ||
.setName("REVOLUT") | ||
.setFiatPaymentMethod( | ||
FiatPaymentMethod.newBuilder().build()) | ||
.build()) | ||
.setRevolutAccount(RevolutAccount.newBuilder()) | ||
.setAccountPayload(AccountPayload.newBuilder() | ||
.setId("id") | ||
.setPaymentMethodName("REVOLUT") | ||
.setRevolutAccountPayload(RevolutAccountPayload.newBuilder() | ||
.setEmail("email") | ||
.build()) | ||
.build()) | ||
.build(); | ||
|
||
private static final bisq.account.accounts.RevolutAccount ACCOUNT = new bisq.account.accounts.RevolutAccount( | ||
"accountName", "email"); | ||
|
||
@Test | ||
void toProto() { | ||
var result = ACCOUNT.toProto(); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("accountPayload_.id_", "accountPayload_.memoizedHashCode", "creationDate_", "memoizedHashCode") | ||
.isEqualTo(PROTO); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
assertThat(result.getAccountPayload().getId()).isNotEmpty(); | ||
} | ||
|
||
@Test | ||
void fromProto() { | ||
var result = bisq.account.accounts.RevolutAccount.fromProto(PROTO); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate", "accountPayload.id") | ||
.isEqualTo(ACCOUNT); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
assertThat(result.getAccountPayload().getId()).isNotEmpty(); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
account/src/test/java/bisq/account/accounts/SepaAccountTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package bisq.account.accounts; | ||
|
||
import bisq.account.protobuf.AccountPayload; | ||
import bisq.account.protobuf.CountryBasedAccount; | ||
import bisq.account.protobuf.CountryBasedAccountPayload; | ||
import bisq.account.protobuf.FiatPaymentMethod; | ||
import bisq.account.protobuf.PaymentMethod; | ||
import bisq.account.protobuf.SepaAccount; | ||
import bisq.account.protobuf.SepaAccountPayload; | ||
import bisq.common.protobuf.Country; | ||
import bisq.common.protobuf.Region; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static java.lang.System.currentTimeMillis; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.data.Offset.offset; | ||
|
||
class SepaAccountTest { | ||
|
||
private static final bisq.account.protobuf.Account PROTO = bisq.account.protobuf.Account.newBuilder() | ||
.setAccountName("accountName") | ||
.setCreationDate(123) | ||
.setPaymentMethod(PaymentMethod.newBuilder() | ||
.setName("SEPA") | ||
.setFiatPaymentMethod(FiatPaymentMethod.newBuilder())) | ||
.setAccountPayload(AccountPayload.newBuilder() | ||
.setId("id") | ||
.setPaymentMethodName("SEPA") | ||
.setCountryBasedAccountPayload(CountryBasedAccountPayload.newBuilder() | ||
.setCountryCode("countryCode") | ||
.setSepaAccountPayload(SepaAccountPayload.newBuilder() | ||
.setHolderName("holderName") | ||
.setIban("iban") | ||
.setBic("bic") | ||
))) | ||
.setCountryBasedAccount(CountryBasedAccount.newBuilder() | ||
.setCountry(Country.newBuilder() | ||
.setCode("countryCode") | ||
.setName("countryName") | ||
.setRegion(Region.newBuilder() | ||
.setCode("regionCode") | ||
.setName("regionName"))) | ||
.setSepaAccount(SepaAccount.newBuilder())) | ||
.build(); | ||
|
||
private static final bisq.account.accounts.SepaAccount ACCOUNT = new bisq.account.accounts.SepaAccount( | ||
"accountName", | ||
"holderName", | ||
"iban", | ||
"bic", | ||
new bisq.common.locale.Country( | ||
"countryCode", | ||
"countryName", | ||
new bisq.common.locale.Region("regionCode", "regionName"))); | ||
|
||
@Test | ||
void toProto() { | ||
var result = ACCOUNT.toProto(); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate_", "accountPayload_.id_", "memoizedHashCode", "accountPayload_.memoizedHashCode") | ||
.isEqualTo(PROTO); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
assertThat(result.getAccountPayload().getId()).isNotEmpty(); | ||
} | ||
|
||
@Test | ||
void fromProto() { | ||
var result = bisq.account.accounts.SepaAccount.fromProto(PROTO); | ||
assertThat(result) | ||
.usingRecursiveComparison() | ||
.ignoringFields("creationDate", "accountPayload.id") | ||
.isEqualTo(ACCOUNT); | ||
assertThat(result.getCreationDate()).isCloseTo(currentTimeMillis(), offset(1000L)); | ||
assertThat(result.getAccountPayload().getId()).isNotEmpty(); | ||
} | ||
} |
Oops, something went wrong.