Skip to content
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

add payment request/response #48

Merged
merged 2 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions protocol/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ const (
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
CredentialProposalTypeWeb = "WebVerificationFormV1.0"

// CredentialPaymentRequestMessageType is type for request of the credential payment request
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
CredentialPaymentRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/0.1/payment-request"

// CredentialPaymentMessageType is type for request of the credential payment
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
CredentialPaymentMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "credentials/0.1/payment"
)

// CredentialIssuanceRequestMessage represent Iden3message for credential request
Expand Down Expand Up @@ -304,3 +318,89 @@ type CredentialProposalInfo struct {
Expiration string `json:"expiration,omitempty"`
Description string `json:"description,omitempty"`
}

// CredentialPaymentRequestMessage represent Iden3message for credential payment request
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentRequestMessage struct {
ID string `json:"id"`
Typ iden3comm.MediaType `json:"typ,omitempty"`
Type iden3comm.ProtocolMessage `json:"type"`
ThreadID string `json:"thid,omitempty"`

Body CredentialPaymentRequestBody `json:"body,omitempty"`

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}

// CredentialPaymentRequestBody is msg body for payment requests
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentRequestBody struct {
Agent string `json:"agent"`
Payments []CredentialPaymentInfo `json:"payments"`
}

// CredentialPaymentInfo is msg for payment information
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentInfo struct {
Credentials []CredentialInfo `json:"credentials"`
Type string `json:"type"`
Data CredentialPaymentData `json:"data"`
Expiration int64 `json:"expiration,omitempty"`
Description string `json:"description,omitempty"`
}

// CredentialPaymentData is msg for payment data
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentData struct {
ID string `json:"id"`
Type string `json:"type"`
Amount string `json:"amount"`
vmidyllic marked this conversation as resolved.
Show resolved Hide resolved
ChainID string `json:"chainId"`
Address string `json:"address"`
Signature string `json:"signature,omitempty"`
}

// CredentialPaymentMessage represent Iden3message for credential payment
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentMessage struct {
ID string `json:"id"`
Typ iden3comm.MediaType `json:"typ,omitempty"`
Type iden3comm.ProtocolMessage `json:"type"`
ThreadID string `json:"thid,omitempty"`

Body CredentialPaymentBody `json:"body,omitempty"`

From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}

// CredentialPaymentBody is msg body for payment
//
// # Experimental
//
// Notice: this functionality is in beta and can be deleted or be non-backward compatible in the future releases.
type CredentialPaymentBody struct {
Payments []struct {
ID string `json:"id"`
Type string `json:"type"`
PaymentData struct {
TxID string `json:"txId"`
} `json:"paymentData"`
} `json:"payments"`
}
Loading