financego

package module
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: Apache-2.0 Imports: 14 Imported by: 8

README

financego

This is a Go implementation of an Finance blockchain using the BC data structures.

Build

go build

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PaymentProcessor_name = map[int32]string{
	0: "UNKNOWN_PROCESSOR",
	1: "STRIPE",
}
View Source
var PaymentProcessor_value = map[string]int32{
	"UNKNOWN_PROCESSOR": 0,
	"STRIPE":            1,
}
View Source
var Service_Interval_name = map[int32]string{
	0: "UNKNOWN_INTERVAL",
	1: "DAILY",
	2: "WEEKLY",
	3: "MONTHLY",
	4: "QUARTERLY",
	5: "YEARLY",
}
View Source
var Service_Interval_value = map[string]int32{
	"UNKNOWN_INTERVAL": 0,
	"DAILY":            1,
	"WEEKLY":           2,
	"MONTHLY":          3,
	"QUARTERLY":        4,
	"YEARLY":           5,
}
View Source
var Service_Mode_name = map[int32]string{
	0: "UNKNOWN_MODE",
	1: "FIXED_AMOUNT",
	2: "METERED_SUM_USAGE",
	3: "METERED_MAX_USAGE",
	4: "METERED_LAST_USAGE",
	5: "METERED_LAST_USAGE_EVER",
}
View Source
var Service_Mode_value = map[string]int32{
	"UNKNOWN_MODE":            0,
	"FIXED_AMOUNT":            1,
	"METERED_SUM_USAGE":       2,
	"METERED_MAX_USAGE":       3,
	"METERED_LAST_USAGE":      4,
	"METERED_LAST_USAGE_EVER": 5,
}

Functions

func ConstructEvent

func ConstructEvent(data []byte, signature string) (stripe.Event, error)

func GetChargeAsync

func GetChargeAsync(charges *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey, callback ChargeCallback) error

func GetRegistrationAsync

func GetRegistrationAsync(registrations *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey, callback RegistrationCallback) error

func GetSubscriptionAsync

func GetSubscriptionAsync(subscriptions *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey, productId, planId string, callback SubscriptionCallback) error

func GetUsageRecordAsync

func GetUsageRecordAsync(usages *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey, callback UsageRecordCallback) error

func IntervalToString

func IntervalToString(interval Service_Interval) string

func Register

func Register(merchant *bcgo.Node, processor Processor, aliases, registrations *bcgo.Channel, threshold uint64, listener bcgo.MiningListener) func(string, string, string) (string, *bcgo.Reference, error)

func Subscribe

func Subscribe(merchant *bcgo.Node, processor Processor, aliases, subscriptions *bcgo.Channel, threshold uint64, listener bcgo.MiningListener, productId, planId string) func(string, string) (string, *bcgo.Reference, error)

Types

type Charge

type Charge struct {
	MerchantAlias        string           `protobuf:"bytes,1,opt,name=merchant_alias,json=merchantAlias,proto3" json:"merchant_alias,omitempty"`
	CustomerAlias        string           `protobuf:"bytes,2,opt,name=customer_alias,json=customerAlias,proto3" json:"customer_alias,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	CustomerId           string           `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	PaymentId            string           `protobuf:"bytes,5,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"`
	ChargeId             string           `protobuf:"bytes,6,opt,name=charge_id,json=chargeId,proto3" json:"charge_id,omitempty"`
	Amount               int64            `protobuf:"varint,7,opt,name=amount,proto3" json:"amount,omitempty"`
	InvoiceId            string           `protobuf:"bytes,8,opt,name=invoice_id,json=invoiceId,proto3" json:"invoice_id,omitempty"`
	ReceiptUrl           string           `protobuf:"bytes,9,opt,name=receipt_url,json=receiptUrl,proto3" json:"receipt_url,omitempty"`
	ProductId            string           `protobuf:"bytes,10,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	PlanId               string           `protobuf:"bytes,11,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"`
	Country              string           `protobuf:"bytes,12,opt,name=country,proto3" json:"country,omitempty"`
	Currency             string           `protobuf:"bytes,13,opt,name=currency,proto3" json:"currency,omitempty"`
	Description          string           `protobuf:"bytes,14,opt,name=description,proto3" json:"description,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func GetChargeSync

func GetChargeSync(charges *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey) (*Charge, error)

func (*Charge) Descriptor

func (*Charge) Descriptor() ([]byte, []int)

func (*Charge) GetAmount

func (m *Charge) GetAmount() int64

func (*Charge) GetChargeId

func (m *Charge) GetChargeId() string

func (*Charge) GetCountry

func (m *Charge) GetCountry() string

func (*Charge) GetCurrency

func (m *Charge) GetCurrency() string

func (*Charge) GetCustomerAlias

func (m *Charge) GetCustomerAlias() string

func (*Charge) GetCustomerId

func (m *Charge) GetCustomerId() string

func (*Charge) GetDescription

func (m *Charge) GetDescription() string

func (*Charge) GetInvoiceId

func (m *Charge) GetInvoiceId() string

func (*Charge) GetMerchantAlias

func (m *Charge) GetMerchantAlias() string

func (*Charge) GetPaymentId

func (m *Charge) GetPaymentId() string

func (*Charge) GetPlanId

func (m *Charge) GetPlanId() string

func (*Charge) GetProcessor

func (m *Charge) GetProcessor() PaymentProcessor

func (*Charge) GetProductId

func (m *Charge) GetProductId() string

func (*Charge) GetReceiptUrl

func (m *Charge) GetReceiptUrl() string

func (*Charge) ProtoMessage

func (*Charge) ProtoMessage()

func (*Charge) Reset

func (m *Charge) Reset()

func (*Charge) String

func (m *Charge) String() string

func (*Charge) XXX_DiscardUnknown

func (m *Charge) XXX_DiscardUnknown()

func (*Charge) XXX_Marshal

func (m *Charge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Charge) XXX_Merge

func (m *Charge) XXX_Merge(src proto.Message)

func (*Charge) XXX_Size

func (m *Charge) XXX_Size() int

func (*Charge) XXX_Unmarshal

func (m *Charge) XXX_Unmarshal(b []byte) error

type ChargeCallback

type ChargeCallback func(*bcgo.BlockEntry, *Charge) error

type Invoice

type Invoice struct {
	MerchantAlias        string           `protobuf:"bytes,1,opt,name=merchant_alias,json=merchantAlias,proto3" json:"merchant_alias,omitempty"`
	CustomerAlias        string           `protobuf:"bytes,2,opt,name=customer_alias,json=customerAlias,proto3" json:"customer_alias,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	CustomerId           string           `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	PaymentId            string           `protobuf:"bytes,5,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"`
	InvoiceId            string           `protobuf:"bytes,6,opt,name=invoice_id,json=invoiceId,proto3" json:"invoice_id,omitempty"`
	InvoiceUrl           string           `protobuf:"bytes,7,opt,name=invoice_url,json=invoiceUrl,proto3" json:"invoice_url,omitempty"`
	ProductId            string           `protobuf:"bytes,8,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	PlanId               string           `protobuf:"bytes,9,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"`
	Country              string           `protobuf:"bytes,10,opt,name=country,proto3" json:"country,omitempty"`
	Currency             string           `protobuf:"bytes,11,opt,name=currency,proto3" json:"currency,omitempty"`
	Number               string           `protobuf:"bytes,12,opt,name=number,proto3" json:"number,omitempty"`
	AmountDue            int64            `protobuf:"varint,13,opt,name=amount_due,json=amountDue,proto3" json:"amount_due,omitempty"`
	AmountPaid           int64            `protobuf:"varint,14,opt,name=amount_paid,json=amountPaid,proto3" json:"amount_paid,omitempty"`
	AmountRemaining      int64            `protobuf:"varint,15,opt,name=amount_remaining,json=amountRemaining,proto3" json:"amount_remaining,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*Invoice) Descriptor

func (*Invoice) Descriptor() ([]byte, []int)

func (*Invoice) GetAmountDue

func (m *Invoice) GetAmountDue() int64

func (*Invoice) GetAmountPaid

func (m *Invoice) GetAmountPaid() int64

func (*Invoice) GetAmountRemaining

func (m *Invoice) GetAmountRemaining() int64

func (*Invoice) GetCountry

func (m *Invoice) GetCountry() string

func (*Invoice) GetCurrency

func (m *Invoice) GetCurrency() string

func (*Invoice) GetCustomerAlias

func (m *Invoice) GetCustomerAlias() string

func (*Invoice) GetCustomerId

func (m *Invoice) GetCustomerId() string

func (*Invoice) GetInvoiceId

func (m *Invoice) GetInvoiceId() string

func (*Invoice) GetInvoiceUrl

func (m *Invoice) GetInvoiceUrl() string

func (*Invoice) GetMerchantAlias

func (m *Invoice) GetMerchantAlias() string

func (*Invoice) GetNumber

func (m *Invoice) GetNumber() string

func (*Invoice) GetPaymentId

func (m *Invoice) GetPaymentId() string

func (*Invoice) GetPlanId

func (m *Invoice) GetPlanId() string

func (*Invoice) GetProcessor

func (m *Invoice) GetProcessor() PaymentProcessor

func (*Invoice) GetProductId

func (m *Invoice) GetProductId() string

func (*Invoice) ProtoMessage

func (*Invoice) ProtoMessage()

func (*Invoice) Reset

func (m *Invoice) Reset()

func (*Invoice) String

func (m *Invoice) String() string

func (*Invoice) XXX_DiscardUnknown

func (m *Invoice) XXX_DiscardUnknown()

func (*Invoice) XXX_Marshal

func (m *Invoice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Invoice) XXX_Merge

func (m *Invoice) XXX_Merge(src proto.Message)

func (*Invoice) XXX_Size

func (m *Invoice) XXX_Size() int

func (*Invoice) XXX_Unmarshal

func (m *Invoice) XXX_Unmarshal(b []byte) error

type Merchant

type Merchant struct {
	Alias string `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"`
	// The domain name of the merchant
	// Eg. space.aletheiaware.com
	Domain               string           `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	PublishableKey       string           `protobuf:"bytes,4,opt,name=publishable_key,json=publishableKey,proto3" json:"publishable_key,omitempty"`
	RegisterUrl          string           `protobuf:"bytes,5,opt,name=register_url,json=registerUrl,proto3" json:"register_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*Merchant) Descriptor

func (*Merchant) Descriptor() ([]byte, []int)

func (*Merchant) GetAlias

func (m *Merchant) GetAlias() string

func (*Merchant) GetDomain

func (m *Merchant) GetDomain() string

func (*Merchant) GetProcessor

func (m *Merchant) GetProcessor() PaymentProcessor

func (*Merchant) GetPublishableKey

func (m *Merchant) GetPublishableKey() string

func (*Merchant) GetRegisterUrl

func (m *Merchant) GetRegisterUrl() string

func (*Merchant) ProtoMessage

func (*Merchant) ProtoMessage()

func (*Merchant) Reset

func (m *Merchant) Reset()

func (*Merchant) String

func (m *Merchant) String() string

func (*Merchant) XXX_DiscardUnknown

func (m *Merchant) XXX_DiscardUnknown()

func (*Merchant) XXX_Marshal

func (m *Merchant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Merchant) XXX_Merge

func (m *Merchant) XXX_Merge(src proto.Message)

func (*Merchant) XXX_Size

func (m *Merchant) XXX_Size() int

func (*Merchant) XXX_Unmarshal

func (m *Merchant) XXX_Unmarshal(b []byte) error

type PaymentProcessor

type PaymentProcessor int32
const (
	PaymentProcessor_UNKNOWN_PROCESSOR PaymentProcessor = 0
	PaymentProcessor_STRIPE            PaymentProcessor = 1
)

func (PaymentProcessor) EnumDescriptor

func (PaymentProcessor) EnumDescriptor() ([]byte, []int)

func (PaymentProcessor) String

func (x PaymentProcessor) String() string

type Processor

type Processor interface {
	NewCharge(merchantAlias, customerAlias, paymentId, productId, planId, country, currency string, amount int64, description string) (*Charge, error)
	NewRegistration(merchantAlias, customerAlias, email, paymentId, description string) (*Registration, error)
	NewCustomerCharge(registration *Registration, productId, planId, country, currency string, amount int64, description string) (*Charge, error)
	NewSubscription(merchantAlias, customerAlias, customerId, paymentId, productId, planId string) (*Subscription, error)
	NewUsageRecord(merchantAlias, customerAlias, subscriptionId, subscriptionItemId, productId, planId string, timestamp int64, size int64) (*UsageRecord, error)
}

type Product

type Product struct {
	ProductId            string   `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	Country              string   `protobuf:"bytes,2,opt,name=country,proto3" json:"country,omitempty"`
	Currency             string   `protobuf:"bytes,3,opt,name=currency,proto3" json:"currency,omitempty"`
	UnitPrice            int64    `protobuf:"varint,4,opt,name=unit_price,json=unitPrice,proto3" json:"unit_price,omitempty"`
	PurchaseUrl          string   `protobuf:"bytes,5,opt,name=purchase_url,json=purchaseUrl,proto3" json:"purchase_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Product) Descriptor

func (*Product) Descriptor() ([]byte, []int)

func (*Product) GetCountry

func (m *Product) GetCountry() string

func (*Product) GetCurrency

func (m *Product) GetCurrency() string

func (*Product) GetProductId

func (m *Product) GetProductId() string

func (*Product) GetPurchaseUrl

func (m *Product) GetPurchaseUrl() string

func (*Product) GetUnitPrice

func (m *Product) GetUnitPrice() int64

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) Reset

func (m *Product) Reset()

func (*Product) String

func (m *Product) String() string

func (*Product) XXX_DiscardUnknown

func (m *Product) XXX_DiscardUnknown()

func (*Product) XXX_Marshal

func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Product) XXX_Merge

func (m *Product) XXX_Merge(src proto.Message)

func (*Product) XXX_Size

func (m *Product) XXX_Size() int

func (*Product) XXX_Unmarshal

func (m *Product) XXX_Unmarshal(b []byte) error

type Registration

type Registration struct {
	MerchantAlias        string           `protobuf:"bytes,1,opt,name=merchant_alias,json=merchantAlias,proto3" json:"merchant_alias,omitempty"`
	CustomerAlias        string           `protobuf:"bytes,2,opt,name=customer_alias,json=customerAlias,proto3" json:"customer_alias,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	CustomerId           string           `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	PaymentId            string           `protobuf:"bytes,5,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func GetRegistrationSync

func GetRegistrationSync(registrations *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey) (*Registration, error)

func (*Registration) Descriptor

func (*Registration) Descriptor() ([]byte, []int)

func (*Registration) GetCustomerAlias

func (m *Registration) GetCustomerAlias() string

func (*Registration) GetCustomerId

func (m *Registration) GetCustomerId() string

func (*Registration) GetMerchantAlias

func (m *Registration) GetMerchantAlias() string

func (*Registration) GetPaymentId

func (m *Registration) GetPaymentId() string

func (*Registration) GetProcessor

func (m *Registration) GetProcessor() PaymentProcessor

func (*Registration) ProtoMessage

func (*Registration) ProtoMessage()

func (*Registration) Reset

func (m *Registration) Reset()

func (*Registration) String

func (m *Registration) String() string

func (*Registration) XXX_DiscardUnknown

func (m *Registration) XXX_DiscardUnknown()

func (*Registration) XXX_Marshal

func (m *Registration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Registration) XXX_Merge

func (m *Registration) XXX_Merge(src proto.Message)

func (*Registration) XXX_Size

func (m *Registration) XXX_Size() int

func (*Registration) XXX_Unmarshal

func (m *Registration) XXX_Unmarshal(b []byte) error

type RegistrationCallback

type RegistrationCallback func(*bcgo.BlockEntry, *Registration) error

type Service

type Service struct {
	ProductId            string           `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	PlanId               string           `protobuf:"bytes,2,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"`
	Country              string           `protobuf:"bytes,3,opt,name=country,proto3" json:"country,omitempty"`
	Currency             string           `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"`
	GroupPrice           int64            `protobuf:"varint,5,opt,name=group_price,json=groupPrice,proto3" json:"group_price,omitempty"`
	GroupSize            int64            `protobuf:"varint,6,opt,name=group_size,json=groupSize,proto3" json:"group_size,omitempty"`
	Interval             Service_Interval `protobuf:"varint,7,opt,name=interval,proto3,enum=finance.Service_Interval" json:"interval,omitempty"`
	Mode                 Service_Mode     `protobuf:"varint,8,opt,name=mode,proto3,enum=finance.Service_Mode" json:"mode,omitempty"`
	SubscribeUrl         string           `protobuf:"bytes,9,opt,name=subscribe_url,json=subscribeUrl,proto3" json:"subscribe_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*Service) Descriptor

func (*Service) Descriptor() ([]byte, []int)

func (*Service) GetCountry

func (m *Service) GetCountry() string

func (*Service) GetCurrency

func (m *Service) GetCurrency() string

func (*Service) GetGroupPrice

func (m *Service) GetGroupPrice() int64

func (*Service) GetGroupSize

func (m *Service) GetGroupSize() int64

func (*Service) GetInterval

func (m *Service) GetInterval() Service_Interval

func (*Service) GetMode

func (m *Service) GetMode() Service_Mode

func (*Service) GetPlanId

func (m *Service) GetPlanId() string

func (*Service) GetProductId

func (m *Service) GetProductId() string

func (*Service) GetSubscribeUrl

func (m *Service) GetSubscribeUrl() string

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) Reset

func (m *Service) Reset()

func (*Service) String

func (m *Service) String() string

func (*Service) XXX_DiscardUnknown

func (m *Service) XXX_DiscardUnknown()

func (*Service) XXX_Marshal

func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service) XXX_Merge

func (m *Service) XXX_Merge(src proto.Message)

func (*Service) XXX_Size

func (m *Service) XXX_Size() int

func (*Service) XXX_Unmarshal

func (m *Service) XXX_Unmarshal(b []byte) error

type Service_Interval

type Service_Interval int32
const (
	Service_UNKNOWN_INTERVAL Service_Interval = 0
	Service_DAILY            Service_Interval = 1
	Service_WEEKLY           Service_Interval = 2
	Service_MONTHLY          Service_Interval = 3
	Service_QUARTERLY        Service_Interval = 4
	Service_YEARLY           Service_Interval = 5
)

func (Service_Interval) EnumDescriptor

func (Service_Interval) EnumDescriptor() ([]byte, []int)

func (Service_Interval) String

func (x Service_Interval) String() string

type Service_Mode

type Service_Mode int32
const (
	Service_UNKNOWN_MODE            Service_Mode = 0
	Service_FIXED_AMOUNT            Service_Mode = 1
	Service_METERED_SUM_USAGE       Service_Mode = 2
	Service_METERED_MAX_USAGE       Service_Mode = 3
	Service_METERED_LAST_USAGE      Service_Mode = 4
	Service_METERED_LAST_USAGE_EVER Service_Mode = 5
)

func (Service_Mode) EnumDescriptor

func (Service_Mode) EnumDescriptor() ([]byte, []int)

func (Service_Mode) String

func (x Service_Mode) String() string

type Stripe

type Stripe struct {
}

func (*Stripe) NewCharge

func (p *Stripe) NewCharge(merchantAlias, customerAlias, paymentId, productId, planId, country, currency string, amount int64, description string) (*Charge, error)

func (*Stripe) NewCustomerCharge

func (p *Stripe) NewCustomerCharge(registration *Registration, productId, planId, country, currency string, amount int64, description string) (*Charge, error)

func (*Stripe) NewRegistration

func (p *Stripe) NewRegistration(merchantAlias, customerAlias, email, paymentId, description string) (*Registration, error)

func (*Stripe) NewSubscription

func (p *Stripe) NewSubscription(merchantAlias, customerAlias, customerId, paymentId, productId, planId string) (*Subscription, error)

func (*Stripe) NewUsageRecord

func (p *Stripe) NewUsageRecord(merchantAlias, customerAlias, subscriptionId, subscriptionItemId, productId, planId string, timestamp int64, size int64) (*UsageRecord, error)

type Subscription

type Subscription struct {
	MerchantAlias        string           `protobuf:"bytes,1,opt,name=merchant_alias,json=merchantAlias,proto3" json:"merchant_alias,omitempty"`
	CustomerAlias        string           `protobuf:"bytes,2,opt,name=customer_alias,json=customerAlias,proto3" json:"customer_alias,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	CustomerId           string           `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	PaymentId            string           `protobuf:"bytes,5,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"`
	ProductId            string           `protobuf:"bytes,6,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	PlanId               string           `protobuf:"bytes,7,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"`
	SubscriptionId       string           `protobuf:"bytes,8,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"`
	SubscriptionItemId   string           `protobuf:"bytes,9,opt,name=subscription_item_id,json=subscriptionItemId,proto3" json:"subscription_item_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func GetSubscriptionSync

func GetSubscriptionSync(subscriptions *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey, productId, planId string) (*Subscription, error)

func (*Subscription) Descriptor

func (*Subscription) Descriptor() ([]byte, []int)

func (*Subscription) GetCustomerAlias

func (m *Subscription) GetCustomerAlias() string

func (*Subscription) GetCustomerId

func (m *Subscription) GetCustomerId() string

func (*Subscription) GetMerchantAlias

func (m *Subscription) GetMerchantAlias() string

func (*Subscription) GetPaymentId

func (m *Subscription) GetPaymentId() string

func (*Subscription) GetPlanId

func (m *Subscription) GetPlanId() string

func (*Subscription) GetProcessor

func (m *Subscription) GetProcessor() PaymentProcessor

func (*Subscription) GetProductId

func (m *Subscription) GetProductId() string

func (*Subscription) GetSubscriptionId

func (m *Subscription) GetSubscriptionId() string

func (*Subscription) GetSubscriptionItemId

func (m *Subscription) GetSubscriptionItemId() string

func (*Subscription) ProtoMessage

func (*Subscription) ProtoMessage()

func (*Subscription) Reset

func (m *Subscription) Reset()

func (*Subscription) String

func (m *Subscription) String() string

func (*Subscription) XXX_DiscardUnknown

func (m *Subscription) XXX_DiscardUnknown()

func (*Subscription) XXX_Marshal

func (m *Subscription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Subscription) XXX_Merge

func (m *Subscription) XXX_Merge(src proto.Message)

func (*Subscription) XXX_Size

func (m *Subscription) XXX_Size() int

func (*Subscription) XXX_Unmarshal

func (m *Subscription) XXX_Unmarshal(b []byte) error

type SubscriptionCallback

type SubscriptionCallback func(*bcgo.BlockEntry, *Subscription) error

type UsageRecord

type UsageRecord struct {
	MerchantAlias        string           `protobuf:"bytes,1,opt,name=merchant_alias,json=merchantAlias,proto3" json:"merchant_alias,omitempty"`
	CustomerAlias        string           `protobuf:"bytes,2,opt,name=customer_alias,json=customerAlias,proto3" json:"customer_alias,omitempty"`
	Processor            PaymentProcessor `protobuf:"varint,3,opt,name=processor,proto3,enum=finance.PaymentProcessor" json:"processor,omitempty"`
	SubscriptionId       string           `protobuf:"bytes,4,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"`
	UsageRecordId        string           `protobuf:"bytes,5,opt,name=usage_record_id,json=usageRecordId,proto3" json:"usage_record_id,omitempty"`
	Quantity             int64            `protobuf:"varint,6,opt,name=quantity,proto3" json:"quantity,omitempty"`
	SubscriptionItemId   string           `protobuf:"bytes,7,opt,name=subscription_item_id,json=subscriptionItemId,proto3" json:"subscription_item_id,omitempty"`
	ProductId            string           `protobuf:"bytes,8,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	PlanId               string           `protobuf:"bytes,9,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func GetUsageRecordSync

func GetUsageRecordSync(usages *bcgo.Channel, cache bcgo.Cache, network bcgo.Network, merchantAlias string, merchantKey *rsa.PrivateKey, customerAlias string, customerKey *rsa.PrivateKey) (*UsageRecord, error)

func (*UsageRecord) Descriptor

func (*UsageRecord) Descriptor() ([]byte, []int)

func (*UsageRecord) GetCustomerAlias

func (m *UsageRecord) GetCustomerAlias() string

func (*UsageRecord) GetMerchantAlias

func (m *UsageRecord) GetMerchantAlias() string

func (*UsageRecord) GetPlanId

func (m *UsageRecord) GetPlanId() string

func (*UsageRecord) GetProcessor

func (m *UsageRecord) GetProcessor() PaymentProcessor

func (*UsageRecord) GetProductId

func (m *UsageRecord) GetProductId() string

func (*UsageRecord) GetQuantity

func (m *UsageRecord) GetQuantity() int64

func (*UsageRecord) GetSubscriptionId

func (m *UsageRecord) GetSubscriptionId() string

func (*UsageRecord) GetSubscriptionItemId

func (m *UsageRecord) GetSubscriptionItemId() string

func (*UsageRecord) GetUsageRecordId

func (m *UsageRecord) GetUsageRecordId() string

func (*UsageRecord) ProtoMessage

func (*UsageRecord) ProtoMessage()

func (*UsageRecord) Reset

func (m *UsageRecord) Reset()

func (*UsageRecord) String

func (m *UsageRecord) String() string

func (*UsageRecord) XXX_DiscardUnknown

func (m *UsageRecord) XXX_DiscardUnknown()

func (*UsageRecord) XXX_Marshal

func (m *UsageRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UsageRecord) XXX_Merge

func (m *UsageRecord) XXX_Merge(src proto.Message)

func (*UsageRecord) XXX_Size

func (m *UsageRecord) XXX_Size() int

func (*UsageRecord) XXX_Unmarshal

func (m *UsageRecord) XXX_Unmarshal(b []byte) error

type UsageRecordCallback

type UsageRecordCallback func(*bcgo.BlockEntry, *UsageRecord) error

Jump to

Keyboard shortcuts

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