1
mirror of https://github.com/m2049r/xmrwallet synced 2024-11-24 14:37:14 +01:00

xmr.to v3 API (#667)

This commit is contained in:
m2049r 2020-06-19 19:17:38 +02:00 committed by GitHub
parent a0d6117bbb
commit 1cecd0b718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 79 additions and 174 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/app/prodMainnet /app/prodMainnet
/app/alphaStagenet /app/alphaStagenet
/app/prodStagenet /app/prodStagenet
/app/.cxx

View File

@ -7,8 +7,8 @@ android {
applicationId "com.m2049r.xmrwallet" applicationId "com.m2049r.xmrwallet"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 301 versionCode 302
versionName "1.13.1 'ReStart'" versionName "1.13.2 'ReStart'"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild { externalNativeBuild {

View File

@ -457,8 +457,8 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
} }
showProgress(3, getString(R.string.label_send_progress_create_tx)); showProgress(3, getString(R.string.label_send_progress_create_tx));
TxData txData = sendListener.getTxData(); TxData txData = sendListener.getTxData();
txData.setDestinationAddress(xmrtoStatus.getXmrReceivingSubaddress()); txData.setDestinationAddress(xmrtoStatus.getReceivingSubaddress());
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getXmrAmountTotal())); txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getIncomingAmountTotal()));
getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData); getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData);
} }
@ -572,22 +572,22 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
NumberFormat df = NumberFormat.getInstance(Locale.US); NumberFormat df = NumberFormat.getInstance(Locale.US);
df.setMaximumFractionDigits(12); df.setMaximumFractionDigits(12);
String btcAmount = df.format(status.getBtcAmount()); String btcAmount = df.format(status.getBtcAmount());
String xmrAmountTotal = df.format(status.getXmrAmountTotal()); String xmrAmountTotal = df.format(status.getIncomingAmountTotal());
tvTxBtcAmount.setText(getString(R.string.text_send_btc_amount, btcAmount, xmrAmountTotal)); tvTxBtcAmount.setText(getString(R.string.text_send_btc_amount, btcAmount, xmrAmountTotal));
String xmrPriceBtc = df.format(status.getXmrPriceBtc()); String xmrPriceBtc = df.format(status.getIncomingPriceBtc());
tvTxBtcRate.setText(getString(R.string.text_send_btc_rate, xmrPriceBtc)); tvTxBtcRate.setText(getString(R.string.text_send_btc_rate, xmrPriceBtc));
double calcRate = status.getBtcAmount() / status.getXmrPriceBtc(); double calcRate = status.getBtcAmount() / status.getIncomingPriceBtc();
Timber.i("Rates: %f / %f", calcRate, status.getXmrPriceBtc()); Timber.d("Rates: %f / %f", calcRate, status.getIncomingPriceBtc());
tvTxBtcAddress.setText(status.getBtcDestAddress()); // TODO test if this is different? tvTxBtcAddress.setText(status.getBtcDestAddress()); // TODO test if this is different?
Timber.i("Expires @ %s, in %s seconds", status.getExpiresAt().toString(), status.getSecondsTillTimeout()); Timber.d("Expires @ %s, in %s seconds", status.getExpiresAt().toString(), status.getSecondsTillTimeout());
Timber.i("Status = %s", status.getState().toString()); Timber.d("Status = %s", status.getState().toString());
tvTxXmrToKey.setText(status.getUuid()); tvTxXmrToKey.setText(status.getUuid());
Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getXmrAmountRemaining(), status.getXmrAmountTotal()); Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getRemainingAmountIncoming(), status.getIncomingAmountTotal());
hideProgress(); hideProgress();
startSendTimer(); startSendTimer();
prepareSend(); prepareSend();

View File

@ -323,9 +323,9 @@ public class Helper {
static public HttpUrl getXmrToBaseUrl() { static public HttpUrl getXmrToBaseUrl() {
if ((WalletManager.getInstance() == null) if ((WalletManager.getInstance() == null)
|| (WalletManager.getInstance().getNetworkType() != NetworkType.NetworkType_Mainnet)) { || (WalletManager.getInstance().getNetworkType() != NetworkType.NetworkType_Mainnet)) {
return HttpUrl.parse("https://test.xmr.to/api/v2/xmr2btc/"); return HttpUrl.parse("https://test.xmr.to/api/v3/xmr2btc/");
} else { } else {
return HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/"); return HttpUrl.parse("https://xmr.to/api/v3/xmr2btc/");
} }
} }

View File

@ -43,47 +43,31 @@ public interface QueryOrderStatus {
boolean isError(); boolean isError();
State getState(); // "state": "<order_state_as_string>", QueryOrderStatus.State getState();
double getBtcAmount(); // "btc_amount": <requested_amount_in_btc_as_float>, double getBtcAmount();
String getBtcDestAddress(); // "btc_dest_address": "<requested_destination_address_as_string>", String getBtcDestAddress();
String getUuid(); // "uuid": "<unique_order_identifier_as_12_character_string>" String getUuid();
int getBtcNumConfirmations(); // "btc_num_confirmations": <btc_num_confirmations_as_integer>, int getBtcNumConfirmationsThreshold();
int getBtcNumConfirmationsBeforePurge(); // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>, Date getCreatedAt();
String getBtcTransactionId(); // "btc_transaction_id": "<btc_transaction_id_as_string>", Date getExpiresAt();
Date getCreatedAt(); // "created_at": "<timestamp_as_string>", int getSecondsTillTimeout();
Date getExpiresAt(); // "expires_at": "<timestamp_as_string>", double getIncomingAmountTotal();
int getSecondsTillTimeout(); // "seconds_till_timeout": <seconds_till_timeout_as_integer>, double getRemainingAmountIncoming();
double getXmrAmountTotal(); // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>, int getIncomingNumConfirmationsRemaining();
double getXmrAmountRemaining(); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>, double getIncomingPriceBtc();
int getXmrNumConfirmationsRemaining(); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>, String getReceivingSubaddress();
double getXmrPriceBtc(); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
String getXmrReceivingAddress(); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
String getXmrReceivingSubaddress(); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
String getXmrReceivingIntegratedAddress(); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
int getXmrRecommendedMixin(); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
@Deprecated
double getXmrRequiredAmount(); // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
String getXmrRequiredPaymentIdLong(); // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
String getXmrRequiredPaymentIdShort(); // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
int getRecommendedMixin();
} }

View File

@ -113,7 +113,8 @@ class CreateOrderImpl implements CreateOrder {
static JSONObject createRequest(final double amount, final String address) throws JSONException { static JSONObject createRequest(final double amount, final String address) throws JSONException {
final JSONObject jsonObject = new JSONObject(); final JSONObject jsonObject = new JSONObject();
jsonObject.put("btc_amount", amount); jsonObject.put("amount", amount);
jsonObject.put("amount_currency", "BTC");
jsonObject.put("btc_dest_address", address); jsonObject.put("btc_dest_address", address);
return jsonObject; return jsonObject;
} }

View File

@ -42,23 +42,17 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
private String btcDestAddress; // "btc_dest_address": "<requested_destination_address_as_string>", private String btcDestAddress; // "btc_dest_address": "<requested_destination_address_as_string>",
private String uuid; // "uuid": "<unique_order_identifier_as_12_character_string>" private String uuid; // "uuid": "<unique_order_identifier_as_12_character_string>"
// the following are only returned if the state is "after" TO_BE_CREATED // the following are only returned if the state is "after" TO_BE_CREATED
private int btcNumConfirmations; // "btc_num_confirmations": <btc_num_confirmations_as_integer>, //private int btcNumConfirmations; // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
private int btcNumConfirmationsBeforePurge; // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>, private int btcNumConfirmationsThreshold; // "btc_num_confirmations_threshold": <btc_num_confirmations_threshold_as_integer>,
private String btcTransactionId; // "btc_transaction_id": "<btc_transaction_id_as_string>",
private Date createdAt; // "created_at": "<timestamp_as_string>", private Date createdAt; // "created_at": "<timestamp_as_string>",
private Date expiresAt; // "expires_at": "<timestamp_as_string>", private Date expiresAt; // "expires_at": "<timestamp_as_string>",
private int secondsTillTimeout; // "seconds_till_timeout": <seconds_till_timeout_as_integer>, private int secondsTillTimeout; // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
private double xmrAmountTotal; // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>, private double incomingAmountTotal; // "incoming_amount_total": <amount_in_incoming_currency_for_this_order_as_float>,
private double xmrAmountRemaining; // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>, private double remainingAmountIncoming; // "remaining_amount_incoming": <amount_in_incoming_currency_that_the_user_must_still_send_as_float>,
private int xmrNumConfirmationsRemaining; // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>, private int incomingNumConfirmationsRemaining; // "incoming_num_confirmations_remaining": <num_incoming_currency_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
private double xmrPriceBtc; // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>, private double incomingPriceBtc; // "incoming_price_btc": <price_of_1_incoming_in_btc_currency_as_offered_by_service_as_float>,
private String xmrReceivingSubaddress; // <xmr_subaddress_user_needs_to_send_funds_to_as_string>, private String receivingSubaddress; // "receiving_subaddress": <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
private String xmrReceivingAddress; // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string", private int recommendedMixin; // "recommended_mixin": <recommended_mixin_as_integer>,
private String xmrReceivingIntegratedAddress; // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
private int xmrRecommendedMixin; // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
private double xmrRequiredAmount; // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
private String xmrRequiredPaymentIdLong; // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
private String xmrRequiredPaymentIdShort; // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
public QueryOrderStatus.State getState() { public QueryOrderStatus.State getState() {
return state; return state;
@ -76,16 +70,8 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
return uuid; return uuid;
} }
public int getBtcNumConfirmations() { public int getBtcNumConfirmationsThreshold() {
return btcNumConfirmations; return btcNumConfirmationsThreshold;
}
public int getBtcNumConfirmationsBeforePurge() {
return btcNumConfirmationsBeforePurge;
}
public String getBtcTransactionId() {
return btcTransactionId;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
@ -100,48 +86,28 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
return secondsTillTimeout; return secondsTillTimeout;
} }
public double getXmrAmountTotal() { public double getIncomingAmountTotal() {
return xmrAmountTotal; return incomingAmountTotal;
} }
public double getXmrAmountRemaining() { public double getRemainingAmountIncoming() {
return xmrAmountRemaining; return remainingAmountIncoming;
} }
public int getXmrNumConfirmationsRemaining() { public int getIncomingNumConfirmationsRemaining() {
return xmrNumConfirmationsRemaining; return incomingNumConfirmationsRemaining;
} }
public double getXmrPriceBtc() { public double getIncomingPriceBtc() {
return xmrPriceBtc; return incomingPriceBtc;
} }
public String getXmrReceivingSubaddress() { public String getReceivingSubaddress() {
return xmrReceivingSubaddress; return receivingSubaddress;
} }
public String getXmrReceivingAddress() { public int getRecommendedMixin() {
return xmrReceivingAddress; return recommendedMixin;
}
public String getXmrReceivingIntegratedAddress() {
return xmrReceivingIntegratedAddress;
}
public int getXmrRecommendedMixin() {
return xmrRecommendedMixin;
}
public double getXmrRequiredAmount() {
return xmrRequiredAmount;
}
public String getXmrRequiredPaymentIdLong() {
return xmrRequiredPaymentIdLong;
}
public String getXmrRequiredPaymentIdShort() {
return xmrRequiredPaymentIdShort;
} }
public boolean isCreated() { public boolean isCreated() {
@ -197,29 +163,22 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
uuid = jsonObject.getString("uuid"); // "uuid": "<unique_order_identifier_as_12_character_string>" uuid = jsonObject.getString("uuid"); // "uuid": "<unique_order_identifier_as_12_character_string>"
if (isCreated()) { if (isCreated()) {
btcNumConfirmations = jsonObject.getInt("btc_num_confirmations"); // "btc_num_confirmations": <btc_num_confirmations_as_integer>, btcNumConfirmationsThreshold = jsonObject.getInt("btc_num_confirmations_threshold");
btcNumConfirmationsBeforePurge = jsonObject.getInt("btc_num_confirmations_before_purge"); // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>,
btcTransactionId = jsonObject.getString("btc_transaction_id"); // "btc_transaction_id": "<btc_transaction_id_as_string>",
try { try {
String created = jsonObject.getString("created_at"); // "created_at": "<timestamp_as_string>", String created = jsonObject.getString("created_at");
createdAt = parseDate(created); createdAt = parseDate(created);
String expires = jsonObject.getString("expires_at"); // "expires_at": "<timestamp_as_string>", String expires = jsonObject.getString("expires_at");
expiresAt = parseDate(expires); expiresAt = parseDate(expires);
} catch (ParseException ex) { } catch (ParseException ex) {
throw new JSONException(ex.getLocalizedMessage()); throw new JSONException(ex.getLocalizedMessage());
} }
secondsTillTimeout = jsonObject.getInt("seconds_till_timeout"); // "seconds_till_timeout": <seconds_till_timeout_as_integer>, secondsTillTimeout = jsonObject.getInt("seconds_till_timeout");
xmrAmountTotal = jsonObject.getDouble("xmr_amount_total"); // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>, incomingAmountTotal = jsonObject.getDouble("incoming_amount_total");
xmrAmountRemaining = jsonObject.getDouble("xmr_amount_remaining"); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>, remainingAmountIncoming = jsonObject.getDouble("remaining_amount_incoming");
xmrNumConfirmationsRemaining = jsonObject.getInt("xmr_num_confirmations_remaining"); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>, incomingNumConfirmationsRemaining = jsonObject.getInt("incoming_num_confirmations_remaining");
xmrPriceBtc = jsonObject.getDouble("xmr_price_btc"); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>, incomingPriceBtc = jsonObject.getDouble("incoming_price_btc");
xmrReceivingSubaddress = jsonObject.getString("xmr_receiving_subaddress"); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>, receivingSubaddress = jsonObject.getString("receiving_subaddress");
xmrReceivingAddress = jsonObject.getString("xmr_receiving_address"); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string", recommendedMixin = jsonObject.getInt("recommended_mixin");
xmrReceivingIntegratedAddress = jsonObject.getString("xmr_receiving_integrated_address"); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
xmrRecommendedMixin = jsonObject.getInt("xmr_recommended_mixin"); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
xmrRequiredAmount = jsonObject.getDouble("xmr_required_amount"); // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
xmrRequiredPaymentIdLong = jsonObject.getString("xmr_required_payment_id_long"); // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
xmrRequiredPaymentIdShort = jsonObject.getString("xmr_required_payment_id_short"); // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
} }
} }

View File

@ -53,11 +53,6 @@ public class XmrToApiImpl implements XmrToApi, XmrToApiCall {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
} }
public XmrToApiImpl(@NonNull final OkHttpClient okHttpClient) {
this(okHttpClient, HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/"));
}
@Override @Override
public void createOrder(final double amount, @NonNull final String address, public void createOrder(final double amount, @NonNull final String address,
@NonNull final XmrToCallback<CreateOrder> callback) { @NonNull final XmrToCallback<CreateOrder> callback) {

View File

@ -93,7 +93,7 @@ public class XmrToApiCreateOrderTest {
public void createOrder_shouldContainValidBody() public void createOrder_shouldContainValidBody()
throws InterruptedException { throws InterruptedException {
final String validBody = "{\"btc_amount\":0.1,\"btc_dest_address\":\"19y91nJyzXsLEuR7Nj9pc3o5SeHNc8A9RW\"}"; final String validBody = "{\"amount\":0.1,\"amount_currency\":\"BTC\",\"btc_dest_address\":\"19y91nJyzXsLEuR7Nj9pc3o5SeHNc8A9RW\"}";
xmrToApi.createOrder(0.1, "19y91nJyzXsLEuR7Nj9pc3o5SeHNc8A9RW", mockOrderXmrToCallback); xmrToApi.createOrder(0.1, "19y91nJyzXsLEuR7Nj9pc3o5SeHNc8A9RW", mockOrderXmrToCallback);

View File

@ -122,9 +122,7 @@ public class XmrToApiQueryOrderTest {
final double btcAmount = 0.1; final double btcAmount = 0.1;
final String btcDestAddress = "1FhnVJi2V1k4MqXm2nHoEbY5LV7FPai7bb"; final String btcDestAddress = "1FhnVJi2V1k4MqXm2nHoEbY5LV7FPai7bb";
final String uuid = "xmrto - efMsiU"; final String uuid = "xmrto - efMsiU";
final int btcNumConfirmations = 0;
final int btcNumConfirmationsBeforePurge = 144; final int btcNumConfirmationsBeforePurge = 144;
final String btcTransactionId = "";
final String createdAt = "2017-11-17T12:20:02Z"; final String createdAt = "2017-11-17T12:20:02Z";
final String expiresAt = "2017-11-17T12:35:02Z"; final String expiresAt = "2017-11-17T12:35:02Z";
final int secondsTillTimeout = 882; final int secondsTillTimeout = 882;
@ -133,12 +131,7 @@ public class XmrToApiQueryOrderTest {
final int xmrNumConfirmationsRemaining = -1; final int xmrNumConfirmationsRemaining = -1;
final double xmrPriceBtc = 0.0154703; final double xmrPriceBtc = 0.0154703;
final String xmrReceivingSubaddress = "83BGzCTthheE2KxNTBPnPJjJUthYPfDfCf3ENSVQcpga8RYSxNz9qCz1qp9MLye9euMjckGi11cRdeVGqsVqTLgH8w5fJ1D"; final String xmrReceivingSubaddress = "83BGzCTthheE2KxNTBPnPJjJUthYPfDfCf3ENSVQcpga8RYSxNz9qCz1qp9MLye9euMjckGi11cRdeVGqsVqTLgH8w5fJ1D";
final String xmrReceivingAddress = "44TVPcCSHebEQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV4UpB5n4";
final String xmrReceivingIntegratedAddress = "4EAAQR1vtv7EQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV6B5rRtHLeXGQSECXy9";
final int xmrRecommendedMixin = 5; final int xmrRecommendedMixin = 5;
final double xmrRequiredAmount = 6.464;
final String xmrRequiredPaymentIdLong = "56beabc3ca6d52a78c9a44cefebeb870054d8b367cc7065bff1bdb553caca85c";
final String xmrRequiredPaymentIdShort = "eeb6086436b267cf";
MockResponse jsonMockResponse = new MockResponse().setBody( MockResponse jsonMockResponse = new MockResponse().setBody(
createMockQueryOrderResponse( createMockQueryOrderResponse(
@ -146,9 +139,7 @@ public class XmrToApiQueryOrderTest {
btcAmount, btcAmount,
btcDestAddress, btcDestAddress,
uuid, uuid,
btcNumConfirmations,
btcNumConfirmationsBeforePurge, btcNumConfirmationsBeforePurge,
btcTransactionId,
createdAt, createdAt,
expiresAt, expiresAt,
secondsTillTimeout, secondsTillTimeout,
@ -157,12 +148,7 @@ public class XmrToApiQueryOrderTest {
xmrNumConfirmationsRemaining, xmrNumConfirmationsRemaining,
xmrPriceBtc, xmrPriceBtc,
xmrReceivingSubaddress, xmrReceivingSubaddress,
xmrReceivingAddress, xmrRecommendedMixin));
xmrReceivingIntegratedAddress,
xmrRecommendedMixin,
xmrRequiredAmount,
xmrRequiredPaymentIdLong,
xmrRequiredPaymentIdShort));
mockWebServer.enqueue(jsonMockResponse); mockWebServer.enqueue(jsonMockResponse);
xmrToApi.queryOrderStatus(uuid, new XmrToCallback<QueryOrderStatus>() { xmrToApi.queryOrderStatus(uuid, new XmrToCallback<QueryOrderStatus>() {
@ -172,9 +158,7 @@ public class XmrToApiQueryOrderTest {
waiter.assertEquals(orderStatus.getBtcAmount(), btcAmount); waiter.assertEquals(orderStatus.getBtcAmount(), btcAmount);
waiter.assertEquals(orderStatus.getBtcDestAddress(), btcDestAddress); waiter.assertEquals(orderStatus.getBtcDestAddress(), btcDestAddress);
waiter.assertEquals(orderStatus.getUuid(), uuid); waiter.assertEquals(orderStatus.getUuid(), uuid);
waiter.assertEquals(orderStatus.getBtcNumConfirmations(), btcNumConfirmations); waiter.assertEquals(orderStatus.getBtcNumConfirmationsThreshold(), btcNumConfirmationsBeforePurge);
waiter.assertEquals(orderStatus.getBtcNumConfirmationsBeforePurge(), btcNumConfirmationsBeforePurge);
waiter.assertEquals(orderStatus.getBtcTransactionId(), btcTransactionId);
try { try {
waiter.assertEquals(orderStatus.getCreatedAt(), ParseDate(createdAt)); waiter.assertEquals(orderStatus.getCreatedAt(), ParseDate(createdAt));
waiter.assertEquals(orderStatus.getExpiresAt(), ParseDate(expiresAt)); waiter.assertEquals(orderStatus.getExpiresAt(), ParseDate(expiresAt));
@ -182,17 +166,12 @@ public class XmrToApiQueryOrderTest {
waiter.fail(ex); waiter.fail(ex);
} }
waiter.assertEquals(orderStatus.getSecondsTillTimeout(), secondsTillTimeout); waiter.assertEquals(orderStatus.getSecondsTillTimeout(), secondsTillTimeout);
waiter.assertEquals(orderStatus.getXmrAmountTotal(), xmrAmountTotal); waiter.assertEquals(orderStatus.getIncomingAmountTotal(), xmrAmountTotal);
waiter.assertEquals(orderStatus.getXmrAmountRemaining(), xmrAmountRemaining); waiter.assertEquals(orderStatus.getRemainingAmountIncoming(), xmrAmountRemaining);
waiter.assertEquals(orderStatus.getXmrNumConfirmationsRemaining(), xmrNumConfirmationsRemaining); waiter.assertEquals(orderStatus.getIncomingNumConfirmationsRemaining(), xmrNumConfirmationsRemaining);
waiter.assertEquals(orderStatus.getXmrPriceBtc(), xmrPriceBtc); waiter.assertEquals(orderStatus.getIncomingPriceBtc(), xmrPriceBtc);
waiter.assertEquals(orderStatus.getXmrReceivingSubaddress(), xmrReceivingSubaddress); waiter.assertEquals(orderStatus.getReceivingSubaddress(), xmrReceivingSubaddress);
waiter.assertEquals(orderStatus.getXmrReceivingAddress(), xmrReceivingAddress); waiter.assertEquals(orderStatus.getRecommendedMixin(), xmrRecommendedMixin);
waiter.assertEquals(orderStatus.getXmrReceivingIntegratedAddress(), xmrReceivingIntegratedAddress);
waiter.assertEquals(orderStatus.getXmrRecommendedMixin(), xmrRecommendedMixin);
waiter.assertEquals(orderStatus.getXmrRequiredAmount(), xmrRequiredAmount);
waiter.assertEquals(orderStatus.getXmrRequiredPaymentIdLong(), xmrRequiredPaymentIdLong);
waiter.assertEquals(orderStatus.getXmrRequiredPaymentIdShort(), xmrRequiredPaymentIdShort);
waiter.resume(); waiter.resume();
} }
@ -260,9 +239,7 @@ public class XmrToApiQueryOrderTest {
final double btcAmount, final double btcAmount,
final String btcDestAddress, final String btcDestAddress,
final String uuid, final String uuid,
final int btcNumConfirmations,
final int btcNumConfirmationsBeforePurge, final int btcNumConfirmationsBeforePurge,
final String btcTransactionId,
final String createdAt, final String createdAt,
final String expiresAt, final String expiresAt,
final int secondsTillTimeout, final int secondsTillTimeout,
@ -271,35 +248,23 @@ public class XmrToApiQueryOrderTest {
final int xmrNumConfirmationsRemaining, final int xmrNumConfirmationsRemaining,
final double xmrPriceBtc, final double xmrPriceBtc,
final String xmrReceivingSubaddress, final String xmrReceivingSubaddress,
final String xmrReceivingAddress, final int xmrRecommendedMixin
final String xmrReceivingIntegratedAddress,
final int xmrRecommendedMixin,
final double xmrRequiredAmount,
final String xmrRequiredPaymentIdLong,
final String xmrRequiredPaymentIdShort
) { ) {
return "{\n" + return "{\n" +
" \"xmr_price_btc\": \"" + xmrPriceBtc + "\",\n" + " \"incoming_price_btc\": \"" + xmrPriceBtc + "\",\n" +
" \"uuid\":\"" + uuid + "\",\n" + " \"uuid\":\"" + uuid + "\",\n" +
" \"state\":\"" + state + "\",\n" + " \"state\":\"" + state + "\",\n" +
" \"btc_amount\":\"" + btcAmount + "\",\n" + " \"btc_amount\":\"" + btcAmount + "\",\n" +
" \"btc_dest_address\":\"" + btcDestAddress + "\",\n" + " \"btc_dest_address\":\"" + btcDestAddress + "\",\n" +
" \"xmr_required_amount\":\"" + xmrRequiredAmount + "\",\n" + " \"receiving_subaddress\":\"" + xmrReceivingSubaddress + "\",\n" +
" \"xmr_receiving_subaddress\":\"" + xmrReceivingSubaddress + "\",\n" +
" \"xmr_receiving_address\":\"" + xmrReceivingAddress + "\",\n" +
" \"xmr_receiving_integrated_address\":\"" + xmrReceivingIntegratedAddress + "\",\n" +
" \"xmr_required_payment_id_long\":\"" + xmrRequiredPaymentIdLong + "\",\n" +
" \"xmr_required_payment_id_short\":\"" + xmrRequiredPaymentIdShort + "\",\n" +
" \"created_at\":\"" + createdAt + "\",\n" + " \"created_at\":\"" + createdAt + "\",\n" +
" \"expires_at\":\"" + expiresAt + "\",\n" + " \"expires_at\":\"" + expiresAt + "\",\n" +
" \"seconds_till_timeout\":\"" + secondsTillTimeout + "\",\n" + " \"seconds_till_timeout\":\"" + secondsTillTimeout + "\",\n" +
" \"xmr_amount_total\":\"" + xmrAmountTotal + "\",\n" + " \"incoming_amount_total\":\"" + xmrAmountTotal + "\",\n" +
" \"xmr_amount_remaining\":\"" + xmrAmountRemaining + "\",\n" + " \"remaining_amount_incoming\":\"" + xmrAmountRemaining + "\",\n" +
" \"xmr_num_confirmations_remaining\":\"" + xmrNumConfirmationsRemaining + "\",\n" + " \"incoming_num_confirmations_remaining\":\"" + xmrNumConfirmationsRemaining + "\",\n" +
" \"xmr_recommended_mixin\":\"" + xmrRecommendedMixin + "\",\n" + " \"recommended_mixin\":\"" + xmrRecommendedMixin + "\",\n" +
" \"btc_num_confirmations_before_purge\":\"" + btcNumConfirmationsBeforePurge + "\",\n" + " \"btc_num_confirmations_threshold\":\"" + btcNumConfirmationsBeforePurge + "\",\n"
" \"btc_num_confirmations\":\"" + btcNumConfirmations + "\",\n" +
" \"btc_transaction_id\":\"" + btcTransactionId + "\""
+ "}"; + "}";
} }
} }