diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 6 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c | 23 |
2 files changed, 27 insertions, 2 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 91533de5..72c3e4da 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -942,7 +942,6 @@ handle_batch_deposit_ok (struct ExchangeGroup *eg, const struct TALER_EXCHANGE_BatchDepositResult *dr) { struct PayContext *pc = eg->pc; - unsigned int j = 0; enum GNUNET_DB_QueryStatus qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; @@ -954,6 +953,8 @@ handle_batch_deposit_ok (struct ExchangeGroup *eg, pc->hc->instance->settings.id); for (unsigned int r = 0; r<MAX_RETRIES; r++) { + unsigned int j = 0; + TMH_db->preflight (TMH_db->cls); if (GNUNET_OK != TMH_db->start (TMH_db->cls, @@ -982,6 +983,7 @@ handle_batch_deposit_ok (struct ExchangeGroup *eg, it is possible to over-pay if two wallets literally make a concurrent payment, as the earlier check for 'paid' is not in the same transaction scope as this 'insert' operation. */ + GNUNET_assert (j < dr->details.success.num_signatures); qs = TMH_db->insert_deposit ( TMH_db->cls, pc->hc->instance->settings.id, @@ -999,7 +1001,7 @@ handle_batch_deposit_ok (struct ExchangeGroup *eg, if (GNUNET_DB_STATUS_SOFT_ERROR == qs) { TMH_db->rollback (TMH_db->cls); - continue; + break; } if (0 > qs) { diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c index fbb4f63f..d3f32da2 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c @@ -114,6 +114,7 @@ struct ExchangeKycRequest * Last KYC status returned by the exchange. */ bool kyc_ok; + }; @@ -217,6 +218,13 @@ struct KycContext * True if @e h_wire was given. */ bool have_h_wire; + + /** + * We're still waiting on the exchange to determine + * the KYC status of our deposit(s). + */ + bool kyc_serial_pending; + }; @@ -615,6 +623,11 @@ kyc_status_cb (void *cls, <, STALE_KYC_TIMEOUT)) ) return; /* KYC ok, ignore! */ + if (0 == exchange_kyc_serial) + { + kc->kyc_serial_pending = true; + return; + } kc->response_code = MHD_HTTP_ACCEPTED; ekr = GNUNET_new (struct ExchangeKycRequest); GNUNET_CONTAINER_DLL_insert (kc->exchange_pending_head, @@ -766,6 +779,16 @@ get_instances_ID_kyc (struct TMH_MerchantInstance *mi, "account_kyc_get_status"); } } + if (kc->kyc_serial_pending) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Exchange legitimization UUID unknown, assuming KYC pending\n"); + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_SERVICE_UNAVAILABLE, + GNUNET_JSON_pack_string ("hint", + "awaiting legitimization UUID")); + } if (NULL == kc->exchange_pending_head) return TALER_MHD_reply_static (connection, MHD_HTTP_NO_CONTENT, |