fix: pay invoice status (#2481)
* fix: rest `pay_invoice` pending instead of failed
* fix: rpc `pay_invoice` pending instead of failed
* fix: return "failed" value for payment
* fix: handle failed status for LNbits funding source
* chore: `phoenixd` todo
* test: fix condition
* fix: wait for payment status to be updated
* fix: fail payment when explicit status provided
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
parent
b9e62bfceb
commit
eae5002b69
14 changed files with 335 additions and 220 deletions
|
|
@ -1310,6 +1310,58 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "failed",
|
||||
"call_params": {
|
||||
"bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"fee_limit_msat": 25000
|
||||
},
|
||||
"expect": {
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
},
|
||||
"mocks": {
|
||||
"corelightningrest": {
|
||||
"pay_invoice_endpoint": [
|
||||
{
|
||||
"request_type": "data",
|
||||
"request_body": {
|
||||
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"maxfeepercent": "119.04761905",
|
||||
"exemptfee": 0
|
||||
},
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"status": "failed"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"lndrest": {
|
||||
"pay_invoice_endpoint": [
|
||||
{
|
||||
"request_type": "json",
|
||||
"request_body": {
|
||||
"payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"fee_limit": 25000
|
||||
},
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"payment_error": "Test Error"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"alby": {},
|
||||
"eclair": [],
|
||||
"lnbits": [],
|
||||
"phoenixd": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "pending, no fee",
|
||||
"call_params": {
|
||||
|
|
@ -1462,8 +1514,8 @@
|
|||
},
|
||||
"expect": {
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null,
|
||||
|
|
@ -1481,25 +1533,14 @@
|
|||
},
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"status": "pending",
|
||||
"error": "Test Error"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"lndrest": {
|
||||
"pay_invoice_endpoint": [
|
||||
{
|
||||
"request_type": "json",
|
||||
"request_body": {
|
||||
"payment_request": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"fee_limit": 25000
|
||||
},
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"payment_error": "Test Error"
|
||||
}
|
||||
}
|
||||
]
|
||||
"pay_invoice_endpoint": []
|
||||
},
|
||||
"alby": {
|
||||
"pay_invoice_endpoint": []
|
||||
|
|
@ -1530,31 +1571,7 @@
|
|||
]
|
||||
},
|
||||
"lnbits": {
|
||||
"pay_invoice_endpoint": [
|
||||
{
|
||||
"request_type": "json",
|
||||
"request_body": {
|
||||
"out": true,
|
||||
"blt11": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
|
||||
},
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"detail": "Test Error"
|
||||
}
|
||||
}
|
||||
],
|
||||
"get_payment_status_endpoint": [
|
||||
{
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"paid": true,
|
||||
"preimage": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"details": {
|
||||
"fee": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"pay_invoice_endpoint": []
|
||||
},
|
||||
"phoenixd": {
|
||||
"pay_invoice_endpoint": [
|
||||
|
|
@ -1591,8 +1608,8 @@
|
|||
"expect": {
|
||||
"error_message": "Server error: 'missing required fields'",
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
|
|
@ -1688,8 +1705,8 @@
|
|||
"expect": {
|
||||
"error_message": "Server error: 'invalid json response'",
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
|
|
@ -1806,8 +1823,8 @@
|
|||
"expect": {
|
||||
"error_message": "Unable to connect to http://127.0.0.1:8555.",
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
|
|
@ -1936,8 +1953,8 @@
|
|||
"expect": {
|
||||
"error_message": "Unable to connect to http://127.0.0.1:8555.",
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
|
|
@ -2643,7 +2660,17 @@
|
|||
]
|
||||
},
|
||||
"lnbits": {
|
||||
"get_payment_status_endpoint": []
|
||||
"get_payment_status_endpoint": [
|
||||
{
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"paid": false,
|
||||
"status": "failed",
|
||||
"preimage": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"details": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"phoenixd": {
|
||||
"description": "phoenixd.py doesn't handle the 'failed' status for `get_invoice_status`",
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"description": "error",
|
||||
"description": "failed",
|
||||
"call_params": {
|
||||
"bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"fee_limit_msat": 25000
|
||||
|
|
@ -826,31 +826,17 @@
|
|||
"expect": {
|
||||
"__eval__:error_message": "\"Payment failed: \" in \"{error_message}\"",
|
||||
"success": false,
|
||||
"pending": false,
|
||||
"failed": true,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
},
|
||||
"mocks": {
|
||||
"breez": {
|
||||
"sdk_services": [
|
||||
{
|
||||
"response_type": "data",
|
||||
"response": {
|
||||
"send_payment": {
|
||||
"request_type": "function",
|
||||
"response_type": "exception",
|
||||
"response": {
|
||||
"data": "test-error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"breez": {},
|
||||
"corelightning": {
|
||||
"ln": [
|
||||
{
|
||||
"description": "test-error",
|
||||
"response": {
|
||||
"call": {
|
||||
"description": "indirect call to `pay` (via `call`)",
|
||||
|
|
@ -867,7 +853,20 @@
|
|||
},
|
||||
"response_type": "exception",
|
||||
"response": {
|
||||
"data": "test-error"
|
||||
"module": "pyln.client.lightning",
|
||||
"class": "RpcError",
|
||||
"data": {
|
||||
"method": "test_method",
|
||||
"payload": "y",
|
||||
"error": {
|
||||
"code": 205,
|
||||
"attempts": [
|
||||
{
|
||||
"fail_reason": "some reason"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -994,7 +993,77 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "error",
|
||||
"call_params": {
|
||||
"bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"fee_limit_msat": 25000
|
||||
},
|
||||
"expect": {
|
||||
"__eval__:error_message": "\"Payment failed: \" in \"{error_message}\"",
|
||||
"success": false,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null
|
||||
},
|
||||
"mocks": {
|
||||
"breez": {
|
||||
"sdk_services": [
|
||||
{
|
||||
"response_type": "data",
|
||||
"response": {
|
||||
"send_payment": {
|
||||
"request_type": "function",
|
||||
"response_type": "exception",
|
||||
"response": {
|
||||
"data": "test-error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"corelightning": {
|
||||
"ln": [
|
||||
{
|
||||
"description": "test-error",
|
||||
"response": {
|
||||
"call": {
|
||||
"description": "indirect call to `pay` (via `call`)",
|
||||
"request_type": "function",
|
||||
"request_data": {
|
||||
"args": [
|
||||
"pay",
|
||||
{
|
||||
"bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"description": "Unit Test Invoice",
|
||||
"maxfee": 25000
|
||||
}
|
||||
]
|
||||
},
|
||||
"response_type": "exception",
|
||||
"response": {
|
||||
"data": "test-error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"lndrpc": {
|
||||
"rpc": [
|
||||
{
|
||||
"response": {}
|
||||
}
|
||||
],
|
||||
"routerpc": [
|
||||
{
|
||||
"description": "RPC error.",
|
||||
"response": {
|
||||
|
|
@ -1024,11 +1093,13 @@
|
|||
"fee_limit_msat": 25000
|
||||
},
|
||||
"expect": {
|
||||
"error_message": "Server error: 'missing required fields'",
|
||||
"success": false,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null,
|
||||
"error_message": "Server error: 'missing required fields'"
|
||||
"preimage": null
|
||||
},
|
||||
"mocks": {
|
||||
"breez": {
|
||||
|
|
@ -1071,11 +1142,13 @@
|
|||
"fee_limit_msat": 25000
|
||||
},
|
||||
"expect": {
|
||||
"error_message": "RPC 'test_method' failed with 'test-error'.",
|
||||
"success": false,
|
||||
"pending": true,
|
||||
"failed": false,
|
||||
"checking_id": null,
|
||||
"fee_msat": null,
|
||||
"preimage": null,
|
||||
"error_message": "RPC 'test_method' failed with 'test-error'."
|
||||
"preimage": null
|
||||
},
|
||||
"mocks": {
|
||||
"breez": {
|
||||
|
|
@ -1083,40 +1156,6 @@
|
|||
},
|
||||
"corelightning": {
|
||||
"ln": [
|
||||
{
|
||||
"response": {
|
||||
"call": {
|
||||
"description": "indirect call to `pay` (via `call`)",
|
||||
"request_type": "function",
|
||||
"request_data": {
|
||||
"args": [
|
||||
"pay",
|
||||
{
|
||||
"bolt11": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
|
||||
"description": "Unit Test Invoice",
|
||||
"maxfee": 25000
|
||||
}
|
||||
]
|
||||
},
|
||||
"response_type": "exception",
|
||||
"response": {
|
||||
"module": "pyln.client.lightning",
|
||||
"class": "RpcError",
|
||||
"data": {
|
||||
"method": "test_method",
|
||||
"payload": "y",
|
||||
"error": {
|
||||
"attempts": [
|
||||
{
|
||||
"fail_reason": "RPC 'test_method' failed with 'test-error'."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"response": {
|
||||
"call": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue