webhooks

package
v0.0.0-...-bd1588a Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewAccount              = "new_account_notification"
	UpdatedAccount          = "updated_account_notification"
	CanceledAccount         = "canceled_account_notification"
	BillingInfoUpdated      = "billing_info_updated_notification"
	BillingInfoUpdateFailed = "billing_info_update_failed_notification"
)

Account notifications. https://dev.recurly.com/page/webhooks#account-notifications

View Source
const (
	NewChargeInvoice        = "new_charge_invoice_notification"
	ProcessingChargeInvoice = "processing_charge_invoice_notification"
	PastDueChargeInvoice    = "past_due_charge_invoice_notification"
	PaidChargeInvoice       = "paid_charge_invoice_notification"
	FailedChargeInvoice     = "failed_charge_invoice_notification"
	ReopenedChargeInvoice   = "reopened_charge_invoice_notification"
)

Charge invoice notifications. https://dev.recurly.com/page/webhooks#charge-invoice-notifications

View Source
const (
	NewCreditInvoice        = "new_credit_invoice_notification"
	ProcessingCreditInvoice = "processing_credit_invoice_notification"
	ClosedCreditInvoice     = "closed_credit_invoice_notification"
	VoidedCreditInvoice     = "voided_credit_invoice_notification"
	ReopenedCreditInvoice   = "reopened_credit_invoice_notification"
	OpenCreditInvoice       = "open_credit_invoice_notification"
)

Credit invoice notifications. https://dev.recurly.com/page/webhooks#charge-invoice-notifications

View Source
const (
	NewCreditPayment    = "new_credit_payment_notification"
	VoidedCreditPayment = "voided_credit_payment_notification"
)

Credit payment notifications. https://dev.recurly.com/page/webhooks#credit-payment-notifications

View Source
const (
	NewInvoice        = "new_invoice_notification"
	PastDueInvoice    = "past_due_invoice_notification"
	ProcessingInvoice = "processing_invoice_notification"
	ClosedInvoice     = "closed_invoice_notification"
)

Invoice notifications. Will be deprecated after credit invoices feature is turned on. https://dev.recurly.com/page/webhooks#invoice-notifications

View Source
const (
	SuccessfulPayment = "successful_payment_notification"
	FailedPayment     = "failed_payment_notification"
	VoidPayment       = "void_payment_notification"
	SuccessfulRefund  = "successful_refund_notification"
	ScheduledPayment  = "scheduled_payment_notification"
	ProcessingPayment = "processing_payment_notification"
)

Payment notifications. https://dev.recurly.com/page/webhooks#payment-notifications

View Source
const (
	TransactionFailureTypeDeclined  = "declined"
	TransactionFailureTypeDuplicate = "duplicate_transaction"
)

Transaction constants.

View Source
const (
	NewSubscription            = "new_subscription_notification"
	UpdatedSubscription        = "updated_subscription_notification"
	RenewedSubscription        = "renewed_subscription_notification"
	ExpiredSubscription        = "expired_subscription_notification"
	CanceledSubscription       = "canceled_subscription_notification"
	PausedSubscription         = "subscription_paused_notification"
	ResumedSubscription        = "subscription_resumed_notification"
	ScheduledPauseSubscription = "scheduled_subscription_pause_notification"
	ModifiedPauseSubscription  = "subscription_pause_modified_notification"
	PausedRenewalSubscription  = "paused_subscription_renewal_notification"
	PauseCanceledSubscription  = "subscription_pause_canceled_notification"
	ReactivatedAccount         = "reactivated_account_notification"
)

Subscription notifications. https://dev.recurly.com/page/webhooks#subscription-notifications

View Source
const (
	NewDunningEvent = "new_dunning_event_notification"
)

Variables

This section is empty.

Functions

func Parse

func Parse(r io.Reader) (interface{}, error)

Parse parses an incoming webhook and returns the notification.

func ParseDeprecated

func ParseDeprecated(r io.Reader) (interface{}, error)

ParseDeprecated parses an incoming webhook and returns the notification for previous webhook notifications. Will be deprecated after credit invoices feature is turned on.

Types

type Account

type Account struct {
	XMLName     xml.Name `xml:"account"`
	Code        string   `xml:"account_code"`
	Username    string   `xml:"username"`
	Email       string   `xml:"email"`
	FirstName   string   `xml:"first_name"`
	LastName    string   `xml:"last_name"`
	CompanyName string   `xml:"company_name"`
	Phone       string   `xml:"phone"`
}

Account represents the account object sent in webhooks.

type AccountNotification

type AccountNotification struct {
	Type    string  `xml:"-"`
	Account Account `xml:"account"`
}

AccountNotification is returned for all account notifications.

type ChargeInvoice

type ChargeInvoice struct {
	XMLName             xml.Name         `xml:"invoice"`
	SubscriptionUUIDs   []string         `xml:"subscription_ids>subscription_id"`
	UUID                string           `xml:"uuid"`
	State               string           `xml:"state"`
	Origin              string           `xml:"origin"`
	InvoiceNumberPrefix string           `xml:"invoice_number_prefix"`
	InvoiceNumber       int              `xml:"invoice_number"`
	PONumber            string           `xml:"po_number"`
	VATNumber           string           `xml:"vat_number"`
	BalanceInCents      int              `xml:"balance_in_cents"`
	TotalInCents        int              `xml:"total_in_cents"`
	Currency            string           `xml:"currency"`
	CreatedAt           recurly.NullTime `xml:"created_at"`
	ClosedAt            recurly.NullTime `xml:"closed_at"`
	NetTerms            recurly.NullInt  `xml:"net_terms"`
	CollectionMethod    string           `xml:"collection_method"`
}

ChargeInvoice represents the charge invoice object sent in webhooks.

type ChargeInvoiceNotification

type ChargeInvoiceNotification struct {
	Type    string        `xml:"-"`
	Account Account       `xml:"account"`
	Invoice ChargeInvoice `xml:"invoice"`
}

ChargeInvoiceNotification is returned for all charge invoice notifications.

type CreditInvoice

type CreditInvoice struct {
	XMLName             xml.Name         `xml:"invoice"`
	SubscriptionUUIDs   []string         `xml:"subscription_ids>subscription_id"`
	UUID                string           `xml:"uuid"`
	State               string           `xml:"state"`
	Origin              string           `xml:"origin"`
	InvoiceNumberPrefix string           `xml:"invoice_number_prefix"`
	InvoiceNumber       int              `xml:"invoice_number"`
	BalanceInCents      int              `xml:"balance_in_cents"`
	TotalInCents        int              `xml:"total_in_cents"`
	Currency            string           `xml:"currency"`
	CreatedAt           recurly.NullTime `xml:"created_at"`
	ClosedAt            recurly.NullTime `xml:"closed_at"`
}

CreditInvoice represents the credit invoice object sent in webhooks.

type CreditInvoiceNotification

type CreditInvoiceNotification struct {
	Type    string        `xml:"-"`
	Account Account       `xml:"account"`
	Invoice CreditInvoice `xml:"invoice"`
}

CreditInvoiceNotification is returned for all credit invoice notifications.

type CreditPayment

type CreditPayment struct {
	XMLName                   xml.Name         `xml:"credit_payment"`
	UUID                      string           `xml:"uuid"`
	Action                    string           `xml:"action"`
	AmountInCents             int              `xml:"amount_in_cents"`
	OriginalInvoiceNumber     int              `xml:"original_invoice_number"`
	AppliedToInvoiceNumber    int              `xml:"applied_to_invoice_number"`
	OriginalCreditPaymentUUID string           `xml:"original_credit_payment_uuid"`
	RefundTransactionUUID     string           `xml:"refund_transaction_uuid"`
	CreatedAt                 recurly.NullTime `xml:"created_at"`
	VoidedAt                  recurly.NullTime `xml:"voided_at"`
}

CreditPayment represents the credit payment object sent in webhooks.

type CreditPaymentNotification

type CreditPaymentNotification struct {
	Type          string        `xml:"-"`
	Account       Account       `xml:"account"`
	CreditPayment CreditPayment `xml:"credit_payment"`
}

CreditPaymentNotification is returned for all credit payment notifications.

type ErrUnknownNotification

type ErrUnknownNotification struct {
	// contains filtered or unexported fields
}

ErrUnknownNotification is used when the incoming webhook does not match a predefined notification type. It implements the error interface.

func (ErrUnknownNotification) Error

func (e ErrUnknownNotification) Error() string

Error implements the error interface.

func (ErrUnknownNotification) Name

func (e ErrUnknownNotification) Name() string

Name returns the name of the unknown notification.

type Invoice

type Invoice struct {
	XMLName             xml.Name         `xml:"invoice"`
	SubscriptionUUID    string           `xml:"subscription_id"`
	UUID                string           `xml:"uuid"`
	State               string           `xml:"state"`
	InvoiceNumberPrefix string           `xml:"invoice_number_prefix"`
	InvoiceNumber       int              `xml:"invoice_number"`
	PONumber            string           `xml:"po_number"`
	VATNumber           string           `xml:"vat_number"`
	TotalInCents        int              `xml:"total_in_cents"`
	Currency            string           `xml:"currency"`
	CreatedAt           recurly.NullTime `xml:"date"`
	ClosedAt            recurly.NullTime `xml:"closed_at"`
	NetTerms            recurly.NullInt  `xml:"net_terms"`
	CollectionMethod    string           `xml:"collection_method"`
}

Invoice represents the invoice object sent in webhooks. After credit invoices have been turned on, these notifications will only be sent for TypeLegacy invoices (posted before the feature was turned on) then deprecated.

type InvoiceNotification

type InvoiceNotification struct {
	Type    string  `xml:"-"`
	Account Account `xml:"account"`
	Invoice Invoice `xml:"invoice"`
}

InvoiceNotification is returned for all invoice notifications.

type NewDunningEventDeprecatedNotification

type NewDunningEventDeprecatedNotification struct {
	Type         string `xml:"-"`
	Account      Account
	Invoice      Invoice
	Subscription recurly.Subscription
}

type NewDunningEventNotification

type NewDunningEventNotification struct {
	Type         string `xml:"-"`
	Account      Account
	Invoice      ChargeInvoice
	Subscription recurly.Subscription
}

type PaymentNotification

type PaymentNotification struct {
	Type        string      `xml:"-"`
	Account     Account     `xml:"account"`
	Transaction Transaction `xml:"transaction"`
}

PaymentNotification is returned for all credit payment notifications.

type SubscriptionNotification

type SubscriptionNotification struct {
	Type         string               `xml:"-"`
	Account      Account              `xml:"account"`
	Subscription recurly.Subscription `xml:"subscription"`
}

SubscriptionNotification is returned for all subscription notifications.

type Transaction

type Transaction struct {
	XMLName           xml.Name         `xml:"transaction"`
	UUID              string           `xml:"id"`
	InvoiceNumber     int              `xml:"invoice_number"`
	SubscriptionUUID  string           `xml:"subscription_id"`
	Action            string           `xml:"action"`
	PaymentMethod     string           `xml:"payment_method"`
	AmountInCents     int              `xml:"amount_in_cents"`
	Status            string           `xml:"status"`
	Message           string           `xml:"message"`
	GatewayErrorCodes string           `xml:"gateway_error_codes"`
	FailureType       string           `xml:"failure_type"`
	Reference         string           `xml:"reference"`
	Source            string           `xml:"source"`
	Test              recurly.NullBool `xml:"test"`
	Voidable          recurly.NullBool `xml:"voidable"`
	Refundable        recurly.NullBool `xml:"refundable"`
}

Transaction represents the transaction object sent in webhooks.

Jump to

Keyboard shortcuts

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