funding

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AttrFundingLabel is the funding agreement label
	AttrFundingLabel = "funding_agreement"
)
View Source
const (
	// BootstrappedFundingService is the key for Funding service in Context.
	BootstrappedFundingService = "Funding Service"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper struct{}

Bootstrapper implements Bootstrapper Interface

func (Bootstrapper) Bootstrap

func (Bootstrapper) Bootstrap(ctx map[string]interface{}) (err error)

Bootstrap adds the funding API handler to the context.

type Data

type Data struct {
	AgreementID           string `json:"agreement_id,omitempty" attr:"bytes"`
	BorrowerID            string `json:"borrower_id,omitempty" attr:"bytes"`
	FunderID              string `json:"funder_id,omitempty" attr:"bytes"`
	Amount                string `json:"amount,omitempty" attr:"decimal"`
	Apr                   string `json:"apr,omitempty" attr:"string"`
	Days                  string `json:"days,omitempty" attr:"integer"`
	Fee                   string `json:"fee,omitempty" attr:"decimal"`
	RepaymentDueDate      string `json:"repayment_due_date,omitempty" attr:"timestamp"`
	RepaymentOccurredDate string `json:"repayment_occurred_date,omitempty" attr:"timestamp"`
	RepaymentAmount       string `json:"repayment_amount,omitempty" attr:"decimal"`
	Currency              string `json:"currency,omitempty" attr:"string"`
	NFTAddress            string `json:"nft_address,omitempty" attr:"bytes"`
	PaymentDetailsID      string `json:"payment_details_id,omitempty" attr:"bytes"`
}

Data is the default funding extension schema.

type Service

type Service interface {
	// Sign adds a signature to an existing document
	Sign(ctx context.Context, fundingID string, identifier []byte) (documents.Model, error)

	// CreateFundingAgreement creates a new funding agreement and anchors the document.
	CreateFundingAgreement(ctx context.Context, docID []byte, data *Data) (documents.Model, jobs.JobID, error)

	// UpdateFundingAgreement updates a given funding agreement with the data passed.
	UpdateFundingAgreement(ctx context.Context, docID, fundingID []byte, data *Data) (documents.Model, jobs.JobID, error)

	// GetDataAndSignatures return the funding Data and Signatures associated with the FundingID or funding index.
	GetDataAndSignatures(ctx context.Context, model documents.Model, fundingID string, idx string) (Data, []Signature, error)

	// SignFundingAgreement adds the signature to the given funding agreement.
	SignFundingAgreement(ctx context.Context, docID, fundingID []byte) (documents.Model, jobs.JobID, error)
}

Service defines specific functions for extension funding

func DefaultService

func DefaultService(
	srv documents.Service,
	tokenRegistry documents.TokenRegistry,
) Service

DefaultService returns the default implementation of the service.

type Signature

type Signature struct {
	Valid             string `json:"valid"`
	OutdatedSignature string `json:"outdated_signature"`
	Identity          string `json:"identity"`
	SignedVersion     string `json:"signed_version"`
}

Signature is the funding agreement Signature.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL