Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

feat: add payment_sent notification #436

Merged
merged 5 commits into from
Jun 21, 2024
Merged

feat: add payment_sent notification #436

merged 5 commits into from
Jun 21, 2024

Conversation

im-adithya
Copy link
Member

@im-adithya im-adithya commented Jun 12, 2024

Fixes getAlby/hub#64 | Adds support for payment_sent notification

Testing

  • Added test in NWC
  • split tests - @im-adithya
  • Check from rails app - @im-adithya
  • Update NIP-47 notifications PR - @rolznz - TODO afterwards.
  • Wait for response from Kukks to see we don't break something - @rolznz - yes, it will just fall back to polling (but I don't think that's the case anyway because it probably just uses the published info event)

@im-adithya im-adithya requested a review from rolznz June 12, 2024 11:52
@im-adithya
Copy link
Member Author

To be added in nostr-protocol/nips#1164

### `payment_sent`

Description: A payment was successfully sent from the wallet.

Notification:
```jsonc
{
    "notification_type": "payment_sent",
    "notification": {
        "type": "outgoing",
        "invoice": "string", // encoded invoice
        "description": "string", // invoice's description, optional
        "description_hash": "string", // invoice's description hash, optional
        "preimage": "string", // payment's preimage
        "payment_hash": "string", // Payment hash for the payment
        "amount": 123, // value in msats
        "fees_paid": 123, // value in msats
        "created_at": unixtimestamp, // invoice/payment creation time
        "expires_at": unixtimestamp, // invoice expiration time, optional if not applicable
        "settled_at": unixtimestamp, // invoice/payment settlement time
        "metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc.
    }
}

@rolznz
Copy link
Collaborator

rolznz commented Jun 19, 2024

@im-adithya can you update this PR?

@im-adithya
Copy link
Member Author

Done!

events/models.go Outdated Show resolved Hide resolved
@rolznz
Copy link
Collaborator

rolznz commented Jun 21, 2024

@im-adithya @bumi I looked at the rails code and it seems to look ok to handle both incoming and outgoing invoices without any changes

I'm merging this now. In case you have any feedback, let me know and I'll address it in a follow up PR

@rolznz rolznz merged commit 474c1ca into master Jun 21, 2024
7 checks passed
@rolznz rolznz deleted the task-payment-sent branch June 21, 2024 04:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add payment_sent support for NIP-47 notifications
2 participants