Skip to content

Commit

Permalink
feat: Return payments configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
x1m3 committed Dec 18, 2024
1 parent f5bb512 commit 97ea05d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
13 changes: 10 additions & 3 deletions api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1503,9 +1503,9 @@ paths:

/v2/payment/settings:
get:
summary: Return payment settings
summary: Payments Configuration
operationId: GetPaymentSettings
description: Get the payment settings
description: Returns the server payments configuration
tags:
- Payment
security:
Expand All @@ -1516,7 +1516,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentOptionConfig'
$ref: '#/components/schemas/PaymentsConfiguration'

/v2/identities/{identifier}/payment/options:
get:
Expand Down Expand Up @@ -2391,6 +2391,13 @@ components:
type: string
enum: [ success, failed, pending, canceled ]

PaymentsConfiguration:
type: object
x-go-type: payments.Config
x-go-type-import:
name: payments
path: github.com/polygonid/sh-id-platform/internal/payments

PaymentOption:
type: object
required:
Expand Down
12 changes: 8 additions & 4 deletions internal/api/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions internal/api/payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ func (s *Server) CreatePaymentRequest(ctx context.Context, request CreatePayment

// GetPaymentSettings is the controller to get payment settings
func (s *Server) GetPaymentSettings(_ context.Context, _ GetPaymentSettingsRequestObject) (GetPaymentSettingsResponseObject, error) {
// TODO: Implement
// return GetPaymentSettings200JSONResponse(s.paymentService.GetSettings()), nil
return GetPaymentSettings200JSONResponse{}, nil
return GetPaymentSettings200JSONResponse(s.paymentService.GetSettings()), nil
}

// VerifyPayment is the controller to verify payment
Expand Down
2 changes: 1 addition & 1 deletion internal/payments/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type PaymentOptionConfig struct {
Name string
Type protocol.PaymentRequestType
ContractAddress common.Address
Features []protocol.PaymentFeatures
Features []protocol.PaymentFeatures `json:"features,omitempty"`
}

// configDTO is the data transfer object for the configuration. It maps to payment configuration file
Expand Down

0 comments on commit 97ea05d

Please sign in to comment.