[fix] verify that ledger is not undefined #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'm running ripple-rest-client v1.17.0-rc1 and ripple-rest v1.6.0-rc1.
The _getAndHandlePaymentStatus does not take into account this case:
{"success":true,"payment":{"source_account":"rGYZC2qMSDseEsK52Ta6JmgMA4ksGyM99V","source_tag":"","source_amount":{"currency":"DNX","value":"3702","issuer":"rfw73jNZHFZA3fPxwxguwUb6eR6yWfVCKf"},"source_slippage":"0","destination_account":"rG3YV5kDM6SvLHf35tParhBzi1mVPLPUnj","destination_tag":"3912171743","destination_amount":{"currency":"DNX","value":"3702","issuer":"rfw73jNZHFZA3fPxwxguwUb6eR6yWfVCKf"},"invoice_id":"","paths":"[]","no_direct_ripple":false,"partial_payment":false,"direction":"outgoing","timestamp":"","fee":"0.012","balance_changes":[],"source_balance_changes":[],"destination_balance_changes":[],"order_changes":[]},"client_resource_id":"995d17d0-20c3-47c2-92d8-c2ef343cf48d","hash":"B5717D1BB52CA6470996154D7101F9297A8F3FC29F10260DF5505906CBE15381","ledger":"undefined","state":"failed"}
As you can see the ledger in undefined, and therefore the state failed, even though the payment was succesfull.
I slightly modified _getAndHandlePaymentStatus in order to solve it.