Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Interfaces/DBM/QueryBuilders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,11 @@ QVariantMap ORMSelectQuery::one(QVariantMap _args) {
.toJson(true, this->Data->Table.Converters);

if (Result.object().isEmpty())
#ifdef QT_DEBUG
throw exHTTPNotFound(QString("No item could be found in table (%1.%2)").arg(PrependSchema(this->Data->Table.Schema)).arg(this->Data->Table.Name));
#else
throw exHTTPNotFound("No item could be found");
#endif

// qDebug() << "--- ORMSelectQuery::one()" << __FILE__ << __LINE__ << Result;
// qDebug() << "--- ORMSelectQuery::one() {tovariant}" << __FILE__ << __LINE__ << Result.toVariant();
Expand Down
8 changes: 8 additions & 0 deletions Interfaces/Helpers/URLHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ QString URLHelper::normalize(const QString &_url) {
return Result;
}

QString URLHelper::encode(const QString &_url) {
return QUrl::toPercentEncoding(_url);
}

QString URLHelper::decode(const QString &_url) {
return QUrl::fromPercentEncoding(_url.toLatin1());
}

} //namespace Targoman::API::Helpers
2 changes: 2 additions & 0 deletions Interfaces/Helpers/URLHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class URLHelper
static QString addParameter(const QString& _url, const QString& _paramName, const QVariant& _value);
static QString addParameters(const QString& _url, const QVariantMap& _params);
static QString normalize(const QString &_url);
static QString encode(const QString &_url);
static QString decode(const QString &_url);
};

} //namespace Targoman::API::Helpers
Expand Down
26 changes: 23 additions & 3 deletions Modules/Account/functionalTest/testAccount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,26 @@ private slots:
/***************************************************************************************/
/* tests *******************************************************************************/
/***************************************************************************************/
// void checkUrl() {
// QString u = QUrl::toPercentEncoding("https://callback.com?a=1&b=2");
// qDebug() << 1 << u;

// u = QUrl::toPercentEncoding(u);
// qDebug() << 2 << u;

// u = QUrl::fromPercentEncoding(u.toLatin1());
// qDebug() << 3 << u;

// u = QUrl::fromPercentEncoding(u.toLatin1());
// qDebug() << 4 << u;

// u = QUrl::fromPercentEncoding(u.toLatin1());
// qDebug() << 5 << u;

// u = QUrl::fromPercentEncoding(u.toLatin1());
// qDebug() << 6 << u;
// }
//private:
void NormalizePhoneNumber() {
try {
QVariant Result = callUserAPI(
Expand Down Expand Up @@ -889,7 +909,7 @@ private slots:
{
{ "amount", 10'000 },
{ "gatewayType", "_DeveloperTest" },
{ "domain", "dev.test" },
// { "domain", "dev.test" },
{ "walID", 0 },
{ "paymentVerifyCallback", "http://127.0.0.1:10000/rest/v1/Account/OnlinePayments/devTestCallbackPage" }
}
Expand Down Expand Up @@ -928,7 +948,7 @@ private slots:
void approveOnlinePayment_for_requestIncrease_DEVTEST_with_domain() {
if (this->Voucher.PaymentKey.isEmpty() == false) {
QT_TRY {
QVariant Result = callUserAPI(
QVariant Result = callAdminAPI(
RESTClientHelper::POST,
"Account/approveOnlinePayment",
{},
Expand Down Expand Up @@ -1047,7 +1067,7 @@ private slots:
void claimOfflinePayment_NO_VOUCHER_2_approveOfflinePayment() {
if (this->OfflinePaymentClaimID > 0) {
QT_TRY {
QVariant Result = callUserAPI(
QVariant Result = callAdminAPI(
RESTClientHelper::POST,
"Account/approveOfflinePayment",
{},
Expand Down
4 changes: 3 additions & 1 deletion Modules/Account/moduleSrc/ORM/Payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ curl -v -H 'accept: application/json' -X 'GET' 'http://127.0.0.1:10000/rest/v1/A
.arg(ServerUrl) //ClientConfigs::RESTServerAddress.value())
.arg(_paymentKey)
;
else
else {
_callback = URLHelper::decode(_callback);
_callback = URLHelper::addParameter(_callback, "paymentKey", _paymentKey);
}

QByteArray Content = R"(
<html>
Expand Down
2 changes: 2 additions & 0 deletions Modules/Account/moduleSrc/ORM/UserWallets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ Targoman::API::AAA::stuVoucher IMPL_REST_CREATE(UserWallets, requestIncrease, (
Voucher.Info.ToPay = _amount;
Voucher.Info.Sign = QString(sign(Voucher.Info));

Voucher.Remained = _amount;

Voucher.ID = Voucher::instance().Create(
APICALLBOOM_PARAM,
TAPI::ORMFields_t({
Expand Down
3 changes: 2 additions & 1 deletion Modules/Account/moduleSrc/Payment/Gateways/gtwDevTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include "gtwDevTest.h"
#include "Interfaces/Helpers/URLHelper.h"
#include "Interfaces/Helpers/RESTClientHelper.h"
using namespace Targoman::API::Helpers;
#include "Interfaces/Server/ServerCommon.h"
Expand Down Expand Up @@ -66,7 +67,7 @@ std::tuple<QString, QString, QString> gtwDevTest::prepareAndRequest(
.arg(ServerUrl) //ClientConfigs::RESTServerAddress.value())
.arg(_paymentKey)
.arg(TrackID)
.arg(_callback)
.arg(URLHelper::encode(_callback))
;

return {
Expand Down