add gold and silver, refactor money types to traditional and crypto

This commit is contained in:
woodser 2023-05-15 17:10:01 -04:00
parent 65bc78d3d7
commit 29706339ef
210 changed files with 2629 additions and 2373 deletions

View file

@ -6,7 +6,7 @@ import com.google.gson.stream.JsonWriter;
import haveno.apitest.method.MethodTest;
import haveno.cli.GrpcClient;
import haveno.core.api.model.PaymentAccountForm;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.PaymentAccount;
@ -168,11 +168,11 @@ public class AbstractPaymentAccountTest extends MethodTest {
assertEquals(expectedCurrencyCode, paymentAccount.getSingleTradeCurrency().getCode());
}
protected final void verifyAccountTradeCurrencies(Collection<FiatCurrency> expectedFiatCurrencies,
protected final void verifyAccountTradeCurrencies(Collection<TraditionalCurrency> expectedTraditionalCurrencies,
PaymentAccount paymentAccount) {
assertNotNull(paymentAccount.getTradeCurrencies());
List<TradeCurrency> expectedTradeCurrencies = new ArrayList<>() {{
addAll(expectedFiatCurrencies);
addAll(expectedTraditionalCurrencies);
}};
assertArrayEquals(expectedTradeCurrencies.toArray(), paymentAccount.getTradeCurrencies().toArray());
}
@ -206,8 +206,8 @@ public class AbstractPaymentAccountTest extends MethodTest {
return jsonString;
}
protected final String getCommaDelimitedFiatCurrencyCodes(Collection<FiatCurrency> fiatCurrencies) {
return fiatCurrencies.stream()
protected final String getCommaDelimitedTraditionalCurrencyCodes(Collection<TraditionalCurrency> traditionalCurrencies) {
return traditionalCurrencies.stream()
.sorted(Comparator.comparing(TradeCurrency::getCode))
.map(c -> c.getCurrency().getCurrencyCode())
.collect(Collectors.joining(","));

View file

@ -18,7 +18,7 @@
package haveno.apitest.method.payment;
import haveno.cli.table.builder.TableBuilder;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.AdvancedCashAccount;
import haveno.core.payment.AliPayAccount;
@ -78,7 +78,7 @@ import static haveno.apitest.config.ApiTestConfig.EUR;
import static haveno.apitest.config.ApiTestConfig.USD;
import static haveno.apitest.config.HavenoAppConfig.alicedaemon;
import static haveno.cli.table.builder.TableType.PAYMENT_ACCOUNT_TBL;
import static haveno.core.locale.CurrencyUtil.getAllSortedFiatCurrencies;
import static haveno.core.locale.CurrencyUtil.getAllSortedTraditionalCurrencies;
import static haveno.core.locale.CurrencyUtil.getTradeCurrency;
import static haveno.core.payment.payload.PaymentMethod.ADVANCED_CASH_ID;
import static haveno.core.payment.payload.PaymentMethod.ALI_PAY_ID;
@ -844,9 +844,9 @@ public class CreatePaymentAccountTest extends AbstractPaymentAccountTest {
PROPERTY_NAME_BANK_SWIFT_CODE);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_PAYMENT_METHOD_ID, SWIFT_ID);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_ACCOUNT_NAME, "IT Swift Acct w/ DE Intermediary");
Collection<FiatCurrency> swiftCurrenciesSortedByCode = getAllSortedFiatCurrencies(comparing(TradeCurrency::getCode));
String allFiatCodes = getCommaDelimitedFiatCurrencyCodes(swiftCurrenciesSortedByCode);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, allFiatCodes);
Collection<TraditionalCurrency> swiftCurrenciesSortedByCode = getAllSortedTraditionalCurrencies(comparing(TradeCurrency::getCode));
String allTraditionalCodes = getCommaDelimitedTraditionalCurrencyCodes(swiftCurrenciesSortedByCode);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_TRADE_CURRENCIES, allTraditionalCodes);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_SELECTED_TRADE_CURRENCY, EUR);
COMPLETED_FORM_MAP.put(PROPERTY_NAME_BANK_SWIFT_CODE, "PASCITMMFIR");
COMPLETED_FORM_MAP.put(PROPERTY_NAME_BANK_COUNTRY_CODE, "IT");

View file

@ -45,10 +45,10 @@ public class MakerBotProtocol extends BotProtocol {
var trade = makeTrade.apply(randomOffer);
var makerIsBuyer = trade.getOffer().getDirection().equalsIgnoreCase(BUY);
Function<TradeInfo, TradeInfo> completeFiatTransaction = makerIsBuyer
Function<TradeInfo, TradeInfo> completeTraditionalTransaction = makerIsBuyer
? sendPaymentSentMessage.andThen(waitForPaymentReceivedConfirmation)
: waitForPaymentSentMessage.andThen(sendPaymentReceivedMessage);
completeFiatTransaction.apply(trade);
completeTraditionalTransaction.apply(trade);
currentProtocolStep = DONE;
}

View file

@ -45,10 +45,10 @@ public class TakerBotProtocol extends BotProtocol {
var trade = takeTrade.apply(findOffer.get());
var takerIsSeller = trade.getOffer().getDirection().equalsIgnoreCase(BUY);
Function<TradeInfo, TradeInfo> completeFiatTransaction = takerIsSeller
Function<TradeInfo, TradeInfo> completeTraditionalTransaction = takerIsSeller
? waitForPaymentSentMessage.andThen(sendPaymentReceivedMessage)
: sendPaymentSentMessage.andThen(waitForPaymentReceivedConfirmation);
completeFiatTransaction.apply(trade);
completeTraditionalTransaction.apply(trade);
currentProtocolStep = DONE;
}