diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_post-orders-ID-pay.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c index ea8dd200..7ec76fc5 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -1300,11 +1300,15 @@ static void trigger_payment_notification (struct PayContext *pc) { { - struct TMH_OrderPayEvent pay_eh = { + struct TMH_OrderPayEventP pay_eh = { .header.size = htons (sizeof (pay_eh)), - .header.type = htons (TALER_DBEVENT_MERCHANT_ORDER_PAID) + .header.type = htons (TALER_DBEVENT_MERCHANT_ORDER_PAID), + .merchant_pub = pc->hc->instance->merchant_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Notifying clients about payment of order %s\n", + pc->order_id); GNUNET_CRYPTO_hash (pc->order_id, strlen (pc->order_id), &pay_eh.h_order_id); @@ -1316,14 +1320,16 @@ trigger_payment_notification (struct PayContext *pc) if ( (NULL != pc->session_id) && (NULL != pc->fulfillment_url) ) { -#ifndef TALER_API_VERSION -#define TALER_DBEVENT_MERCHANT_SESSION_CAPTURED 1103 -#endif - struct TMH_SessionEvent session_eh = { + struct TMH_SessionEventP session_eh = { .header.size = htons (sizeof (session_eh)), - .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED) + .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED), + .merchant_pub = pc->hc->instance->merchant_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Notifying clients about session change to %s for %s\n", + pc->session_id, + pc->fulfillment_url); GNUNET_CRYPTO_hash (pc->session_id, strlen (pc->session_id), &session_eh.h_session_id); @@ -1347,7 +1353,6 @@ execute_pay_transaction (struct PayContext *pc) { struct TMH_HandlerContext *hc = pc->hc; const char *instance_id = hc->instance->settings.id; - bool refunded; /* Avoid re-trying transactions on soft errors forever! */ if (pc->retry_counter++ > MAX_RETRIES) @@ -1421,6 +1426,7 @@ execute_pay_transaction (struct PayContext *pc) { enum GNUNET_DB_QueryStatus qs; + /* Check if we refunded some of the coins */ qs = TMH_db->lookup_refunds (TMH_db->cls, instance_id, @@ -1443,10 +1449,9 @@ execute_pay_transaction (struct PayContext *pc) "lookup refunds"); return; } - refunded = (qs > 0); } - /* Check if there are coins that still need to be processed */ + /* Check if there are coins that still need to be processed */ if (0 != pc->pending) { /* we made no DB changes, so we can just rollback */ @@ -1494,7 +1499,6 @@ execute_pay_transaction (struct PayContext *pc) "mark contract paid"); return; } - trigger_payment_notification (pc); } { @@ -1518,25 +1522,9 @@ execute_pay_transaction (struct PayContext *pc) NULL); return; } + trigger_payment_notification (pc); } - /* Notify clients that have been waiting for the payment to succeed */ - if ( (NULL != pc->session_id) && - (NULL != pc->fulfillment_url) ) - TMH_long_poll_resume2 (pc->session_id, - pc->fulfillment_url); - TMH_long_poll_resume (pc->order_id, - hc->instance, - NULL, - false); - TMH_notify_order_change (hc->instance, - pc->order_id, - true, /* paid */ - refunded, - false, /* wired */ - pc->timestamp, - pc->order_serial); - /* Generate response (payment successful) */ { struct GNUNET_CRYPTO_EddsaSignature sig; |