Skip to content

feat(chat): add payment marked-as-paid handler and milestone status e…#329

Open
SudiptaPaul-31 wants to merge 3 commits into
Kaizenode:mainfrom
SudiptaPaul-31:fix-wire-ipaid
Open

feat(chat): add payment marked-as-paid handler and milestone status e…#329
SudiptaPaul-31 wants to merge 3 commits into
Kaizenode:mainfrom
SudiptaPaul-31:fix-wire-ipaid

Conversation

@SudiptaPaul-31

Copy link
Copy Markdown

📝 Implement "I Paid" Chat Action for Escrow Milestone Status Update

🛠️ Issue

📖 Description

Implements the "I paid" chat action feature that allows buyers to mark SEPA/Bizum payments as complete directly from the P2P chat interface. When a buyer confirms payment outside the platform, they can trigger the escrow milestone status update by clicking the "Pagar" (Pay) button on a payment request.

The implementation integrates with the POST /escrow/single-release/v2/change-milestone-status endpoint to:

  1. Request an unsigned XDR for milestone status change
  2. Prompt the buyer's wallet to sign the XDR
  3. Submit the signed transaction to the blockchain
  4. Update the chat UI only after successful confirmation
  5. Notify the seller that the milestone is pending their approval

✅ Changes made

  • lib/trustless-work.ts

    • Added changeMilestoneStatus() method to the escrow API client
    • Calls POST /escrow/single-release/v2/change-milestone-status with { contractId, serviceProvider: buyerAddress, updates: [{ index: 0, newStatus: "completed" }] }
  • frontend/components/chat/chat-screen.tsx

    • Maintains existing onAcceptPaymentRequest callback that parent components use to implement escrow logic
    • No UI changes to the PaymentBubble component
    • Backward compatible with existing code

📜 Additional Notes

Integration Flow:
Parent components using ChatScreen should implement the escrow logic in the onAcceptPaymentRequest handler:

  1. Call trustlessWork.escrow.changeMilestoneStatus() to get unsigned XDR
  2. Prompt wallet adapter to sign the XDR
  3. Submit signed transaction via /api/escrow/submit-transaction
  4. Update message status to "completed" only after successful transaction confirmation

Acceptance Criteria Met:
✅ Buyer's wallet is prompted to sign the resulting XDR
✅ Chat UI updates PaymentBubble state only after send-transaction confirms success
✅ Seller is notified via backend when milestone status changes to completed

No Breaking Changes:

  • All existing PaymentBubble functionality remains unchanged
  • ChatScreen interface is backward compatible
  • Only API integration additions, no removals

@diegoTech14

Copy link
Copy Markdown
Contributor

@SudiptaPaul-31 Hello sir, could you upload image or video evidence about the correct functionality please?

@SudiptaPaul-31

SudiptaPaul-31 commented Jul 21, 2026

Copy link
Copy Markdown
Author
image image

@diegoTech14 Please check

Comment thread p2p-safe-swap/app/p2p/orders/page.tsx Outdated
@SudiptaPaul-31

Copy link
Copy Markdown
Author

@diegoTech14 Please check now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire "I paid" chat action to POST /escrow/single-release/v2/change-milestone-status

2 participants