@@ -263,7 +263,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
263
263
264
264
// Install global event filter to catch QFileOpenEvents
265
265
// on Mac: sent when you click bitcoin: links
266
- // other OSes: helpful when dealing with payment- request files (in the future)
266
+ // other OSes: helpful when dealing with payment request files (in the future)
267
267
if (parent)
268
268
parent->installEventFilter (this );
269
269
@@ -278,8 +278,10 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
278
278
279
279
if (!uriServer->listen (name))
280
280
qDebug () << " PaymentServer::PaymentServer : Cannot start bitcoin: click-to-pay handler" ;
281
- else
281
+ else {
282
282
connect (uriServer, SIGNAL (newConnection ()), this , SLOT (handleURIConnection ()));
283
+ connect (this , SIGNAL (receivedPaymentACK (QString)), this , SLOT (handlePaymentACK (QString)));
284
+ }
283
285
}
284
286
285
287
// netManager is null until uiReady() is called
@@ -321,7 +323,7 @@ void PaymentServer::initNetManager()
321
323
// netManager is used to fetch paymentrequests given in bitcoin: URIs
322
324
netManager = new QNetworkAccessManager (this );
323
325
324
- // Use proxy settings from optionsModel:
326
+ // Use proxy settings from optionsModel
325
327
QString proxyIP;
326
328
quint16 proxyPort;
327
329
if (optionsModel->getProxySettings (proxyIP, proxyPort))
@@ -457,7 +459,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<Sen
457
459
foreach (const PAIRTYPE (CScript, qint64)& sendingTo, sendingTos) {
458
460
CTxOut txOut (sendingTo.second , sendingTo.first );
459
461
if (txOut.IsDust (CTransaction::nMinRelayTxFee)) {
460
- QString msg = QObject:: tr (" Requested payment amount (%1) too small" )
462
+ QString msg = tr (" Requested payment amount of %1 is too small (considered dust). " )
461
463
.arg (BitcoinUnits::formatWithUnit (optionsModel->getDisplayUnit (), sendingTo.second ));
462
464
463
465
qDebug () << " PaymentServer::processPaymentRequest : " << msg;
@@ -537,7 +539,7 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipien
537
539
payment.add_transactions (transaction.data (), transaction.size ());
538
540
539
541
// Create a new refund address, or re-use:
540
- QString account = tr (" Refund from" ) + QString ( " " ) + recipient.authenticatedMerchant ;
542
+ QString account = tr (" Refund from %1 " ). arg ( recipient.authenticatedMerchant ) ;
541
543
std::string strAccount = account.toStdString ();
542
544
set<CTxDestination> refundAddresses = wallet->GetAccountAddresses (strAccount);
543
545
if (!refundAddresses.empty ()) {
@@ -579,9 +581,10 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
579
581
reply->deleteLater ();
580
582
if (reply->error () != QNetworkReply::NoError)
581
583
{
582
- QString msg = QObject:: tr (" Error communicating with %1: %2" )
584
+ QString msg = tr (" Error communicating with %1: %2" )
583
585
.arg (reply->request ().url ().toString ())
584
586
.arg (reply->errorString ());
587
+
585
588
qDebug () << " PaymentServer::netRequestFinished : " << msg;
586
589
emit message (tr (" Network request error" ), msg, CClientUIInterface::MSG_ERROR);
587
590
return ;
@@ -595,26 +598,28 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
595
598
PaymentRequestPlus request;
596
599
QList<SendCoinsRecipient> recipients;
597
600
if (request.parse (data) && processPaymentRequest (request, recipients)) {
598
- foreach (const SendCoinsRecipient& recipient, recipients){
601
+ foreach (const SendCoinsRecipient& recipient, recipients) {
599
602
emit receivedPaymentRequest (recipient);
600
603
}
601
604
}
602
605
else
603
606
qDebug () << " PaymentServer::netRequestFinished : Error processing payment request" ;
607
+
604
608
return ;
605
609
}
606
610
else if (requestType == " PaymentACK" )
607
611
{
608
612
payments::PaymentACK paymentACK;
609
613
if (!paymentACK.ParseFromArray (data.data (), data.size ()))
610
614
{
611
- QString msg = QObject:: tr (" Bad response from server %1" )
615
+ QString msg = tr (" Bad response from server %1" )
612
616
.arg (reply->request ().url ().toString ());
617
+
613
618
qDebug () << " PaymentServer::netRequestFinished : " << msg;
614
619
emit message (tr (" Network request error" ), msg, CClientUIInterface::MSG_ERROR);
615
620
}
616
621
else {
617
- emit receivedPaymentACK (QString::fromStdString (paymentACK.memo ()));
622
+ emit receivedPaymentACK (GUIUtil::HtmlEscape (paymentACK.memo ()));
618
623
}
619
624
}
620
625
}
@@ -635,3 +640,9 @@ void PaymentServer::setOptionsModel(OptionsModel *optionsModel)
635
640
{
636
641
this ->optionsModel = optionsModel;
637
642
}
643
+
644
+ void PaymentServer::handlePaymentACK (const QString& paymentACKMsg)
645
+ {
646
+ // currently we don't futher process or store the paymentACK message
647
+ emit message (tr (" Payment acknowledged" ), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL);
648
+ }
0 commit comments