graph LR
Funding -- funding transaction is rejected --> Failure
Funding -- funding transaction is accepted --> Funded
Funded -- payment attempt expires --> Refunding
Funded -- gateway cancels payment attempt --> Refunding
Funded -- payment is confirmed --> Success
Refunding -- payment is confirmed --> Success
Refunding -- ecash is minted --> Refunded
Refunding -- minting ecash fails --> Failure
graph LR
Pending -- payment is confirmed --> Claiming
Pending -- invoice expires --> Expired
Claiming -- ecash is minted --> Claimed
Claiming -- minting ecash fails --> Failure
But what if the gateway would claim the htlc with the preimage but does not return it to the client? If the HTLC is claimed we need to consider the payment successful no matter what the gateway returns.
No there is no punishment, claim it ourselves meant the gateway gets its funding refunded.