Add JsonOptions enum class to contain options passed to getJSON methods

This commit is contained in:
Mo Morsi
2019-06-08 01:10:33 -04:00
committed by Manoj doshi
parent c2138c4e88
commit f8365f5009
77 changed files with 382 additions and 270 deletions

View File

@@ -38,7 +38,7 @@ create (jtx::Account const& account,
{
Json::Value jv;
jv[sfAccount.jsonName] = account.human();
jv[sfSendMax.jsonName] = sendMax.getJson(0);
jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none);
jv[sfDestination.jsonName] = dest.human();
jv[sfTransactionType.jsonName] = jss::CheckCreate;
jv[sfFlags.jsonName] = tfUniversal;
@@ -60,7 +60,7 @@ cash (jtx::Account const& dest,
{
Json::Value jv;
jv[sfAccount.jsonName] = dest.human();
jv[sfAmount.jsonName] = amount.getJson(0);
jv[sfAmount.jsonName] = amount.getJson(JsonOptions::none);
jv[sfCheckID.jsonName] = to_string (checkId);
jv[sfTransactionType.jsonName] = jss::CheckCash;
jv[sfFlags.jsonName] = tfUniversal;
@@ -73,7 +73,7 @@ cash (jtx::Account const& dest,
{
Json::Value jv;
jv[sfAccount.jsonName] = dest.human();
jv[sfDeliverMin.jsonName] = atLeast.value.getJson(0);
jv[sfDeliverMin.jsonName] = atLeast.value.getJson(JsonOptions::none);
jv[sfCheckID.jsonName] = to_string (checkId);
jv[sfTransactionType.jsonName] = jss::CheckCash;
jv[sfFlags.jsonName] = tfUniversal;
@@ -206,7 +206,8 @@ class Check_test : public beast::unit_test::suite
void verifyDeliveredAmount (test::jtx::Env& env, STAmount const& amount)
{
// Get the hash for the most recent transaction.
std::string const txHash {env.tx()->getJson (0)[jss::hash].asString()};
std::string const txHash {
env.tx()->getJson (JsonOptions::none)[jss::hash].asString()};
// Verify DeliveredAmount and delivered_amount metadata are correct.
env.close();
@@ -218,8 +219,10 @@ class Check_test : public beast::unit_test::suite
// DeliveredAmount and delivered_amount should both be present and
// equal amount.
BEAST_EXPECT (meta[sfDeliveredAmount.jsonName] == amount.getJson (0));
BEAST_EXPECT (meta[jss::delivered_amount] == amount.getJson (0));
BEAST_EXPECT (meta[sfDeliveredAmount.jsonName] ==
amount.getJson (JsonOptions::none));
BEAST_EXPECT (meta[jss::delivered_amount] ==
amount.getJson (JsonOptions::none));
}
void testEnabled()
@@ -1407,7 +1410,7 @@ class Check_test : public beast::unit_test::suite
// Both Amount and DeliverMin present.
{
Json::Value tx {check::cash (bob, chkId, amount)};
tx[sfDeliverMin.jsonName] = amount.getJson(0);
tx[sfDeliverMin.jsonName] = amount.getJson(JsonOptions::none);
env (tx, ter (temMALFORMED));
env.close();
}
@@ -1826,7 +1829,7 @@ class Check_test : public beast::unit_test::suite
// Get the hash for the most recent transaction.
std::string const txHash {
env.tx()->getJson (0)[jss::hash].asString()};
env.tx()->getJson (JsonOptions::none)[jss::hash].asString()};
// DeliveredAmount and delivered_amount are either present or
// not present in the metadata returned by "tx" based on fix1623.