Skip to content

SDP 1644 create direct payment #693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from

Conversation

dpohr
Copy link
Collaborator

@dpohr dpohr commented May 30, 2025

What

Implements POST /payments API endpoint for direct payments to existing receivers without creating disbursements. Adds new "DIRECT" payment type with flexible entity reference system (by ID, email, phone, wallet address) and integrates with existing payment processing pipeline.

Why

Enables on-demand, single payments for API integrations that don't fit the batch disbursement workflow. Critical for use cases like instant payments, manual corrections, and external system integrations that need immediate payment capability without disbursement overhead.

Known limitations

  • Existing receivers only - does not create new receivers (by design for this iteration)
  • Contract/Fiat assets - marked as future implementation, returns proper "not supported" errors
  • Legacy auth - still uses token extraction method (TODO: migrate to API keys when available)

Checklist

  • Title follows SDP-1234: Add new feature or Chore: Refactor package xyz format. The Jira ticket code was included if available.
  • PR has a focused scope and doesn't mix features with refactoring
  • Tests are included (if applicable)
  • CHANGELOG.md is updated (if applicable)
  • CONFIG/SECRETS changes are updated in helmcharts and deployments (if applicable)
  • Preview deployment works as expected
  • Ready for production

@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 30, 2025 06:51 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests May 30, 2025 06:51 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests May 30, 2025 06:51 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 30, 2025 06:51 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 30, 2025 07:23 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests May 30, 2025 07:23 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) May 30, 2025 07:52 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests May 30, 2025 07:52 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr mentioned this pull request May 30, 2025
7 tasks
@dpohr dpohr requested a review from marwen-abid June 2, 2025 09:17
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 2, 2025 13:02 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests June 2, 2025 13:02 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 12, 2025 07:05 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests June 12, 2025 07:05 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Anchor Integration Tests June 12, 2025 09:30 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 12, 2025 09:30 — with GitHub Actions Inactive
Copy link

socket-security bot commented Jun 12, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​stellar/​go@​v0.0.0-20250311234916-385ac5aca1a4 ⏵ v0.0.0-20250606230746-ef10cd0a592074 -1100100100100

View full report

@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Anchor Integration Tests June 12, 2025 11:02 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 12, 2025 11:02 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Anchor Integration Tests June 12, 2025 11:08 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 12, 2025 11:08 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr requested review from philipliu and marwen-abid June 12, 2025 11:22
Copy link
Collaborator

@marwen-abid marwen-abid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 When I try to trigger a Direct Payment, I get the following error

time="2025-06-12T20:52:00.315-07:00" level=error msg="Payment e66f5d1a-cd8c-4a3f-a1db-ab3678c130fd is not ready for sending. Error=disbursement  for payment e66f5d1a-cd8c-4a3f-a1db-ab3678c130fd is not in STARTED state" pid=51849

The issue comes from payment_to_submitter_service.go L 178

if p.PaymentType == data.PaymentTypeDisbursement || p.Disbursement != nil {

p.Disbursement here is not nil, there is an empty disbursement object.

r.With(middleware.RequirePermission(
data.WritePayments,
middleware.AnyRoleMiddleware(authManager, data.OwnerUserRole, data.FinancialControllerUserRole, data.BusinessUserRole),
)).Patch("/retry", paymentsHandler.RetryPayments)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 r.Post("/", paymentsHandler.PostPayment) is missing here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Can you also add a test to Test_handleHTTP_authenticatedEndpoints for POST /payments

@dpohr dpohr temporarily deployed to Anchor Integration Tests June 13, 2025 16:27 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 13, 2025 16:27 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@dpohr dpohr temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) June 13, 2025 17:30 — with GitHub Actions Inactive
@dpohr dpohr temporarily deployed to Anchor Integration Tests June 13, 2025 17:30 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

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.

4 participants