Documentation ¶
Index ¶
- Constants
- func Parse(r io.Reader) (interface{}, error)
- type Account
- type AccountNotification
- type ChargeInvoice
- type ChargeInvoiceNotification
- type CreditInvoice
- type CreditInvoiceNotification
- type CreditPayment
- type CreditPaymentNotification
- type ErrUnknownNotification
- type NewDunningEventNotification
- type PaymentNotification
- type SubscriptionNotification
- type Transaction
Constants ¶
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
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
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
const ( NewCreditPayment = "new_credit_payment_notification" VoidedCreditPayment = "voided_credit_payment_notification" )
Credit payment notifications. https://dev.recurly.com/page/webhooks#credit-payment-notifications
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
const ( TransactionFailureTypeDeclined = "declined" TransactionFailureTypeDuplicate = "duplicate_transaction" )
Transaction constants.
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
const (
NewDunningEvent = "new_dunning_event_notification"
)
Dunning event constants.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse parses an incoming webhook and returns the notification. If r implements the io.Closer interface, it will be closed.
NOTE: It is important to validate the source of the webhook before trusting it came from Recurly. Please see Recurly's documentation about the IP addresses to expect and/or setting up HTTP Basic Authentication to verify the request came from Recurly's servers.
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 ¶
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"` TaxInCents int `xml:"tax_in_cents"` DiscountInCents int `xml:"discount_in_cents"` SubtotalInCents int `xml:"subtotal_in_cents"` SubTotalBeforeDiscountInCents int `xml:"subtotal_before_discount_in_cents"` Currency string `xml:"currency"` CreatedAt recurly.NullTime `xml:"created_at"` UpdatedAt recurly.NullTime `xml:"updated_at"` ClosedAt recurly.NullTime `xml:"closed_at"` DueOn recurly.NullTime `xml:"due_on"` NetTerms recurly.NullInt `xml:"net_terms"` CollectionMethod string `xml:"collection_method"` CustomerNotes string `xml:"customer_notes"` TermsAndConditions string `xml:"terms_and_conditions"` }
ChargeInvoice represents the charge invoice object sent in webhooks. https://dev.recurly.com/page/webhooks#section-charge-invoice-schema
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"` VATNumber string `xml:"vat_number"` BalanceInCents int `xml:"balance_in_cents"` TotalInCents int `xml:"total_in_cents"` TaxInCents int `xml:"tax_in_cents"` SubtotalInCents int `xml:"subtotal_in_cents"` SubTotalBeforeDiscountInCents int `xml:"subtotal_before_discount_in_cents"` DiscountInCents int `xml:"discount_in_cents"` Currency string `xml:"currency"` CreatedAt recurly.NullTime `xml:"created_at"` UpdatedAt recurly.NullTime `xml:"updated_at"` ClosedAt recurly.NullTime `xml:"closed_at"` CustomerNotes string `xml:"customer_notes"` }
CreditInvoice represents the credit invoice object sent in webhooks. https://dev.recurly.com/page/webhooks#section-credit-invoice-schema
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 returned 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 NewDunningEventNotification ¶
type NewDunningEventNotification struct { Type string `xml:"-"` Account Account Invoice ChargeInvoice Subscription recurly.Subscription }
NewDunningEventNotification is returned for new dunning events.
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.