Committing updates.
This commit is contained in:
@@ -140,6 +140,11 @@ namespace Apostol {
|
|||||||
DateTimeToStr(Value, Buffer, sizeof(Buffer), Format.c_str());
|
DateTimeToStr(Value, Buffer, sizeof(Buffer), Format.c_str());
|
||||||
return Buffer;
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
CString GenSalt() {
|
||||||
|
return GetUID(9).Lower();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -172,8 +177,8 @@ namespace Apostol {
|
|||||||
return doCompleted;
|
return doCompleted;
|
||||||
} else if (S == "cancel") {
|
} else if (S == "cancel") {
|
||||||
return doCancel;
|
return doCancel;
|
||||||
} else if (S == "canceled") {
|
} else if (S == "canceled" || S == "cancelled") {
|
||||||
return doCanceled;
|
return doCancelled;
|
||||||
} else if (S == "execute") {
|
} else if (S == "execute") {
|
||||||
return doExecute;
|
return doExecute;
|
||||||
} else if (S == "executed") {
|
} else if (S == "executed") {
|
||||||
@@ -218,8 +223,8 @@ namespace Apostol {
|
|||||||
return "Completed";
|
return "Completed";
|
||||||
case doCancel:
|
case doCancel:
|
||||||
return "Cancel";
|
return "Cancel";
|
||||||
case doCanceled:
|
case doCancelled:
|
||||||
return "Canceled";
|
return "Cancelled";
|
||||||
case doExecute:
|
case doExecute:
|
||||||
return "Execute";
|
return "Execute";
|
||||||
case doExecuted:
|
case doExecuted:
|
||||||
@@ -318,6 +323,9 @@ namespace Apostol {
|
|||||||
Data += S.Format("Sum: %s;", Payment.Sum.c_str());
|
Data += S.Format("Sum: %s;", Payment.Sum.c_str());
|
||||||
Data += S.Format("LeaveBefore: %s", FeedBack.LeaveBefore.c_str());
|
Data += S.Format("LeaveBefore: %s", FeedBack.LeaveBefore.c_str());
|
||||||
|
|
||||||
|
if (!Salt.IsEmpty())
|
||||||
|
Data += S.Format("Salt: %s", Salt.c_str());
|
||||||
|
|
||||||
return Data;
|
return Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +540,9 @@ namespace Apostol {
|
|||||||
if (VerifyDate(date, Date) != 1)
|
if (VerifyDate(date, Date) != 1)
|
||||||
throw ExceptionFrm("Invalid deal date format: %s.", date.c_str());
|
throw ExceptionFrm("Invalid deal date format: %s.", date.c_str());
|
||||||
|
|
||||||
m_Data.Date = DateToString(Date);
|
m_Data.Date = UTCFormat(DateToString(Date));
|
||||||
|
|
||||||
|
m_Data.Salt = deal["salt"].as<std::string>();
|
||||||
|
|
||||||
const auto& seller = deal["seller"];
|
const auto& seller = deal["seller"];
|
||||||
m_Data.Seller.Address = seller["address"].as<std::string>();
|
m_Data.Seller.Address = seller["address"].as<std::string>();
|
||||||
@@ -570,7 +580,7 @@ namespace Apostol {
|
|||||||
if (VerifyDate(until, Until) != 1)
|
if (VerifyDate(until, Until) != 1)
|
||||||
throw ExceptionFrm("Invalid until date format: %s.", until.c_str());
|
throw ExceptionFrm("Invalid until date format: %s.", until.c_str());
|
||||||
|
|
||||||
m_Data.Payment.Until = DateToString(Until);
|
m_Data.Payment.Until = UTCFormat(DateToString(Until));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &sum = payment["sum"].as<std::string>();
|
const auto &sum = payment["sum"].as<std::string>();
|
||||||
@@ -590,7 +600,7 @@ namespace Apostol {
|
|||||||
if (VerifyDate(leave_before, LeaveBefore) != 1)
|
if (VerifyDate(leave_before, LeaveBefore) != 1)
|
||||||
throw ExceptionFrm("Invalid leave before date format: %s.", leave_before.c_str());
|
throw ExceptionFrm("Invalid leave before date format: %s.", leave_before.c_str());
|
||||||
|
|
||||||
m_Data.FeedBack.LeaveBefore = DateToString(LeaveBefore);
|
m_Data.FeedBack.LeaveBefore = UTCFormat(DateToString(LeaveBefore));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feedback["status"])
|
if (feedback["status"])
|
||||||
@@ -614,10 +624,10 @@ namespace Apostol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_Data.Payment.Until.IsEmpty())
|
if (m_Data.Payment.Until.IsEmpty())
|
||||||
m_Data.Payment.Until = DateToString(Date + 1); // 1 day
|
m_Data.Payment.Until = UTCFormat(DateToString(Date + 1)); // 1 day
|
||||||
|
|
||||||
if (m_Data.FeedBack.LeaveBefore.IsEmpty())
|
if (m_Data.FeedBack.LeaveBefore.IsEmpty())
|
||||||
m_Data.FeedBack.LeaveBefore = DateToString(Date + 14); // 14 day
|
m_Data.FeedBack.LeaveBefore = UTCFormat(DateToString(Date + 14)); // 14 day
|
||||||
|
|
||||||
m_Data.Code = GetCode();
|
m_Data.Code = GetCode();
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -41,9 +41,15 @@ namespace Apostol {
|
|||||||
|
|
||||||
double BTCToDouble(const CString &Value);
|
double BTCToDouble(const CString &Value);
|
||||||
CString DoubleToBTC(const double &Value, const CString &Format = _T("%f BTC"));
|
CString DoubleToBTC(const double &Value, const CString &Format = _T("%f BTC"));
|
||||||
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
CDateTime StringToDate(const CString &Value, const CString &Format = _T("%04d-%02d-%02d %02d:%02d:%02d"));
|
CDateTime StringToDate(const CString &Value, const CString &Format = _T("%04d-%02d-%02d %02d:%02d:%02d"));
|
||||||
CString DateToString(CDateTime Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S UTC"));
|
CString DateToString(CDateTime Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S"));
|
||||||
|
|
||||||
|
int VerifyDate(const CString &Date, CDateTime &Result);
|
||||||
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
CString GenSalt();
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -162,7 +168,7 @@ namespace Apostol {
|
|||||||
enum CFeedBackStatus { fsNegative = -1, fsNeutral = 0, fsPositive = 1 };
|
enum CFeedBackStatus { fsNegative = -1, fsNeutral = 0, fsPositive = 1 };
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
enum CDealOrder { doCreate = 0, doCreated, doSubmit, doSubmitted, doConfirm, doConfirmed, doPay, doPaid, doComplete, doCompleted, doCancel, doCanceled,
|
enum CDealOrder { doCreate = 0, doCreated, doSubmit, doSubmitted, doConfirm, doConfirmed, doPay, doPaid, doComplete, doCompleted, doCancel, doCancelled,
|
||||||
doExecute, doExecuted, doDelete, doDeleted, doFail, doFailed, doFeedback };
|
doExecute, doExecuted, doDelete, doDeleted, doFail, doFailed, doFeedback };
|
||||||
//--------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -173,6 +179,7 @@ namespace Apostol {
|
|||||||
|
|
||||||
// Hidden value
|
// Hidden value
|
||||||
CString Code {};
|
CString Code {};
|
||||||
|
CString Salt {};
|
||||||
|
|
||||||
CString At {};
|
CString At {};
|
||||||
CString Date {};
|
CString Date {};
|
||||||
@@ -233,6 +240,9 @@ namespace Apostol {
|
|||||||
RM.Object().AddPair("at", LS.At);
|
RM.Object().AddPair("at", LS.At);
|
||||||
RM.Object().AddPair("date", LS.Date);
|
RM.Object().AddPair("date", LS.Date);
|
||||||
|
|
||||||
|
if (!LS.Salt.IsEmpty())
|
||||||
|
RM.Object().AddPair("salt", LS.Salt);
|
||||||
|
|
||||||
CJSON jsonSeller(jvtObject);
|
CJSON jsonSeller(jvtObject);
|
||||||
jsonSeller.Object().AddPair("address", LS.Seller.Address);
|
jsonSeller.Object().AddPair("address", LS.Seller.Address);
|
||||||
|
|
||||||
|
|||||||
@@ -519,6 +519,7 @@ namespace Apostol {
|
|||||||
const auto &formType = FormData["type"];
|
const auto &formType = FormData["type"];
|
||||||
const auto &formAt = FormData["at"];
|
const auto &formAt = FormData["at"];
|
||||||
const auto &formDate = FormData["date"];
|
const auto &formDate = FormData["date"];
|
||||||
|
const auto &formSalt = FormData["salt"];
|
||||||
const auto &formSellerAddress = FormData["seller_address"];
|
const auto &formSellerAddress = FormData["seller_address"];
|
||||||
const auto &formSellerRating = FormData["seller_rating"];
|
const auto &formSellerRating = FormData["seller_rating"];
|
||||||
const auto &formSellerSignature = FormData["seller_signature"];
|
const auto &formSellerSignature = FormData["seller_signature"];
|
||||||
@@ -536,7 +537,6 @@ namespace Apostol {
|
|||||||
CheckKeyForNull("order", Action.c_str());
|
CheckKeyForNull("order", Action.c_str());
|
||||||
CheckKeyForNull("type", formType.c_str());
|
CheckKeyForNull("type", formType.c_str());
|
||||||
CheckKeyForNull("at", formAt.c_str());
|
CheckKeyForNull("at", formAt.c_str());
|
||||||
//CheckKeyForNull("date", formDate.c_str());
|
|
||||||
CheckKeyForNull("seller_address", formSellerAddress.c_str());
|
CheckKeyForNull("seller_address", formSellerAddress.c_str());
|
||||||
CheckKeyForNull("customer_address", formCustomerAddress.c_str());
|
CheckKeyForNull("customer_address", formCustomerAddress.c_str());
|
||||||
CheckKeyForNull("payment_sum", formPaymentSum.c_str());
|
CheckKeyForNull("payment_sum", formPaymentSum.c_str());
|
||||||
@@ -556,6 +556,7 @@ namespace Apostol {
|
|||||||
|
|
||||||
Deal["at"] = formAt.c_str();
|
Deal["at"] = formAt.c_str();
|
||||||
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
||||||
|
Deal["salt"] = formSalt.IsEmpty() ? GenSalt().c_str() : formSalt.c_str();
|
||||||
|
|
||||||
YAML::Node Seller = Deal["seller"];
|
YAML::Node Seller = Deal["seller"];
|
||||||
|
|
||||||
@@ -610,6 +611,7 @@ namespace Apostol {
|
|||||||
const auto &formType = FormData.Data("type");
|
const auto &formType = FormData.Data("type");
|
||||||
const auto &formAt = FormData.Data("at");
|
const auto &formAt = FormData.Data("at");
|
||||||
const auto &formDate = FormData.Data("date");
|
const auto &formDate = FormData.Data("date");
|
||||||
|
const auto &formSalt = FormData.Data("salt");
|
||||||
const auto &formSellerAddress = FormData.Data("seller_address");
|
const auto &formSellerAddress = FormData.Data("seller_address");
|
||||||
const auto &formSellerRating = FormData.Data("seller_rating");
|
const auto &formSellerRating = FormData.Data("seller_rating");
|
||||||
const auto &formSellerSignature = FormData.Data("seller_signature");
|
const auto &formSellerSignature = FormData.Data("seller_signature");
|
||||||
@@ -627,7 +629,6 @@ namespace Apostol {
|
|||||||
CheckKeyForNull("order", Action.c_str());
|
CheckKeyForNull("order", Action.c_str());
|
||||||
CheckKeyForNull("type", formType.c_str());
|
CheckKeyForNull("type", formType.c_str());
|
||||||
CheckKeyForNull("at", formAt.c_str());
|
CheckKeyForNull("at", formAt.c_str());
|
||||||
//CheckKeyForNull("date", formDate.c_str());
|
|
||||||
CheckKeyForNull("seller_address", formSellerAddress.c_str());
|
CheckKeyForNull("seller_address", formSellerAddress.c_str());
|
||||||
CheckKeyForNull("customer_address", formCustomerAddress.c_str());
|
CheckKeyForNull("customer_address", formCustomerAddress.c_str());
|
||||||
CheckKeyForNull("payment_sum", formPaymentSum.c_str());
|
CheckKeyForNull("payment_sum", formPaymentSum.c_str());
|
||||||
@@ -647,6 +648,7 @@ namespace Apostol {
|
|||||||
|
|
||||||
Deal["at"] = formAt.c_str();
|
Deal["at"] = formAt.c_str();
|
||||||
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
||||||
|
Deal["salt"] = formSalt.IsEmpty() ? GenSalt().c_str() : formSalt.c_str();
|
||||||
|
|
||||||
YAML::Node Seller = Deal["seller"];
|
YAML::Node Seller = Deal["seller"];
|
||||||
|
|
||||||
@@ -702,6 +704,7 @@ namespace Apostol {
|
|||||||
|
|
||||||
const auto &formAt = jsonData["at"].AsString();
|
const auto &formAt = jsonData["at"].AsString();
|
||||||
const auto &formDate = jsonData["date"].AsString();
|
const auto &formDate = jsonData["date"].AsString();
|
||||||
|
const auto &formSalt = jsonData["salt"].AsString();
|
||||||
|
|
||||||
const CJSONValue &jsonSeller = jsonData["seller"];
|
const CJSONValue &jsonSeller = jsonData["seller"];
|
||||||
|
|
||||||
@@ -733,7 +736,6 @@ namespace Apostol {
|
|||||||
CheckKeyForNull("order", action.c_str());
|
CheckKeyForNull("order", action.c_str());
|
||||||
CheckKeyForNull("type", formType.c_str());
|
CheckKeyForNull("type", formType.c_str());
|
||||||
CheckKeyForNull("at", formAt.c_str());
|
CheckKeyForNull("at", formAt.c_str());
|
||||||
//CheckKeyForNull("date", formDate.c_str());
|
|
||||||
CheckKeyForNull("seller.address", formSellerAddress.c_str());
|
CheckKeyForNull("seller.address", formSellerAddress.c_str());
|
||||||
CheckKeyForNull("customer.address", formCustomerAddress.c_str());
|
CheckKeyForNull("customer.address", formCustomerAddress.c_str());
|
||||||
CheckKeyForNull("payment.sum", formPaymentSum.c_str());
|
CheckKeyForNull("payment.sum", formPaymentSum.c_str());
|
||||||
@@ -753,6 +755,7 @@ namespace Apostol {
|
|||||||
|
|
||||||
Deal["at"] = formAt.c_str();
|
Deal["at"] = formAt.c_str();
|
||||||
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
Deal["date"] = formDate.IsEmpty() ? UTCFormat(DateToString(UTC())).c_str() : formDate.c_str();
|
||||||
|
Deal["salt"] = formSalt.IsEmpty() ? GenSalt().c_str() : formSalt.c_str();
|
||||||
|
|
||||||
YAML::Node Seller = Deal["seller"];
|
YAML::Node Seller = Deal["seller"];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user