xmr.to v3 API (#667)
This commit is contained in:
parent
a0d6117bbb
commit
1cecd0b718
|
@ -14,3 +14,4 @@
|
|||
/app/prodMainnet
|
||||
/app/alphaStagenet
|
||||
/app/prodStagenet
|
||||
/app/.cxx
|
||||
|
|
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "com.m2049r.xmrwallet"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 301
|
||||
versionName "1.13.1 'ReStart'"
|
||||
versionCode 302
|
||||
versionName "1.13.2 'ReStart'"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
externalNativeBuild {
|
||||
|
|
|
@ -457,8 +457,8 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||
}
|
||||
showProgress(3, getString(R.string.label_send_progress_create_tx));
|
||||
TxData txData = sendListener.getTxData();
|
||||
txData.setDestinationAddress(xmrtoStatus.getXmrReceivingSubaddress());
|
||||
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getXmrAmountTotal()));
|
||||
txData.setDestinationAddress(xmrtoStatus.getReceivingSubaddress());
|
||||
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getIncomingAmountTotal()));
|
||||
getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData);
|
||||
}
|
||||
|
||||
|
@ -572,22 +572,22 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||
NumberFormat df = NumberFormat.getInstance(Locale.US);
|
||||
df.setMaximumFractionDigits(12);
|
||||
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));
|
||||
String xmrPriceBtc = df.format(status.getXmrPriceBtc());
|
||||
String xmrPriceBtc = df.format(status.getIncomingPriceBtc());
|
||||
tvTxBtcRate.setText(getString(R.string.text_send_btc_rate, xmrPriceBtc));
|
||||
|
||||
double calcRate = status.getBtcAmount() / status.getXmrPriceBtc();
|
||||
Timber.i("Rates: %f / %f", calcRate, status.getXmrPriceBtc());
|
||||
double calcRate = status.getBtcAmount() / status.getIncomingPriceBtc();
|
||||
Timber.d("Rates: %f / %f", calcRate, status.getIncomingPriceBtc());
|
||||
|
||||
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());
|
||||
|
||||
Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getXmrAmountRemaining(), status.getXmrAmountTotal());
|
||||
Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getRemainingAmountIncoming(), status.getIncomingAmountTotal());
|
||||
hideProgress();
|
||||
startSendTimer();
|
||||
prepareSend();
|
||||
|
|
|
@ -323,9 +323,9 @@ public class Helper {
|
|||
static public HttpUrl getXmrToBaseUrl() {
|
||||
if ((WalletManager.getInstance() == null)
|
||||
|| (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 {
|
||||
return HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/");
|
||||
return HttpUrl.parse("https://xmr.to/api/v3/xmr2btc/");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,47 +43,31 @@ public interface QueryOrderStatus {
|
|||
|
||||
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>,
|
||||
|
||||
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"
|
||||
String getReceivingSubaddress();
|
||||
|
||||
int getRecommendedMixin();
|
||||
}
|
||||
|
|
|
@ -113,7 +113,8 @@ class CreateOrderImpl implements CreateOrder {
|
|||
|
||||
static JSONObject createRequest(final double amount, final String address) throws JSONException {
|
||||
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);
|
||||
return jsonObject;
|
||||
}
|
||||
|
|
|
@ -42,23 +42,17 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
private String btcDestAddress; // "btc_dest_address": "<requested_destination_address_as_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
|
||||
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 String btcTransactionId; // "btc_transaction_id": "<btc_transaction_id_as_string>",
|
||||
//private int btcNumConfirmations; // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
||||
private int btcNumConfirmationsThreshold; // "btc_num_confirmations_threshold": <btc_num_confirmations_threshold_as_integer>,
|
||||
private Date createdAt; // "created_at": "<timestamp_as_string>",
|
||||
private Date expiresAt; // "expires_at": "<timestamp_as_string>",
|
||||
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 xmrAmountRemaining; // "xmr_amount_remaining": <amount_in_xmr_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 double xmrPriceBtc; // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
||||
private String xmrReceivingSubaddress; // <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 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"
|
||||
private double incomingAmountTotal; // "incoming_amount_total": <amount_in_incoming_currency_for_this_order_as_float>,
|
||||
private double remainingAmountIncoming; // "remaining_amount_incoming": <amount_in_incoming_currency_that_the_user_must_still_send_as_float>,
|
||||
private int incomingNumConfirmationsRemaining; // "incoming_num_confirmations_remaining": <num_incoming_currency_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
||||
private double incomingPriceBtc; // "incoming_price_btc": <price_of_1_incoming_in_btc_currency_as_offered_by_service_as_float>,
|
||||
private String receivingSubaddress; // "receiving_subaddress": <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||
private int recommendedMixin; // "recommended_mixin": <recommended_mixin_as_integer>,
|
||||
|
||||
public QueryOrderStatus.State getState() {
|
||||
return state;
|
||||
|
@ -76,16 +70,8 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
return uuid;
|
||||
}
|
||||
|
||||
public int getBtcNumConfirmations() {
|
||||
return btcNumConfirmations;
|
||||
}
|
||||
|
||||
public int getBtcNumConfirmationsBeforePurge() {
|
||||
return btcNumConfirmationsBeforePurge;
|
||||
}
|
||||
|
||||
public String getBtcTransactionId() {
|
||||
return btcTransactionId;
|
||||
public int getBtcNumConfirmationsThreshold() {
|
||||
return btcNumConfirmationsThreshold;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
|
@ -100,48 +86,28 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
return secondsTillTimeout;
|
||||
}
|
||||
|
||||
public double getXmrAmountTotal() {
|
||||
return xmrAmountTotal;
|
||||
public double getIncomingAmountTotal() {
|
||||
return incomingAmountTotal;
|
||||
}
|
||||
|
||||
public double getXmrAmountRemaining() {
|
||||
return xmrAmountRemaining;
|
||||
public double getRemainingAmountIncoming() {
|
||||
return remainingAmountIncoming;
|
||||
}
|
||||
|
||||
public int getXmrNumConfirmationsRemaining() {
|
||||
return xmrNumConfirmationsRemaining;
|
||||
public int getIncomingNumConfirmationsRemaining() {
|
||||
return incomingNumConfirmationsRemaining;
|
||||
}
|
||||
|
||||
public double getXmrPriceBtc() {
|
||||
return xmrPriceBtc;
|
||||
public double getIncomingPriceBtc() {
|
||||
return incomingPriceBtc;
|
||||
}
|
||||
|
||||
public String getXmrReceivingSubaddress() {
|
||||
return xmrReceivingSubaddress;
|
||||
public String getReceivingSubaddress() {
|
||||
return receivingSubaddress;
|
||||
}
|
||||
|
||||
public String getXmrReceivingAddress() {
|
||||
return xmrReceivingAddress;
|
||||
}
|
||||
|
||||
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 int getRecommendedMixin() {
|
||||
return recommendedMixin;
|
||||
}
|
||||
|
||||
public boolean isCreated() {
|
||||
|
@ -197,29 +163,22 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||
uuid = jsonObject.getString("uuid"); // "uuid": "<unique_order_identifier_as_12_character_string>"
|
||||
|
||||
if (isCreated()) {
|
||||
btcNumConfirmations = jsonObject.getInt("btc_num_confirmations"); // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
||||
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>",
|
||||
btcNumConfirmationsThreshold = jsonObject.getInt("btc_num_confirmations_threshold");
|
||||
try {
|
||||
String created = jsonObject.getString("created_at"); // "created_at": "<timestamp_as_string>",
|
||||
String created = jsonObject.getString("created_at");
|
||||
createdAt = parseDate(created);
|
||||
String expires = jsonObject.getString("expires_at"); // "expires_at": "<timestamp_as_string>",
|
||||
String expires = jsonObject.getString("expires_at");
|
||||
expiresAt = parseDate(expires);
|
||||
} catch (ParseException ex) {
|
||||
throw new JSONException(ex.getLocalizedMessage());
|
||||
}
|
||||
secondsTillTimeout = jsonObject.getInt("seconds_till_timeout"); // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
|
||||
xmrAmountTotal = jsonObject.getDouble("xmr_amount_total"); // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>,
|
||||
xmrAmountRemaining = jsonObject.getDouble("xmr_amount_remaining"); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
||||
xmrNumConfirmationsRemaining = jsonObject.getInt("xmr_num_confirmations_remaining"); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
||||
xmrPriceBtc = jsonObject.getDouble("xmr_price_btc"); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
||||
xmrReceivingSubaddress = jsonObject.getString("xmr_receiving_subaddress"); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||
xmrReceivingAddress = jsonObject.getString("xmr_receiving_address"); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
||||
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"
|
||||
secondsTillTimeout = jsonObject.getInt("seconds_till_timeout");
|
||||
incomingAmountTotal = jsonObject.getDouble("incoming_amount_total");
|
||||
remainingAmountIncoming = jsonObject.getDouble("remaining_amount_incoming");
|
||||
incomingNumConfirmationsRemaining = jsonObject.getInt("incoming_num_confirmations_remaining");
|
||||
incomingPriceBtc = jsonObject.getDouble("incoming_price_btc");
|
||||
receivingSubaddress = jsonObject.getString("receiving_subaddress");
|
||||
recommendedMixin = jsonObject.getInt("recommended_mixin");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,11 +53,6 @@ public class XmrToApiImpl implements XmrToApi, XmrToApiCall {
|
|||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public XmrToApiImpl(@NonNull final OkHttpClient okHttpClient) {
|
||||
this(okHttpClient, HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createOrder(final double amount, @NonNull final String address,
|
||||
@NonNull final XmrToCallback<CreateOrder> callback) {
|
||||
|
|
|
@ -93,7 +93,7 @@ public class XmrToApiCreateOrderTest {
|
|||
public void createOrder_shouldContainValidBody()
|
||||
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);
|
||||
|
||||
|
|
|
@ -122,9 +122,7 @@ public class XmrToApiQueryOrderTest {
|
|||
final double btcAmount = 0.1;
|
||||
final String btcDestAddress = "1FhnVJi2V1k4MqXm2nHoEbY5LV7FPai7bb";
|
||||
final String uuid = "xmrto - efMsiU";
|
||||
final int btcNumConfirmations = 0;
|
||||
final int btcNumConfirmationsBeforePurge = 144;
|
||||
final String btcTransactionId = "";
|
||||
final String createdAt = "2017-11-17T12:20:02Z";
|
||||
final String expiresAt = "2017-11-17T12:35:02Z";
|
||||
final int secondsTillTimeout = 882;
|
||||
|
@ -133,12 +131,7 @@ public class XmrToApiQueryOrderTest {
|
|||
final int xmrNumConfirmationsRemaining = -1;
|
||||
final double xmrPriceBtc = 0.0154703;
|
||||
final String xmrReceivingSubaddress = "83BGzCTthheE2KxNTBPnPJjJUthYPfDfCf3ENSVQcpga8RYSxNz9qCz1qp9MLye9euMjckGi11cRdeVGqsVqTLgH8w5fJ1D";
|
||||
final String xmrReceivingAddress = "44TVPcCSHebEQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV4UpB5n4";
|
||||
final String xmrReceivingIntegratedAddress = "4EAAQR1vtv7EQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV6B5rRtHLeXGQSECXy9";
|
||||
final int xmrRecommendedMixin = 5;
|
||||
final double xmrRequiredAmount = 6.464;
|
||||
final String xmrRequiredPaymentIdLong = "56beabc3ca6d52a78c9a44cefebeb870054d8b367cc7065bff1bdb553caca85c";
|
||||
final String xmrRequiredPaymentIdShort = "eeb6086436b267cf";
|
||||
|
||||
MockResponse jsonMockResponse = new MockResponse().setBody(
|
||||
createMockQueryOrderResponse(
|
||||
|
@ -146,9 +139,7 @@ public class XmrToApiQueryOrderTest {
|
|||
btcAmount,
|
||||
btcDestAddress,
|
||||
uuid,
|
||||
btcNumConfirmations,
|
||||
btcNumConfirmationsBeforePurge,
|
||||
btcTransactionId,
|
||||
createdAt,
|
||||
expiresAt,
|
||||
secondsTillTimeout,
|
||||
|
@ -157,12 +148,7 @@ public class XmrToApiQueryOrderTest {
|
|||
xmrNumConfirmationsRemaining,
|
||||
xmrPriceBtc,
|
||||
xmrReceivingSubaddress,
|
||||
xmrReceivingAddress,
|
||||
xmrReceivingIntegratedAddress,
|
||||
xmrRecommendedMixin,
|
||||
xmrRequiredAmount,
|
||||
xmrRequiredPaymentIdLong,
|
||||
xmrRequiredPaymentIdShort));
|
||||
xmrRecommendedMixin));
|
||||
mockWebServer.enqueue(jsonMockResponse);
|
||||
|
||||
xmrToApi.queryOrderStatus(uuid, new XmrToCallback<QueryOrderStatus>() {
|
||||
|
@ -172,9 +158,7 @@ public class XmrToApiQueryOrderTest {
|
|||
waiter.assertEquals(orderStatus.getBtcAmount(), btcAmount);
|
||||
waiter.assertEquals(orderStatus.getBtcDestAddress(), btcDestAddress);
|
||||
waiter.assertEquals(orderStatus.getUuid(), uuid);
|
||||
waiter.assertEquals(orderStatus.getBtcNumConfirmations(), btcNumConfirmations);
|
||||
waiter.assertEquals(orderStatus.getBtcNumConfirmationsBeforePurge(), btcNumConfirmationsBeforePurge);
|
||||
waiter.assertEquals(orderStatus.getBtcTransactionId(), btcTransactionId);
|
||||
waiter.assertEquals(orderStatus.getBtcNumConfirmationsThreshold(), btcNumConfirmationsBeforePurge);
|
||||
try {
|
||||
waiter.assertEquals(orderStatus.getCreatedAt(), ParseDate(createdAt));
|
||||
waiter.assertEquals(orderStatus.getExpiresAt(), ParseDate(expiresAt));
|
||||
|
@ -182,17 +166,12 @@ public class XmrToApiQueryOrderTest {
|
|||
waiter.fail(ex);
|
||||
}
|
||||
waiter.assertEquals(orderStatus.getSecondsTillTimeout(), secondsTillTimeout);
|
||||
waiter.assertEquals(orderStatus.getXmrAmountTotal(), xmrAmountTotal);
|
||||
waiter.assertEquals(orderStatus.getXmrAmountRemaining(), xmrAmountRemaining);
|
||||
waiter.assertEquals(orderStatus.getXmrNumConfirmationsRemaining(), xmrNumConfirmationsRemaining);
|
||||
waiter.assertEquals(orderStatus.getXmrPriceBtc(), xmrPriceBtc);
|
||||
waiter.assertEquals(orderStatus.getXmrReceivingSubaddress(), xmrReceivingSubaddress);
|
||||
waiter.assertEquals(orderStatus.getXmrReceivingAddress(), xmrReceivingAddress);
|
||||
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.assertEquals(orderStatus.getIncomingAmountTotal(), xmrAmountTotal);
|
||||
waiter.assertEquals(orderStatus.getRemainingAmountIncoming(), xmrAmountRemaining);
|
||||
waiter.assertEquals(orderStatus.getIncomingNumConfirmationsRemaining(), xmrNumConfirmationsRemaining);
|
||||
waiter.assertEquals(orderStatus.getIncomingPriceBtc(), xmrPriceBtc);
|
||||
waiter.assertEquals(orderStatus.getReceivingSubaddress(), xmrReceivingSubaddress);
|
||||
waiter.assertEquals(orderStatus.getRecommendedMixin(), xmrRecommendedMixin);
|
||||
waiter.resume();
|
||||
}
|
||||
|
||||
|
@ -260,9 +239,7 @@ public class XmrToApiQueryOrderTest {
|
|||
final double btcAmount,
|
||||
final String btcDestAddress,
|
||||
final String uuid,
|
||||
final int btcNumConfirmations,
|
||||
final int btcNumConfirmationsBeforePurge,
|
||||
final String btcTransactionId,
|
||||
final String createdAt,
|
||||
final String expiresAt,
|
||||
final int secondsTillTimeout,
|
||||
|
@ -271,35 +248,23 @@ public class XmrToApiQueryOrderTest {
|
|||
final int xmrNumConfirmationsRemaining,
|
||||
final double xmrPriceBtc,
|
||||
final String xmrReceivingSubaddress,
|
||||
final String xmrReceivingAddress,
|
||||
final String xmrReceivingIntegratedAddress,
|
||||
final int xmrRecommendedMixin,
|
||||
final double xmrRequiredAmount,
|
||||
final String xmrRequiredPaymentIdLong,
|
||||
final String xmrRequiredPaymentIdShort
|
||||
final int xmrRecommendedMixin
|
||||
) {
|
||||
return "{\n" +
|
||||
" \"xmr_price_btc\": \"" + xmrPriceBtc + "\",\n" +
|
||||
" \"incoming_price_btc\": \"" + xmrPriceBtc + "\",\n" +
|
||||
" \"uuid\":\"" + uuid + "\",\n" +
|
||||
" \"state\":\"" + state + "\",\n" +
|
||||
" \"btc_amount\":\"" + btcAmount + "\",\n" +
|
||||
" \"btc_dest_address\":\"" + btcDestAddress + "\",\n" +
|
||||
" \"xmr_required_amount\":\"" + xmrRequiredAmount + "\",\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" +
|
||||
" \"receiving_subaddress\":\"" + xmrReceivingSubaddress + "\",\n" +
|
||||
" \"created_at\":\"" + createdAt + "\",\n" +
|
||||
" \"expires_at\":\"" + expiresAt + "\",\n" +
|
||||
" \"seconds_till_timeout\":\"" + secondsTillTimeout + "\",\n" +
|
||||
" \"xmr_amount_total\":\"" + xmrAmountTotal + "\",\n" +
|
||||
" \"xmr_amount_remaining\":\"" + xmrAmountRemaining + "\",\n" +
|
||||
" \"xmr_num_confirmations_remaining\":\"" + xmrNumConfirmationsRemaining + "\",\n" +
|
||||
" \"xmr_recommended_mixin\":\"" + xmrRecommendedMixin + "\",\n" +
|
||||
" \"btc_num_confirmations_before_purge\":\"" + btcNumConfirmationsBeforePurge + "\",\n" +
|
||||
" \"btc_num_confirmations\":\"" + btcNumConfirmations + "\",\n" +
|
||||
" \"btc_transaction_id\":\"" + btcTransactionId + "\""
|
||||
" \"incoming_amount_total\":\"" + xmrAmountTotal + "\",\n" +
|
||||
" \"remaining_amount_incoming\":\"" + xmrAmountRemaining + "\",\n" +
|
||||
" \"incoming_num_confirmations_remaining\":\"" + xmrNumConfirmationsRemaining + "\",\n" +
|
||||
" \"recommended_mixin\":\"" + xmrRecommendedMixin + "\",\n" +
|
||||
" \"btc_num_confirmations_threshold\":\"" + btcNumConfirmationsBeforePurge + "\",\n"
|
||||
+ "}";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue