@@ -41,21 +41,13 @@ std::tuple<QString, QString, QString> gtwDevTest::prepareAndRequest(
41
41
const QString &_callback,
42
42
const QString &_desc
43
43
) {
44
+ Q_UNUSED (_paymentGateway);
44
45
Q_UNUSED (_paymentKey);
45
46
Q_UNUSED (_amount);
46
47
Q_UNUSED (_callback);
47
48
Q_UNUSED (_desc);
48
49
49
- // TAPI::JSON_t MetaInfo = NULLABLE_GET_OR_DEFAULT(_paymentGateway.pgwMetaInfo, TAPI::JSON_t());
50
-
51
50
#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
-
59
51
QString TrackID = " track_" + _paymentKey;
60
52
61
53
QString HostPort = APICALLBOOM_PARAM.hostAndPort ();
@@ -89,27 +81,26 @@ std::tuple<QString, QString> gtwDevTest::verifyAndSettle(
89
81
const TAPI::JSON_t &_pgResponse
90
82
// const QString &_domain
91
83
) {
84
+ Q_UNUSED (_paymentGateway);
85
+ Q_UNUSED (_onlinePayment);
92
86
Q_UNUSED (_pgResponse);
93
- // Q_UNUSED(_domain);
94
-
95
- // TAPI::JSON_t MetaInfo = NULLABLE_GET_OR_DEFAULT(_paymentGateway.pgwMetaInfo, TAPI::JSON_t());
96
87
97
88
#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
-
105
89
if (_pgResponse.isObject () == false )
106
90
throw exPayment (" Invalid response from gateway." );
107
91
QJsonObject PGResponse = _pgResponse.object ();
92
+
93
+ if (PGResponse.contains (" result" ) == false )
94
+ throw exPayment (" Payment failed due to empty result" );
95
+
108
96
QString Result = PGResponse.value (" result" ).toString ();
109
97
110
98
if (Result == " error" )
111
99
throw exPayment (" Payment failed" );
112
100
101
+ if (Result != " ok" )
102
+ throw exPayment (" Payment failed due to unknown result: " + Result);
103
+
113
104
return {
114
105
" " ,
115
106
" ref_" + _onlinePayment.onpMD5
0 commit comments