diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-12-14 16:10:40 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-12-14 16:10:40 +0100 |
commit | ad5d54f48534ac0ad5bfd7f048bd7782e674a89b (patch) | |
tree | 4443e41c1aec412d82642b194aa3d837c9eb5cfd /src/backend/taler-merchant-httpd_post-orders-ID-pay.c | |
parent | 49e2e44b09dd845d0922c0acef5ff487b52bf26d (diff) | |
download | merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.gz merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.bz2 merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.zip |
migration to protocol v11
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 | 46 |
1 files changed, 24 insertions, 22 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 7867e1ea..bea47c4e 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -291,22 +291,22 @@ struct PayContext * Wire transfer deadline. How soon would the merchant like the * wire transfer to be executed? */ - struct GNUNET_TIME_Absolute wire_transfer_deadline; + struct GNUNET_TIME_Timestamp wire_transfer_deadline; /** * Timestamp from @e contract_terms. */ - struct GNUNET_TIME_Absolute timestamp; + struct GNUNET_TIME_Timestamp timestamp; /** * Refund deadline from @e contract_terms. */ - struct GNUNET_TIME_Absolute refund_deadline; + struct GNUNET_TIME_Timestamp refund_deadline; /** * Deadline for the customer to pay for this proposal. */ - struct GNUNET_TIME_Absolute pay_deadline; + struct GNUNET_TIME_Timestamp pay_deadline; /** * Number of transactions that the wire fees are expected to be @@ -419,7 +419,7 @@ struct KycContext /** * Initial DB timestamp. */ - struct GNUNET_TIME_Absolute kyc_timestamp; + struct GNUNET_TIME_Timestamp kyc_timestamp; /** * Initial KYC status. @@ -686,11 +686,10 @@ deposit_get_callback ( { struct KycContext *kc = cls; enum GNUNET_DB_QueryStatus qs; - struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Timestamp now; kc->dg = NULL; - now = GNUNET_TIME_absolute_get (); - (void) GNUNET_TIME_round_abs (&now); + now = GNUNET_TIME_timestamp_get (); switch (dr->hr.http_status) { case MHD_HTTP_OK: @@ -791,7 +790,7 @@ kyc_cb ( uint64_t exchange_kyc_serial, const char *payto_uri, const char *exchange_url, - struct GNUNET_TIME_Absolute last_check, + struct GNUNET_TIME_Timestamp last_check, bool kyc_ok) { struct KycContext *kc = cls; @@ -837,8 +836,10 @@ check_kyc (struct PayContext *pc, GNUNET_free (kc); return; /* we are done */ } - if (GNUNET_TIME_absolute_get_duration (kc->kyc_timestamp).rel_value_us < - KYC_RETRY_FREQUENCY.rel_value_us) + if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration ( + kc->kyc_timestamp.abs_time), + <, + KYC_RETRY_FREQUENCY)) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Not re-checking KYC status at `%s', as we already recently asked\n", @@ -2113,14 +2114,14 @@ parse_pay (struct MHD_Connection *connection, &pc->max_wire_fee), GNUNET_JSON_spec_uint32 ("wire_fee_amortization", &pc->wire_fee_amortization), - TALER_JSON_spec_absolute_time ("timestamp", - &pc->timestamp), - TALER_JSON_spec_absolute_time ("refund_deadline", - &pc->refund_deadline), - TALER_JSON_spec_absolute_time ("pay_deadline", - &pc->pay_deadline), - TALER_JSON_spec_absolute_time ("wire_transfer_deadline", - &pc->wire_transfer_deadline), + GNUNET_JSON_spec_timestamp ("timestamp", + &pc->timestamp), + GNUNET_JSON_spec_timestamp ("refund_deadline", + &pc->refund_deadline), + GNUNET_JSON_spec_timestamp ("pay_deadline", + &pc->pay_deadline), + GNUNET_JSON_spec_timestamp ("wire_transfer_deadline", + &pc->wire_transfer_deadline), GNUNET_JSON_spec_fixed_auto ("h_wire", &pc->h_wire), GNUNET_JSON_spec_end () @@ -2140,8 +2141,9 @@ parse_pay (struct MHD_Connection *connection, } } - if (pc->wire_transfer_deadline.abs_value_us < - pc->refund_deadline.abs_value_us) + if (GNUNET_TIME_timestamp_cmp (pc->wire_transfer_deadline, + <, + pc->refund_deadline)) { /* This should already have been checked when creating the order! */ GNUNET_break (0); @@ -2151,7 +2153,7 @@ parse_pay (struct MHD_Connection *connection, NULL); } - if (GNUNET_TIME_absolute_is_past (pc->pay_deadline)) + if (GNUNET_TIME_absolute_is_past (pc->pay_deadline.abs_time)) { /* too late */ return (MHD_YES == |