diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-05-01 18:38:21 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-05-01 18:38:21 +0200 |
commit | 78031b2711991c5ff08adbddf070277f5891d954 (patch) | |
tree | c9bf6c597abd5327e3b244883bcf4deb81aaddfa | |
parent | 4583ce4ef3e72edf001fac3ba3290dfc547dd785 (diff) | |
download | exchange-78031b2711991c5ff08adbddf070277f5891d954.tar.gz exchange-78031b2711991c5ff08adbddf070277f5891d954.zip |
more error codes
-rw-r--r-- | src/include/taler_error_codes.h | 194 | ||||
-rw-r--r-- | src/include/taler_exchange_service.h | 4 | ||||
-rw-r--r-- | src/lib/exchange_api_deposit.c | 10 |
3 files changed, 186 insertions, 22 deletions
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h index c882d27dc..b3be7dc43 100644 --- a/src/include/taler_error_codes.h +++ b/src/include/taler_error_codes.h | |||
@@ -1319,13 +1319,6 @@ enum TALER_ErrorCode | |||
1319 | TALER_EC_PAY_WIRE_FEE_CURRENCY_MISMATCH = 2125, | 1319 | TALER_EC_PAY_WIRE_FEE_CURRENCY_MISMATCH = 2125, |
1320 | 1320 | ||
1321 | /** | 1321 | /** |
1322 | * The merchant refuses to abort and refund the payment operation as | ||
1323 | * the payment succeeded already. This response is provided with HTTP | ||
1324 | * status code of #MHD_HTTP_FORBIDDEN. | ||
1325 | */ | ||
1326 | TALER_EC_PAY_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2126, | ||
1327 | |||
1328 | /** | ||
1329 | * A unknown merchant public key was included in the payment. That | 1322 | * A unknown merchant public key was included in the payment. That |
1330 | * happens typically when the wallet sends the payment to the wrong | 1323 | * happens typically when the wallet sends the payment to the wrong |
1331 | * merchant instance. This response is provided with an HTTP status | 1324 | * merchant instance. This response is provided with an HTTP status |
@@ -1375,6 +1368,80 @@ enum TALER_ErrorCode | |||
1375 | TALER_EC_PAY_REFUNDS_EXCEED_PAYMENTS = 2133, | 1368 | TALER_EC_PAY_REFUNDS_EXCEED_PAYMENTS = 2133, |
1376 | 1369 | ||
1377 | /** | 1370 | /** |
1371 | * The merchant failed to contact the exchange. This response is | ||
1372 | * provided with HTTP status code of #MHD_HTTP_FAILED_DEPENDENCY. | ||
1373 | */ | ||
1374 | TALER_EC_ABORT_EXCHANGE_KEYS_FAILURE = 2150, | ||
1375 | |||
1376 | /** | ||
1377 | * The merchant failed to send the exchange the refund request. This | ||
1378 | * response is provided with HTTP status code of | ||
1379 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1380 | */ | ||
1381 | TALER_EC_ABORT_EXCHANGE_REFUND_FAILED = 2151, | ||
1382 | |||
1383 | /** | ||
1384 | * The merchant failed to find the exchange to process the lookup. | ||
1385 | * This response is provided with HTTP status code of | ||
1386 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1387 | */ | ||
1388 | TALER_EC_ABORT_EXCHANGE_LOOKUP_FAILED = 2152, | ||
1389 | |||
1390 | /** | ||
1391 | * The merchant failed to store the abort request in its database. | ||
1392 | * This response is provided with HTTP status code of | ||
1393 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1394 | */ | ||
1395 | TALER_EC_ABORT_DB_STORE_ABORT_ERROR = 2153, | ||
1396 | |||
1397 | /** | ||
1398 | * The merchant failed to repeatedly serialize the transaction. This | ||
1399 | * response is provided with HTTP status code of | ||
1400 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1401 | */ | ||
1402 | TALER_EC_ABORT_DB_STORE_TRANSACTION_ERROR = 2154, | ||
1403 | |||
1404 | /** | ||
1405 | * The merchant failed in the lookup part of the transaction. This | ||
1406 | * response is provided with HTTP status code of | ||
1407 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1408 | */ | ||
1409 | TALER_EC_ABORT_DB_FETCH_TRANSACTION_ERROR = 2155, | ||
1410 | |||
1411 | /** | ||
1412 | * The merchant could not find the contract. This response is provided | ||
1413 | * with HTTP status code of #MHD_HTTP_NOT_FOUND. | ||
1414 | */ | ||
1415 | TALER_EC_ABORT_CONTRACT_NOT_FOUND = 2156, | ||
1416 | |||
1417 | /** | ||
1418 | * The payment was already completed and thus cannot be aborted | ||
1419 | * anymore. This response is provided with HTTP status code of | ||
1420 | * #MHD_HTTP_FORBIDDEN. | ||
1421 | */ | ||
1422 | TALER_EC_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE = 2157, | ||
1423 | |||
1424 | /** | ||
1425 | * The hash provided by the wallet does not match the order. This | ||
1426 | * response is provided with HTTP status code of | ||
1427 | * #MHD_HTTP_BAD_REQUEST. | ||
1428 | */ | ||
1429 | TALER_EC_ABORT_CONTRACT_HASH_MISSMATCH = 2158, | ||
1430 | |||
1431 | /** | ||
1432 | * The array of coins cannot be empty. This response is provided with | ||
1433 | * HTTP status code of #MHD_HTTP_BAD_REQUEST. | ||
1434 | */ | ||
1435 | TALER_EC_ABORT_COINS_ARRAY_EMPTY = 2159, | ||
1436 | |||
1437 | /** | ||
1438 | * The merchant experienced a timeout processing the request. This | ||
1439 | * response is provided with HTTP status code of | ||
1440 | * #MHD_HTTP_REQUEST_TIMEOUT. | ||
1441 | */ | ||
1442 | TALER_EC_ABORT_EXCHANGE_TIMEOUT = 2160, | ||
1443 | |||
1444 | /** | ||
1378 | * Integer overflow with specified timestamp argument detected. This | 1445 | * Integer overflow with specified timestamp argument detected. This |
1379 | * response is provided with HTTP status code #MHD_HTTP_BAD_REQUEST. | 1446 | * response is provided with HTTP status code #MHD_HTTP_BAD_REQUEST. |
1380 | */ | 1447 | */ |
@@ -1617,25 +1684,29 @@ enum TALER_ErrorCode | |||
1617 | 1684 | ||
1618 | /** | 1685 | /** |
1619 | * The backend encountered an error while trying to retrieve the | 1686 | * The backend encountered an error while trying to retrieve the |
1620 | * proposal data from database. Likely to be an internal error. | 1687 | * proposal data from database. Likely to be an internal error. The |
1688 | * response is provided with HTTP status code | ||
1689 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1621 | */ | 1690 | */ |
1622 | TALER_EC_PROPOSAL_LOOKUP_DB_ERROR = 2502, | 1691 | TALER_EC_PROPOSAL_LOOKUP_DB_ERROR = 2502, |
1623 | 1692 | ||
1624 | /** | 1693 | /** |
1625 | * The proposal being looked up is not found on this merchant. | 1694 | * The proposal being looked up is not found on this merchant. |
1695 | * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND | ||
1626 | */ | 1696 | */ |
1627 | TALER_EC_PROPOSAL_LOOKUP_NOT_FOUND = 2503, | 1697 | TALER_EC_PROPOSAL_LOOKUP_NOT_FOUND = 2503, |
1628 | 1698 | ||
1629 | /** | 1699 | /** |
1630 | * The proposal had no timestamp and the backend failed to obtain the | 1700 | * The proposal had no timestamp and the backend failed to obtain the |
1631 | * local time. Likely to be an internal error. | 1701 | * local time. Likely to be an internal error. The response is |
1702 | * provided with HTTP status code #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1632 | */ | 1703 | */ |
1633 | TALER_EC_PROPOSAL_NO_LOCALTIME = 2504, | 1704 | TALER_EC_PROPOSAL_NO_LOCALTIME = 2504, |
1634 | 1705 | ||
1635 | /** | 1706 | /** |
1636 | * The order provided to the backend could not be parsed, some | 1707 | * The order provided to the backend could not be parsed, some |
1637 | * required fields were missing or ill-formed. Returned as a bad | 1708 | * required fields were missing or ill-formed. Returned with an HTTP |
1638 | * request. | 1709 | * status code #MHD_HTTP_BAD_REQUEST. |
1639 | */ | 1710 | */ |
1640 | TALER_EC_PROPOSAL_ORDER_PARSE_ERROR = 2505, | 1711 | TALER_EC_PROPOSAL_ORDER_PARSE_ERROR = 2505, |
1641 | 1712 | ||
@@ -1674,6 +1745,80 @@ enum TALER_ErrorCode | |||
1674 | TALER_EC_PROPOSAL_REPLY_MALFORMED = 2510, | 1745 | TALER_EC_PROPOSAL_REPLY_MALFORMED = 2510, |
1675 | 1746 | ||
1676 | /** | 1747 | /** |
1748 | * The order provided to the backend could not be deleted, it is not | ||
1749 | * known. Returned with an HTTP status code #MHD_HTTP_NOT_FOUND. | ||
1750 | */ | ||
1751 | TALER_EC_ORDERS_DELETE_NO_SUCH_ORDER = 2511, | ||
1752 | |||
1753 | /** | ||
1754 | * The order provided to the backend could not be deleted, our offer | ||
1755 | * is still valid and awaiting payment. Returned with an HTTP status | ||
1756 | * code #MHD_HTTP_CONFLICT. | ||
1757 | */ | ||
1758 | TALER_EC_ORDERS_DELETE_AWAITING_PAYMENT = 2512, | ||
1759 | |||
1760 | /** | ||
1761 | * The order provided to the backend could not be deleted, due to a | ||
1762 | * database error. Returned with an HTTP status code | ||
1763 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1764 | */ | ||
1765 | TALER_EC_ORDERS_DELETE_DB_HARD_FAILURE = 2513, | ||
1766 | |||
1767 | /** | ||
1768 | * The order provided to the backend could not be completed, due to a | ||
1769 | * database error trying to fetch product inventory data. Returned | ||
1770 | * with an HTTP status code #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1771 | */ | ||
1772 | TALER_EC_ORDERS_LOOKUP_PRODUCT_DB_HARD_FAILURE = 2514, | ||
1773 | |||
1774 | /** | ||
1775 | * The order provided to the backend could not be completed, due to a | ||
1776 | * database serialization error (which should be impossible) trying to | ||
1777 | * fetch product inventory data. Returned with an HTTP status code | ||
1778 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1779 | */ | ||
1780 | TALER_EC_ORDERS_LOOKUP_PRODUCT_DB_SOFT_FAILURE = 2515, | ||
1781 | |||
1782 | /** | ||
1783 | * The order provided to the backend could not be completed, because a | ||
1784 | * product to be completed via inventory data is not actually in our | ||
1785 | * inventory. Returned with an HTTP status code #MHD_HTTP_NOT_FOUND. | ||
1786 | */ | ||
1787 | TALER_EC_ORDERS_LOOKUP_PRODUCT_NOT_FOUND = 2516, | ||
1788 | |||
1789 | /** | ||
1790 | * We could not obtain a list of all orders because of a database | ||
1791 | * failure. Returned with an HTTP status code | ||
1792 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1793 | */ | ||
1794 | TALER_EC_ORDERS_GET_DB_LOOKUP_ERROR = 2517, | ||
1795 | |||
1796 | /** | ||
1797 | * We could not claim the order because of a database failure. | ||
1798 | * Returned with an HTTP status code #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1799 | */ | ||
1800 | TALER_EC_ORDERS_CLAIM_HARD_DB_ERROR = 2518, | ||
1801 | |||
1802 | /** | ||
1803 | * We could not claim the order because of a database serialization | ||
1804 | * failure. Returned with an HTTP status code | ||
1805 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1806 | */ | ||
1807 | TALER_EC_ORDERS_CLAIM_SOFT_DB_ERROR = 2519, | ||
1808 | |||
1809 | /** | ||
1810 | * We could not claim the order because the backend is unaware of it. | ||
1811 | * Returned with an HTTP status code #MHD_HTTP_NOT_FOUND. | ||
1812 | */ | ||
1813 | TALER_EC_ORDERS_CLAIM_NOT_FOUND = 2520, | ||
1814 | |||
1815 | /** | ||
1816 | * We could not claim the order because someone else claimed it first. | ||
1817 | * Returned with an HTTP status code #MHD_HTTP_CONFLICT. | ||
1818 | */ | ||
1819 | TALER_EC_ORDERS_ALREADY_CLAIMED = 2521, | ||
1820 | |||
1821 | /** | ||
1677 | * The merchant backend failed to lookup the products. The response is | 1822 | * The merchant backend failed to lookup the products. The response is |
1678 | * provied with an HTTP status of #MHD_HTTP_INTERNAL_SERVER_ERROR. | 1823 | * provied with an HTTP status of #MHD_HTTP_INTERNAL_SERVER_ERROR. |
1679 | */ | 1824 | */ |
@@ -1724,11 +1869,11 @@ enum TALER_ErrorCode | |||
1724 | TALER_EC_PRODUCTS_PATCH_TOTAL_LOST_REDUCED = 2557, | 1869 | TALER_EC_PRODUCTS_PATCH_TOTAL_LOST_REDUCED = 2557, |
1725 | 1870 | ||
1726 | /** | 1871 | /** |
1727 | * The update would have reduced the total amount of product sold, | 1872 | * The update would have mean that more stocks were lost than what |
1728 | * which is not allowed. The response is provied with an HTTP status | 1873 | * remains from total inventory after sales, which is not allowed. The |
1729 | * of #MHD_HTTP_CONFLICT. | 1874 | * response is provied with an HTTP status of #MHD_HTTP_CONFLICT. |
1730 | */ | 1875 | */ |
1731 | TALER_EC_PRODUCTS_PATCH_TOTAL_SOLD_REDUCED = 2558, | 1876 | TALER_EC_PRODUCTS_PATCH_TOTAL_LOST_EXCEEDS_STOCKS = 2558, |
1732 | 1877 | ||
1733 | /** | 1878 | /** |
1734 | * The update would have reduced the total amount of product in stock, | 1879 | * The update would have reduced the total amount of product in stock, |
@@ -1751,6 +1896,25 @@ enum TALER_ErrorCode | |||
1751 | TALER_EC_PRODUCTS_LOCK_UNKNOWN_PRODUCT = 2561, | 1896 | TALER_EC_PRODUCTS_LOCK_UNKNOWN_PRODUCT = 2561, |
1752 | 1897 | ||
1753 | /** | 1898 | /** |
1899 | * The deletion request resulted in a hard database error. The | ||
1900 | * response is provied with an HTTP status of | ||
1901 | * #MHD_HTTP_INTERNAL_SERVER_ERROR. | ||
1902 | */ | ||
1903 | TALER_EC_PRODUCTS_DELETE_DB_HARD_FAILURE = 2562, | ||
1904 | |||
1905 | /** | ||
1906 | * The deletion request was for a product unknown to the backend. The | ||
1907 | * response is provied with an HTTP status of #MHD_HTTP_NOT_FOUND. | ||
1908 | */ | ||
1909 | TALER_EC_PRODUCTS_DELETE_NO_SUCH_PRODUCT = 2563, | ||
1910 | |||
1911 | /** | ||
1912 | * The deletion request is for a product that is locked. The response | ||
1913 | * is provied with an HTTP status of #MHD_HTTP_CONFLICT. | ||
1914 | */ | ||
1915 | TALER_EC_PRODUCTS_DELETE_CONFLICTING_LOCK = 2564, | ||
1916 | |||
1917 | /** | ||
1754 | * The merchant returned a malformed response. Error created client- | 1918 | * The merchant returned a malformed response. Error created client- |
1755 | * side. | 1919 | * side. |
1756 | */ | 1920 | */ |
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 3505195f5..f7fa71443 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h | |||
@@ -757,14 +757,14 @@ struct TALER_EXCHANGE_DepositHandle; | |||
757 | * @param cls closure | 757 | * @param cls closure |
758 | * @param hr HTTP response data | 758 | * @param hr HTTP response data |
759 | * @param exchange_sig signature provided by the exchange | 759 | * @param exchange_sig signature provided by the exchange |
760 | * @param sign_key exchange key used to sign @a obj, or NULL | 760 | * @param exchange_pub exchange key used to sign @a obj, or NULL |
761 | */ | 761 | */ |
762 | typedef void | 762 | typedef void |
763 | (*TALER_EXCHANGE_DepositResultCallback) ( | 763 | (*TALER_EXCHANGE_DepositResultCallback) ( |
764 | void *cls, | 764 | void *cls, |
765 | const struct TALER_EXCHANGE_HttpResponse *hr, | 765 | const struct TALER_EXCHANGE_HttpResponse *hr, |
766 | const struct TALER_ExchangeSignatureP *exchange_sig, | 766 | const struct TALER_ExchangeSignatureP *exchange_sig, |
767 | const struct TALER_ExchangePublicKeyP *sign_key); | 767 | const struct TALER_ExchangePublicKeyP *exchange_pub); |
768 | 768 | ||
769 | 769 | ||
770 | /** | 770 | /** |
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 3c06bbe39..5f3749931 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c | |||
@@ -550,11 +550,11 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, | |||
550 | char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; | 550 | char pub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; |
551 | char *end; | 551 | char *end; |
552 | 552 | ||
553 | end = GNUNET_STRINGS_data_to_string (coin_pub, | 553 | end = GNUNET_STRINGS_data_to_string ( |
554 | sizeof (struct | 554 | coin_pub, |
555 | TALER_CoinSpendPublicKeyP), | 555 | sizeof (struct TALER_CoinSpendPublicKeyP), |
556 | pub_str, | 556 | pub_str, |
557 | sizeof (pub_str)); | 557 | sizeof (pub_str)); |
558 | *end = '\0'; | 558 | *end = '\0'; |
559 | GNUNET_snprintf (arg_str, | 559 | GNUNET_snprintf (arg_str, |
560 | sizeof (arg_str), | 560 | sizeof (arg_str), |