-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
731eb61
commit cffc983
Showing
17 changed files
with
596 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package webhooks | ||
|
||
import "encoding/xml" | ||
|
||
// Account notifications. | ||
// https://dev.recurly.com/page/webhooks#account-notifications | ||
const ( | ||
BillingInfoUpdated = "billing_info_updated_notification" | ||
) | ||
|
||
// AccountNotification is returned for all account notifications. | ||
type AccountNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
} | ||
|
||
// Account represents the account object sent in webhooks. | ||
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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package webhooks | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/blacklightcms/recurly" | ||
) | ||
|
||
// Charge invoice notifications. | ||
// https://dev.recurly.com/page/webhooks#charge-invoice-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" | ||
) | ||
|
||
// ChargeInvoiceNotification is returned for all charge invoice notifications. | ||
type ChargeInvoiceNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
Invoice ChargeInvoice `xml:"invoice"` | ||
} | ||
|
||
// ChargeInvoice represents the charge invoice object sent in webhooks. | ||
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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package webhooks | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/blacklightcms/recurly" | ||
) | ||
|
||
// Credit 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" | ||
) | ||
|
||
// CreditInvoiceNotification is returned for all credit invoice notifications. | ||
type CreditInvoiceNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
Invoice CreditInvoice `xml:"invoice"` | ||
} | ||
|
||
// CreditInvoice represents the credit invoice object sent in webhooks. | ||
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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package webhooks | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/blacklightcms/recurly" | ||
) | ||
|
||
// Credit payment notifications. | ||
// https://dev.recurly.com/page/webhooks#credit-payment-notifications | ||
const ( | ||
NewCreditPayment = "new_credit_payment_notification" | ||
VoidedCreditPayment = "voided_credit_payment_notification" | ||
) | ||
|
||
// CreditPaymentNotification is returned for all credit payment notifications. | ||
type CreditPaymentNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
CreditPayment CreditPayment `xml:"credit_payment"` | ||
} | ||
|
||
// CreditPayment represents the credit payment object sent in webhooks. | ||
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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package webhooks | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/blacklightcms/recurly" | ||
) | ||
|
||
// Invoice notifications. | ||
// Will be deprecated after credit invoices feature is turned on. | ||
// https://dev.recurly.com/page/webhooks#invoice-notifications | ||
const ( | ||
NewInvoice = "new_invoice_notification" | ||
PastDueInvoice = "past_due_invoice_notification" | ||
) | ||
|
||
// InvoiceNotification is returned for all invoice notifications. | ||
type InvoiceNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
Invoice Invoice `xml:"invoice"` | ||
} | ||
|
||
// 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 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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package webhooks | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/blacklightcms/recurly" | ||
) | ||
|
||
// Payment notifications. | ||
// https://dev.recurly.com/page/webhooks#payment-notifications | ||
const ( | ||
SuccessfulPayment = "successful_payment_notification" | ||
FailedPayment = "failed_payment_notification" | ||
VoidPayment = "void_payment_notification" | ||
SuccessfulRefund = "successful_refund_notification" | ||
) | ||
|
||
// PaymentNotification is returned for all credit payment notifications. | ||
type PaymentNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
Transaction Transaction `xml:"transaction"` | ||
} | ||
|
||
// Transaction represents the transaction object sent in webhooks. | ||
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"` | ||
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 constants. | ||
const ( | ||
TransactionFailureTypeDeclined = "declined" | ||
TransactionFailureTypeDuplicate = "duplicate_transaction" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package webhooks | ||
|
||
import "github.com/blacklightcms/recurly" | ||
|
||
// Subscription notifications. | ||
// https://dev.recurly.com/page/webhooks#subscription-notifications | ||
const ( | ||
NewSubscription = "new_subscription_notification" | ||
UpdatedSubscription = "updated_subscription_notification" | ||
RenewedSubscription = "renewed_subscription_notification" | ||
ExpiredSubscription = "expired_subscription_notification" | ||
CanceledSubscription = "canceled_subscription_notification" | ||
) | ||
|
||
// SubscriptionNotification is returned for all subscription notifications. | ||
type SubscriptionNotification struct { | ||
Type string `xml:"-"` | ||
Account Account `xml:"account"` | ||
Subscription recurly.Subscription `xml:"subscription"` | ||
} |
Oops, something went wrong.