Skip to content

Commit

Permalink
Changes to payment msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhniuk committed Jan 24, 2025
1 parent 7f9e254 commit e508569
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions protocol/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package protocol

import (
"fmt"

"github.com/iden3/iden3comm/v2"
)

// GoalCode represents the goal code of targeted protocol message
type GoalCode string

const (
// ProposalRequest is the goal code for proposal request
ProposalRequest GoalCode = "iden3comm.credentials.v1-1.proposal-request"
)

// GetProtocolMessageTypeByGoalCode returns the protocol message type by goal code
func GetProtocolMessageTypeByGoalCode(goalCode GoalCode) (iden3comm.ProtocolMessage, error) {
switch goalCode {
case ProposalRequest:
return CredentialProposalRequestMessageType, nil
default:
return "", fmt.Errorf("unknown goal code %s", goalCode)
}
}
2 changes: 1 addition & 1 deletion protocol/transparent_payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type TransparentPaymentInstructionMessage struct {

// TransparentPaymentInstructionMessageBody represents the body of the transparent payment instruction message
type TransparentPaymentInstructionMessageBody struct {
GoalCode string `json:"goal_code"`
GoalCode GoalCode `json:"goal_code"`
DID string `json:"did,omitempty"`
Credentials []CredentialSchemaInfo `json:"credentials"`
PaymentData TransparentPaymentData `json:"paymentData"`
Expand Down

0 comments on commit e508569

Please sign in to comment.