Skip to content

Commit ce7d1ac

Browse files
authored
Merge pull request #168 from Targoman/fix_devtest_payment_result_checking
devtest payment result checking fixed
2 parents d13fab3 + 4a3ede4 commit ce7d1ac

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Modules/Account/moduleSrc/Payment/Gateways/gtwDevTest.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,13 @@ std::tuple<QString, QString, QString> gtwDevTest::prepareAndRequest(
4141
const QString &_callback,
4242
const QString &_desc
4343
) {
44+
Q_UNUSED(_paymentGateway);
4445
Q_UNUSED(_paymentKey);
4546
Q_UNUSED(_amount);
4647
Q_UNUSED(_callback);
4748
Q_UNUSED(_desc);
4849

49-
// TAPI::JSON_t MetaInfo = NULLABLE_GET_OR_DEFAULT(_paymentGateway.pgwMetaInfo, TAPI::JSON_t());
50-
5150
#ifdef QT_DEBUG
52-
// bool raiseError = _paymentGateway.pgwMetaInfo["raiseError"].toBool();
53-
54-
// raiseError = true;
55-
56-
// if (raiseError)
57-
// throw exPayment("raiseError is TRUE");
58-
5951
QString TrackID = "track_" + _paymentKey;
6052

6153
QString HostPort = APICALLBOOM_PARAM.hostAndPort();
@@ -89,27 +81,26 @@ std::tuple<QString, QString> gtwDevTest::verifyAndSettle(
8981
const TAPI::JSON_t &_pgResponse
9082
// const QString &_domain
9183
) {
84+
Q_UNUSED(_paymentGateway);
85+
Q_UNUSED(_onlinePayment);
9286
Q_UNUSED(_pgResponse);
93-
// Q_UNUSED(_domain);
94-
95-
// TAPI::JSON_t MetaInfo = NULLABLE_GET_OR_DEFAULT(_paymentGateway.pgwMetaInfo, TAPI::JSON_t());
9687

9788
#ifdef QT_DEBUG
98-
// bool raiseError = _paymentGateway.pgwMetaInfo["raiseError"].toBool();
99-
100-
// raiseError = true;
101-
102-
// QString PaymentKey = _pgResponse.object().value("orderId").toString();
103-
// QString TrackID = _pgResponse.object().value("trackId").toString();
104-
10589
if (_pgResponse.isObject() == false)
10690
throw exPayment("Invalid response from gateway.");
10791
QJsonObject PGResponse = _pgResponse.object();
92+
93+
if (PGResponse.contains("result") == false)
94+
throw exPayment("Payment failed due to empty result");
95+
10896
QString Result = PGResponse.value("result").toString();
10997

11098
if (Result == "error")
11199
throw exPayment("Payment failed");
112100

101+
if (Result != "ok")
102+
throw exPayment("Payment failed due to unknown result: " + Result);
103+
113104
return {
114105
"",
115106
"ref_" + _onlinePayment.onpMD5

0 commit comments

Comments
 (0)