diff options
Diffstat (limited to 'src/backend/anastasis-httpd_policy_upload.c')
-rw-r--r-- | src/backend/anastasis-httpd_policy_upload.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c index 11f15e2..0bef15f 100644 --- a/src/backend/anastasis-httpd_policy_upload.c +++ b/src/backend/anastasis-httpd_policy_upload.c @@ -574,6 +574,10 @@ begin_payment (struct PolicyUploadContext *puc) order_id = GNUNET_STRINGS_data_to_string_alloc ( &puc->payment_identifier, sizeof(struct ANASTASIS_PaymentSecretP)); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Creating order for %u years with payment of %s\n", + puc->years_to_pay, + TALER_amount2s (&upload_fee)); order = json_pack ("{s:o, s:s, s:[{s:s,s:I,s:s}], s:s }", "amount", TALER_JSON_from_amount (&upload_fee), "summary", "Anastasis policy storage fee", @@ -846,7 +850,7 @@ AH_handler_policy_post ( } else { - years = 0; + years = 1; } puc->end_date = GNUNET_TIME_relative_to_timestamp ( GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, @@ -865,6 +869,10 @@ AH_handler_policy_post ( / GNUNET_TIME_UNIT_YEARS.rel_value_us; if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) puc->years_to_pay++; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Calculated years to pay to be %u until %s\n", + puc->years_to_pay, + GNUNET_TIME_absolute2s (puc->end_date.abs_time)); if (puc->payment_identifier_provided) { @@ -905,18 +913,14 @@ AH_handler_policy_post ( if (! puc->payment_identifier_provided) { - struct TALER_Amount zero_amount; enum GNUNET_DB_QueryStatus qs; struct GNUNET_TIME_Relative rel; - TALER_amount_set_zero (AH_currency, - &zero_amount); /* generate fresh payment identifier */ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, &puc->payment_identifier, sizeof (struct ANASTASIS_PaymentSecretP)); - if (0 != TALER_amount_cmp (&AH_annual_fee, - &zero_amount)) + if (! TALER_amount_is_zero (&AH_annual_fee)) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "No payment identifier, requesting payment\n"); @@ -940,8 +944,8 @@ AH_handler_policy_post ( ANASTASIS_MAX_YEARS_STORAGE); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Policy lifetime is %s (%u years)\n", - GNUNET_STRINGS_relative_time_to_string (rel, - GNUNET_YES), + GNUNET_TIME_relative2s (rel, + true), ANASTASIS_MAX_YEARS_STORAGE); puc->paid_until = GNUNET_TIME_relative_to_timestamp (rel); qs = db->update_lifetime (db->cls, @@ -983,7 +987,10 @@ AH_handler_policy_post ( / GNUNET_TIME_UNIT_YEARS.rel_value_us; if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) puc->years_to_pay++; - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Calculated years to pay to be %u until %s\n", + puc->years_to_pay, + GNUNET_TIME_absolute2s (puc->end_date.abs_time)); if ( (ANASTASIS_DB_ACCOUNT_STATUS_VALID_HASH_RETURNED == as) && (0 != puc->years_to_pay) ) { |