Documentation ¶
Index ¶
- Constants
- func SanitizeUUID(id string) string
- type AVSResult
- type Account
- type AccountBalance
- type AccountsService
- type AddOn
- type AddOnsService
- type Address
- type Adjustment
- type AdjustmentsService
- type Billing
- type BillingService
- type CVVResult
- type Client
- type Coupon
- type CouponsService
- type CreditPayment
- type CreditPaymentsService
- type CustomFields
- type Error
- type Invoice
- type InvoiceCollection
- type InvoicesService
- type NestedPlan
- type NewSubscription
- type NewSubscriptionResponse
- type Note
- type NullBool
- type NullInt
- type NullMarshal
- type NullTime
- type OfflinePayment
- type Params
- type PendingSubscription
- type Plan
- type PlansService
- type Purchase
- type PurchasesService
- type Redemption
- type RedemptionsService
- type Response
- type ShippingAddress
- type ShippingAddressesService
- type Subscription
- type SubscriptionAddOn
- type SubscriptionNotes
- type SubscriptionsService
- type TaxDetail
- type Transaction
- type TransactionError
- type TransactionResult
- type Transactions
- type TransactionsService
- type UnitAmount
- type UpdateSubscription
Constants ¶
const ( // AccountStateActive is the status for active accounts. AccountStateActive = "active" // AccountStateClosed is the status for closed accounts. AccountStateClosed = "closed" )
const ( AdjustmentStatePending = "pending" AdjustmentStateInvoied = "invoiced" )
Adjustment state constants
const ( CreditPaymentActionPayment = "payment" // applying the credit CreditPaymentActionGiftCard = "gift_card" CreditPaymentActionRefund = "refund" CreditPaymentActionReduction = "reduction" // reducing the amount of the credit without applying it CreditPaymentActionWriteOff = "write_off" // used for voiding invoices )
Credit payment action constants.
const ( ChargeInvoiceStatePending = "pending" // previously "open" ChargeInvoiceStateProcessing = "processing" // ACH payments only ChargeInvoiceStatePastDue = "past_due" ChargeInvoiceStatePaid = "paid" // previously "collected" ChargeInvoiceStateFailed = "failed" CreditInvoiceStateOpen = "open" CreditInvoiceStateProcessing = "processing" // ACH/bank refund processing CreditInvoiceStateClosed = "closed" CreditInvoiceStateVoided = "voided" // Deprecated InvoiceStateOpenDeprecated = "open" InvoiceStateCollectedDeprecated = "collected" )
Invoice state constants. https://docs.recurly.com/docs/credit-invoices-release#section-invoice-attribute-changes
const ( CollectionMethodAutomatic = "automatic" // card on file CollectionMethodManual = "manual" // external payment method )
Collection method constants.
const ( PaymentMethodCreditCard = "credit_card" PaymentMethodPayPal = "paypal" PaymentMethodEFT = "eft" PaymentMethodWireTransfer = "wire_transfer" PaymentMethodMoneyOrder = "money_order" PaymentMethodCheck = "check" PaymentMethodOther = "other" )
Payment method constants.
const ( ChargeInvoiceOriginPurchase = "purchase" ChargeInvoiceOriginRenewal = "renewal" ChargeInvoiceOriginImmediateChange = "immediate_change" ChargeInvoiceOriginTermination = "termination" CreditInvoiceOriginGiftCard = "gift_card" CreditInvoiceOriginRefund = "refund" CreditInvoiceOriginCredit = "credit" CreditInvoiceOriginWriteOff = "write_off" CreditInvoiceOriginExternalCredit = "external_credit" )
Invoice origin constants.
const ( InvoiceTypeCharge = "charge" InvoiceTypeCredit = "credit" InvoiceTypeLegacy = "legacy" // all invoices prior to change have type legacy )
Invoice type constants.
const ( VoidRefundMethodTransactionFirst = "transaction_first" VoidRefundMethodCreditFirst = "credit_first" )
Refund constants.
const ( RedemptionStateActive = "active" RedemptionStateInactive = "inactive" )
const ( // SubscriptionStateActive represents subscriptions that are valid for the // current time. This includes subscriptions in a trial period SubscriptionStateActive = "active" // SubscriptionStateCanceled are subscriptions that are valid for // the current time but will not renew because a cancelation was requested SubscriptionStateCanceled = "canceled" // SubscriptionStateExpired are subscriptions that have expired and are no longer valid SubscriptionStateExpired = "expired" // SubscriptionStateFuture are subscriptions that will start in the // future, they are not active yet SubscriptionStateFuture = "future" // SubscriptionStateInTrial are subscriptions that are active or canceled // and are in a trial period SubscriptionStateInTrial = "in_trial" // SubscriptionStateLive are all subscriptions that are not expired SubscriptionStateLive = "live" // SubscriptionStatePastDue are subscriptions that are active or canceled // and have a past-due invoice SubscriptionStatePastDue = "past_due" // SubscriptionStatePaused are subscriptions that are in a paused state // and will not be billed for the set RemainingPauseCycles SubscriptionStatePaused = "paused" )
const ( // TransactionStatusSuccess is the status for a successful transaction. TransactionStatusSuccess = "success" // TransactionStatusFailed is the status for a failed transaction. TransactionStatusFailed = "failed" // TransactionStatusVoid is the status for a voided transaction. TransactionStatusVoid = "void" )
const DateTimeFormat = "2006-01-02T15:04:05Z07:00"
DateTimeFormat is the format Recurly uses to represent datetimes.
Variables ¶
This section is empty.
Functions ¶
func SanitizeUUID ¶
SanitizeUUID returns the uuid without dashes.
Types ¶
type AVSResult ¶
type AVSResult struct {
TransactionResult
}
AVSResult holds transaction results for address verification. http://developer.authorize.net/tools/errorgenerationguide/
type Account ¶
type Account struct { XMLName xml.Name `xml:"account"` Code string `xml:"account_code,omitempty"` State string `xml:"state,omitempty"` Username string `xml:"username,omitempty"` Email string `xml:"email,omitempty"` FirstName string `xml:"first_name,omitempty"` LastName string `xml:"last_name,omitempty"` CompanyName string `xml:"company_name,omitempty"` VATNumber string `xml:"vat_number,omitempty"` TaxExempt NullBool `xml:"tax_exempt,omitempty"` BillingInfo *Billing `xml:"billing_info,omitempty"` Address Address `xml:"address,omitempty"` AcceptLanguage string `xml:"accept_language,omitempty"` HostedLoginToken string `xml:"hosted_login_token,omitempty"` CreatedAt NullTime `xml:"created_at,omitempty"` HasPausedSubscription bool `xml:"has_paused_subscription,omitempty"` ShippingAddresses *[]ShippingAddress `xml:"shipping_addresses>shipping_address,omitempty"` CustomFields *CustomFields `xml:"custom_fields,omitempty"` }
Account represents an individual account on your site
type AccountBalance ¶
type AccountBalance struct { XMLName xml.Name `xml:"account_balance"` AccountCode string `xml:"-"` PastDue bool `xml:"past_due"` Balance int `xml:"balance_in_cents>USD"` }
AccountBalance is used for getting the account balance.
type AccountsService ¶
type AccountsService interface { List(params Params) (*Response, []Account, error) Get(code string) (*Response, *Account, error) LookupAccountBalance(code string) (*Response, *AccountBalance, error) Create(a Account) (*Response, *Account, error) Update(code string, a Account) (*Response, *Account, error) Close(code string) (*Response, error) Reopen(code string) (*Response, error) ListNotes(code string) (*Response, []Note, error) }
AccountsService represents the interactions available for accounts.
type AddOn ¶
type AddOn struct { XMLName xml.Name `xml:"add_on"` Code string `xml:"add_on_code,omitempty"` Name string `xml:"name,omitempty"` DefaultQuantity NullInt `xml:"default_quantity,omitempty"` DisplayQuantityOnHostedPage NullBool `xml:"display_quantity_on_hosted_page,omitempty"` TaxCode string `xml:"tax_code,omitempty"` UnitAmountInCents UnitAmount `xml:"unit_amount_in_cents,omitempty"` AccountingCode string `xml:"accounting_code,omitempty"` CreatedAt NullTime `xml:"created_at,omitempty"` }
AddOn represents an individual add on linked to a plan.
type AddOnsService ¶
type AddOnsService interface { List(planCode string, params Params) (*Response, []AddOn, error) Get(planCode string, code string) (*Response, *AddOn, error) Create(planCode string, a AddOn) (*Response, *AddOn, error) Update(planCode string, code string, a AddOn) (*Response, *AddOn, error) Delete(planCode string, code string) (*Response, error) }
AddOnsService represents the interactions available for add ons.
type Address ¶
type Address struct { Address string `xml:"address1,omitempty"` Address2 string `xml:"address2,omitempty"` City string `xml:"city,omitempty"` State string `xml:"state,omitempty"` Zip string `xml:"zip,omitempty"` Country string `xml:"country,omitempty"` Phone string `xml:"phone,omitempty"` }
Address is used for embedded addresses within other structs.
func (Address) MarshalXML ¶
MarshalXML ensures addresses marshal to nil if empty without the need to use pointers.
type Adjustment ¶
type Adjustment struct { AccountCode string InvoiceNumber int SubscriptionUUID string UUID string State string Description string AccountingCode string ProductCode string Origin string UnitAmountInCents int Quantity int OriginalAdjustmentUUID string DiscountInCents int TaxInCents int TotalInCents int Currency string Taxable NullBool TaxCode string TaxType string TaxRegion string TaxRate float64 TaxExempt NullBool TaxDetails []TaxDetail StartDate NullTime EndDate NullTime CreatedAt NullTime UpdatedAt NullTime }
Adjustment works with charges and credits on a given account.
func (Adjustment) MarshalXML ¶
func (a Adjustment) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML marshals only the fields needed for creating/updating adjustments with the recurly API.
func (*Adjustment) UnmarshalXML ¶
func (a *Adjustment) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal a coupon redemption object. Minaly converts href links for coupons and accounts to CouponCode and AccountCodes.
type AdjustmentsService ¶
type AdjustmentsService interface { List(accountCode string, params Params) (*Response, []Adjustment, error) Get(uuid string) (*Response, *Adjustment, error) Create(accountCode string, a Adjustment) (*Response, *Adjustment, error) Delete(uuid string) (*Response, error) }
AdjustmentsService represents the interactions available for adjustments.
type Billing ¶
type Billing struct { XMLName xml.Name `xml:"billing_info,omitempty"` FirstName string `xml:"first_name,omitempty"` LastName string `xml:"last_name,omitempty"` Company string `xml:"company,omitempty"` Address string `xml:"address1,omitempty"` Address2 string `xml:"address2,omitempty"` City string `xml:"city,omitempty"` State string `xml:"state,omitempty"` Zip string `xml:"zip,omitempty"` Country string `xml:"country,omitempty"` Phone string `xml:"phone,omitempty"` VATNumber string `xml:"vat_number,omitempty"` IPAddress net.IP `xml:"ip_address,omitempty"` IPAddressCountry string `xml:"ip_address_country,omitempty"` // Credit Card Info FirstSix string `xml:"first_six,omitempty"` // String not int so card number can start with zero LastFour string `xml:"last_four,omitempty"` // String not int so that leading zeros are present CardType string `xml:"card_type,omitempty"` Number int `xml:"number,omitempty"` Month int `xml:"month,omitempty"` Year int `xml:"year,omitempty"` // VerificationValue is only used for create/update only. A Verification // Value will never be returned on read. VerificationValue int `xml:"verification_value,omitempty"` // Paypal PaypalAgreementID string `xml:"paypal_billing_agreement_id,omitempty"` // Amazon AmazonAgreementID string `xml:"amazon_billing_agreement_id,omitempty"` // Bank Account // Note: routing numbers and account numbers may start with zeros, so need // to treat them as strings NameOnAccount string `xml:"name_on_account,omitempty"` RoutingNumber string `xml:"routing_number,omitempty"` AccountNumber string `xml:"account_number,omitempty"` AccountType string `xml:"account_type,omitempty"` // Token is used for create/update only. A token will never be returned // on read. Token string `xml:"token_id,omitempty"` }
Billing represents billing info for a single account on your site
func (*Billing) UnmarshalXML ¶
UnmarshalXML is a customer XML unmarshaler for billing info that supports unmarshaling null fields without errors.
type BillingService ¶
type BillingService interface { Get(accountCode string) (*Response, *Billing, error) Create(accountCode string, b Billing) (*Response, *Billing, error) CreateWithToken(accountCode string, token string) (*Response, *Billing, error) Update(accountCode string, b Billing) (*Response, *Billing, error) UpdateWithToken(accountCode string, token string) (*Response, *Billing, error) Clear(accountCode string) (*Response, error) }
BillingService represents the interactions available for billing.
type CVVResult ¶
type CVVResult struct {
TransactionResult
}
CVVResult holds transaction results for CVV fields. https://www.chasepaymentech.com/card_verification_codes.html
func (CVVResult) NotProcessed ¶
NotProcessed returns true if the CVV code was not processed.
func (CVVResult) ShouldHaveBeenPresent ¶
ShouldHaveBeenPresent returns true if the CVV code should have been present on the card but was not indicated.
func (CVVResult) UnableToProcess ¶
UnableToProcess returns true when the issuer was unable to process the CVV.
type Client ¶
type Client struct { // BaseURL is the base url for api requests. BaseURL string // Services used for talking with different parts of the Recurly API Accounts AccountsService Adjustments AdjustmentsService Billing BillingService Coupons CouponsService Redemptions RedemptionsService Invoices InvoicesService Plans PlansService AddOns AddOnsService ShippingAddresses ShippingAddressesService Subscriptions SubscriptionsService Transactions TransactionsService CreditPayments CreditPaymentsService Purchases PurchasesService // contains filtered or unexported fields }
Client manages communication with the Recurly API.
type Coupon ¶
type Coupon struct { XMLName xml.Name `xml:"coupon"` ID uint64 `xml:"id"` Code string `xml:"coupon_code"` Type string `xml:"coupon_type"` Name string `xml:"name"` RedemptionResource string `xml:"redemption_resource"` State string `xml:"state"` SingleUse bool `xml:"single_use"` AppliesToAllPlans bool `xml:"applies_to_all_plans"` Duration string `xml:"duration"` DiscountType string `xml:"discount_type"` AppliesToNonPlanCharges bool `xml:"applies_to_non_plan_charges"` Description string `xml:"description,omitempty"` InvoiceDescription string `xml:"invoice_description,omitempty"` DiscountPercent NullInt `xml:"discount_percent,omitempty"` DiscountInCents *UnitAmount `xml:"discount_in_cents,omitempty"` RedeemByDate NullTime `xml:"redeem_by_date,omitempty"` MaxRedemptions NullInt `xml:"max_redemptions,omitempty"` CreatedAt NullTime `xml:"created_at,omitempty"` UpdatedAt NullTime `xml:"updated_at,omitempty"` DeletedAt NullTime `xml:"deleted_at,omitempty"` TemporalUnit string `xml:"temporal_unit,omitempty"` TemporalAmount NullInt `xml:"temporal_amount,omitempty"` MaxRedemptionsPerAccount NullInt `xml:"max_redemptions_per_account,omitempty"` UniqueCodeTemplate string `xml:"unique_code_template,omitempty"` UniqueCouponCodeCount NullInt `xml:"unique_coupon_codes_count,omitempty"` PlanCodes []string `xml:"plan_codes>plan_code,omitempty"` }
Coupon represents an individual coupon on your site. https://dev.recurly.com/docs/lookup-a-coupon
type CouponsService ¶
type CouponsService interface { List(params Params) (*Response, []Coupon, error) Get(code string) (*Response, *Coupon, error) Create(c Coupon) (*Response, *Coupon, error) Delete(code string) (*Response, error) }
CouponsService represents the interactions available for coupons.
type CreditPayment ¶
type CreditPayment struct { XMLName xml.Name `xml:"credit_payment"` AccountCode string `xml:"-"` UUID string `xml:"uuid"` Action string `xml:"action"` Currency string `xml:"currency"` AmountInCents int `xml:"amount_in_cents"` OriginalInvoiceNumber int `xml:"-"` AppliedToInvoice int `xml:"-"` OriginalCreditPaymentUUID string `xml:"-"` RefundTransactionUUID string `xml:"-"` CreatedAt NullTime `xml:"created_at"` UpdatedAt NullTime `xml:"updated_at,omitempty"` VoidedAt NullTime `xml:"voided_at,omitempty"` }
CreditPayment is a credit that has been applied to an invoice. This is a read-only object. Unmarshaling an invoice is handled by the custom UnmarshalXML function.
func (*CreditPayment) UnmarshalXML ¶
func (c *CreditPayment) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals invoices and handles intermediary state during unmarshaling for types like href.
type CreditPaymentsService ¶
type CreditPaymentsService interface { List(params Params) (*Response, []CreditPayment, error) ListAccount(accountCode string, params Params) (*Response, []CreditPayment, error) Get(uuid string) (*Response, *CreditPayment, error) }
CreditPaymentsService represents the interactions available for credit payments.
type CustomFields ¶
CustomFields represents custom key value pairs. Note that custom fields must be enabled on your Recurly site and must be added in the dashboard before they can be used.
func (CustomFields) MarshalXML ¶
func (c CustomFields) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML marshals custom_fields.
func (*CustomFields) UnmarshalXML ¶
func (c *CustomFields) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals custom_fields.
type Error ¶
type Error struct { XMLName xml.Name `xml:"error"` Message string `xml:",innerxml"` Field string `xml:"field,attr"` Symbol string `xml:"symbol,attr"` Description string `xml:"-"` }
Error is an individual validation error
type Invoice ¶
type Invoice struct { XMLName xml.Name `xml:"invoice,omitempty"` AccountCode string `xml:"-"` Address Address `xml:"-"` OriginalInvoiceNumber int `xml:"-"` UUID string `xml:"-"` State string `xml:"-"` InvoiceNumberPrefix string `xml:"-"` InvoiceNumber int `xml:"-"` PONumber string `xml:"po_number,omitempty"` // PostInvoice param VATNumber string `xml:"-"` DiscountInCents int `xml:"-"` SubtotalInCents int `xml:"-"` TaxInCents int `xml:"-"` TotalInCents int `xml:"-"` BalanceInCents int `xml:"-"` Currency string `xml:"-"` DueOn NullTime `xml:"-"` CreatedAt NullTime `xml:"-"` UpdatedAt NullTime `xml:"-"` AttemptNextCollectionAt NullTime `xml:"-"` ClosedAt NullTime `xml:"-"` Type string `xml:"-"` Origin string `xml:"-"` TaxType string `xml:"-"` TaxRegion string `xml:"-"` TaxRate float64 `xml:"-"` NetTerms NullInt `xml:"net_terms,omitempty"` // PostInvoice param CollectionMethod string `xml:"collection_method,omitempty"` // PostInvoice param TermsAndConditions string `xml:"terms_and_conditions,omitempty"` // PostInvoice param CustomerNotes string `xml:"customer_notes,omitempty"` // PostInvoice param VatReverseChargeNotes string `xml:"vat_reverse_charge_notes,omitempty"` // PostInvoice param LineItems []Adjustment `xml:"-"` Transactions []Transaction `xml:"-"` CreditPayments []CreditPayment `xml:"-"` }
Invoice is an individual invoice for an account. The only fields annotated with XML tags are those for posting an invoice. Unmarshaling an invoice is handled by the custom UnmarshalXML function.
func (*Invoice) UnmarshalXML ¶
UnmarshalXML unmarshals invoices and handles intermediary state during unmarshaling for types like href.
type InvoiceCollection ¶
type InvoiceCollection struct { XMLName xml.Name `xml:"invoice_collection"` ChargeInvoice *Invoice `xml:"-"` }
InvoiceCollection is the data type returned from Preview, Post, MarkFailed, and inside PreviewSubscription, and PreviewSubscriptionChange. In v2.12 this struct will include `credit_invoices`.
func (*InvoiceCollection) UnmarshalXML ¶
func (i *InvoiceCollection) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals invoices and handles intermediary state during unmarshaling for types like href.
type InvoicesService ¶
type InvoicesService interface { List(params Params) (*Response, []Invoice, error) ListAccount(accountCode string, params Params) (*Response, []Invoice, error) Get(invoiceNumber int) (*Response, *Invoice, error) GetPDF(invoiceNumber int, language string) (*Response, *bytes.Buffer, error) Preview(accountCode string) (*Response, *Invoice, error) Create(accountCode string, invoice Invoice) (*Response, *Invoice, error) Collect(invoiceNumber int) (*Response, *Invoice, error) MarkPaid(invoiceNumber int) (*Response, *Invoice, error) MarkFailed(invoiceNumber int) (*Response, *Invoice, error) RefundVoidOpenAmount(invoiceNumber int, amountInCents int, refundMethod string) (*Response, *Invoice, error) VoidCreditInvoice(invoiceNumber int) (*Response, *Invoice, error) RecordPayment(offlinePayment OfflinePayment) (*Response, *Transaction, error) }
InvoicesService represents the interactions available for invoices.
type NestedPlan ¶
type NewSubscription ¶
type NewSubscription struct { XMLName xml.Name `xml:"subscription"` PlanCode string `xml:"plan_code"` Account Account `xml:"account"` SubscriptionAddOns *[]SubscriptionAddOn `xml:"subscription_add_ons>subscription_add_on,omitempty"` CouponCode string `xml:"coupon_code,omitempty"` UnitAmountInCents int `xml:"unit_amount_in_cents,omitempty"` Currency string `xml:"currency"` Quantity int `xml:"quantity,omitempty"` TrialEndsAt NullTime `xml:"trial_ends_at,omitempty"` StartsAt NullTime `xml:"starts_at,omitempty"` TotalBillingCycles int `xml:"total_billing_cycles,omitempty"` RenewalBillingCycles NullInt `xml:"renewal_billing_cycles"` FirstRenewalDate NullTime `xml:"first_renewal_date,omitempty"` CollectionMethod string `xml:"collection_method,omitempty"` AutoRenew bool `xml:"auto_renew,omitempty"` NetTerms NullInt `xml:"net_terms,omitempty"` PONumber string `xml:"po_number,omitempty"` Bulk bool `xml:"bulk,omitempty"` TermsAndConditions string `xml:"terms_and_conditions,omitempty"` CustomerNotes string `xml:"customer_notes,omitempty"` VATReverseChargeNotes string `xml:"vat_reverse_charge_notes,omitempty"` BankAccountAuthorizedAt NullTime `xml:"bank_account_authorized_at,omitempty"` CustomFields *CustomFields `xml:"custom_fields,omitempty"` }
NewSubscription is used to create new subscriptions.
type NewSubscriptionResponse ¶
type NewSubscriptionResponse struct { Subscription *Subscription Transaction *Transaction // UnprocessableEntity errors return only the transaction }
NewSubscriptionResponse is used to unmarshal either the subscription or the transaction.
type Note ¶
type Note struct { XMLName xml.Name `xml:"note"` Message string `xml:"message,omitempty"` CreatedAt time.Time `xml:"created_at,omitempty"` }
Note holds account notes.
type NullBool ¶
NullBool is used for properly handling bool types with the Recurly API. Without it, setting a false boolean value will be ignored when encoding xml requests to the Recurly API.
func (NullBool) MarshalXML ¶
MarshalXML marshals NullBools to XML. Otherwise nothing is marshaled.
func (*NullBool) UnmarshalXML ¶
UnmarshalXML unmarshals an bool properly, as well as marshaling an empty string to nil.
type NullInt ¶
NullInt is used for properly handling int types that could be null.
func (NullInt) MarshalXML ¶
MarshalXML marshals NullInts greater than zero to XML. Otherwise nothing is marshaled.
func (*NullInt) UnmarshalXML ¶
UnmarshalXML unmarshals an int properly, as well as marshaling an empty string to nil.
type NullMarshal ¶
type NullMarshal struct{}
NullMarshal can be embedded in structs that are read-only or just should never be marshaled
func (NullMarshal) MarshalXML ¶
func (nm NullMarshal) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML ensures that nullMarshal doesn't marshal any xml.
type NullTime ¶
NullTime is used for properly handling time.Time types that could be null.
func NewTimeFromString ¶
NewTimeFromString generates a new NullTime based on a time string in the DateTimeFormat format. This is primarily used in unit testing.
func (NullTime) MarshalXML ¶
MarshalXML marshals times into their proper format. Otherwise nothing is marshaled. All times are sent in UTC.
func (NullTime) String ¶
String returns a string representation of the time in UTC using the DateTimeFormat constant as the format.
func (*NullTime) UnmarshalXML ¶
UnmarshalXML unmarshals an int properly, as well as marshaling an empty string to nil.
type OfflinePayment ¶
type OfflinePayment struct { XMLName xml.Name `xml:"transaction"` InvoiceNumber int `xml:"-"` PaymentMethod string `xml:"payment_method"` CollectedAt *time.Time `xml:"collected_at,omitempty"` Amount int `xml:"amount_in_cents,omitempty"` Description string `xml:"description,omitempty"` }
OfflinePayment is a payment received outside the system to be recorded in Recurly.
type Params ¶
type Params map[string]interface{}
Params are used to send parameters with the request.
type PendingSubscription ¶
type PendingSubscription struct { XMLName xml.Name `xml:"pending_subscription"` Plan NestedPlan `xml:"plan,omitempty"` UnitAmountInCents int `xml:"unit_amount_in_cents,omitempty"` Quantity int `xml:"quantity,omitempty"` // Quantity of subscriptions SubscriptionAddOns []SubscriptionAddOn `xml:"subscription_add_ons>subscription_add_on,omitempty"` }
PendingSubscription are updates to the subscription or subscription add ons that will be made on the next renewal.
type Plan ¶
type Plan struct { XMLName xml.Name `xml:"plan"` Code string `xml:"plan_code,omitempty"` Name string `xml:"name"` Description string `xml:"description,omitempty"` SuccessURL string `xml:"success_url,omitempty"` CancelURL string `xml:"cancel_url,omitempty"` DisplayDonationAmounts NullBool `xml:"display_donation_amounts,omitempty"` DisplayQuantity NullBool `xml:"display_quantity,omitempty"` DisplayPhoneNumber NullBool `xml:"display_phone_number,omitempty"` BypassHostedConfirmation NullBool `xml:"bypass_hosted_confirmation,omitempty"` UnitName string `xml:"unit_name,omitempty"` PaymentPageTOSLink string `xml:"payment_page_tos_link,omitempty"` IntervalUnit string `xml:"plan_interval_unit,omitempty"` IntervalLength int `xml:"plan_interval_length,omitempty"` TrialIntervalUnit string `xml:"trial_interval_unit,omitempty"` TrialIntervalLength int `xml:"trial_interval_length,omitempty"` TotalBillingCycles NullInt `xml:"total_billing_cycles,omitempty"` AccountingCode string `xml:"accounting_code,omitempty"` CreatedAt NullTime `xml:"created_at,omitempty"` TaxExempt NullBool `xml:"tax_exempt,omitempty"` TaxCode string `xml:"tax_code,omitempty"` AutoRenew bool `xml:"auto_renew,omitempty"` UnitAmountInCents UnitAmount `xml:"unit_amount_in_cents"` SetupFeeInCents UnitAmount `xml:"setup_fee_in_cents,omitempty"` }
Plan represents an individual plan on your site.
type PlansService ¶
type PlansService interface { List(params Params) (*Response, []Plan, error) Get(code string) (*Response, *Plan, error) Create(p Plan) (*Response, *Plan, error) Update(code string, p Plan) (*Response, *Plan, error) Delete(code string) (*Response, error) }
PlansService represents the interactions available for plans.
type Purchase ¶
type Purchase struct { XMLName xml.Name `xml:"purchase"` Account Account `xml:"account,omitempty"` Adjustments []Adjustment `xml:"adjustments>adjustment,omitempty"` CollectionMethod string `xml:"collection_method,omitempty"` Currency string `xml:"currency"` PONumber string `xml:"po_number,omitempty"` NetTerms NullInt `xml:"net_terms,omitempty"` GiftCard string `xml:"gift_card>redemption_code,omitempty"` CouponCodes []string `xml:"coupon_codes>coupon_code,omitempty"` Subscriptions []NewSubscription `xml:"subscriptions>subscription,omitempty"` CustomerNotes string `xml:"customer_notes,omitempty"` TermsAndConditions string `xml:"terms_and_conditions,omitempty"` VATReverseChargeNotes string `xml:"vat_reverse_charge_notes,omitempty"` ShippingAddressID int64 `xml:"shipping_address_id,omitempty"` }
Purchase represents an individual checkout holding at least one subscription OR one adjustment
type PurchasesService ¶
type PurchasesService interface { Create(p Purchase) (*Response, *InvoiceCollection, error) Preview(p Purchase) (*Response, *InvoiceCollection, error) }
PurchasesService represents the interactions available for a purchase involving at least one adjustment or one subscription.
type Redemption ¶
type Redemption struct { UUID string SubscriptionUUID string AccountCode string CouponCode string SingleUse bool TotalDiscountedInCents int Currency string State string CreatedAt NullTime UpdatedAt NullTime }
Redemption holds redeemed coupons for an account or invoice.
func (*Redemption) UnmarshalXML ¶
func (r *Redemption) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal a coupon redemption object. Minaly converts href links for coupons and accounts to CouponCode and AccountCodes.
type RedemptionsService ¶
type RedemptionsService interface { GetForAccount(accountCode string) (*Response, []Redemption, error) GetForInvoice(invoiceNumber string) (*Response, []Redemption, error) Redeem(code string, accountCode string, currency string) (*Response, *Redemption, error) RedeemToSubscription(code string, accountCode string, currency string, subscriptionUUID string) (*Response, *Redemption, error) Delete(accountCode string) (*Response, error) }
RedemptionsService represents the interactions available for redemptions.
type Response ¶
type Response struct { *http.Response // Errors holds an array of validation errors if any occurred. Errors []Error // contains filtered or unexported fields }
Response is returned for each API call.
func (*Response) IsClientError ¶
IsClientError returns true if the request resulted in a 400-499 status code.
func (*Response) IsServerError ¶
IsServerError returns true if the request resulted in a 500-599 status code -- indicating you may want to retry the request later.
type ShippingAddress ¶
type ShippingAddress struct { XMLName xml.Name `xml:"shipping_address"` AccountCode string `xml:"account,omitempty"` ID int64 `xml:"id,omitempty"` FirstName string `xml:"first_name"` LastName string `xml:"last_name"` Nickname string `xml:"nickname,omitempty"` Address string `xml:"address1"` Address2 string `xml:"address2"` Company string `xml:"company,omitempty"` City string `xml:"city"` State string `xml:"state"` Zip string `xml:"zip"` Country string `xml:"country"` Phone string `xml:"phone,omitempty"` Email string `xml:"email,omitempty"` VATNumber string `xml:"vat_number,omitempty"` CreatedAt NullTime `xml:"created_at,omitempty"` UpdatedAt NullTime `xml:"updated_at,omitempty"` }
ShippingAddress represents a shipping address
func (*ShippingAddress) UnmarshalXML ¶
func (s *ShippingAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals shipping addresses and handles intermediary state during unmarshaling for types like href.
type ShippingAddressesService ¶
type ShippingAddressesService interface { ListAccount(accountCode string, params Params) (*Response, []ShippingAddress, error) Create(accountCode string, address ShippingAddress) (*Response, *ShippingAddress, error) Update(accountCode string, shippingAddressID int64, address ShippingAddress) (*Response, *ShippingAddress, error) Delete(accountCode string, shippingAddressID int64) (*Response, error) GetSubscriptions(accountCode string, shippingAddressID int64) (*Response, []Subscription, error) }
ShippingAddressesService represents the interactions available for shipping addresses.
type Subscription ¶
type Subscription struct { XMLName xml.Name `xml:"subscription"` Plan NestedPlan `xml:"plan,omitempty"` AccountCode string `xml:"-"` InvoiceNumber int `xml:"-"` UUID string `xml:"uuid,omitempty"` State string `xml:"state,omitempty"` UnitAmountInCents int `xml:"unit_amount_in_cents,omitempty"` Currency string `xml:"currency,omitempty"` Quantity int `xml:"quantity,omitempty"` TotalAmountInCents int `xml:"total_amount_in_cents,omitempty"` ActivatedAt NullTime `xml:"activated_at,omitempty"` CanceledAt NullTime `xml:"canceled_at,omitempty"` ExpiresAt NullTime `xml:"expires_at,omitempty"` CurrentPeriodStartedAt NullTime `xml:"current_period_started_at,omitempty"` CurrentPeriodEndsAt NullTime `xml:"current_period_ends_at,omitempty"` TrialStartedAt NullTime `xml:"trial_started_at,omitempty"` TrialEndsAt NullTime `xml:"trial_ends_at,omitempty"` PausedAt NullTime `xml:"paused_at,omitempty"` ResumeAt NullTime `xml:"resume_at,omitempty"` TaxInCents int `xml:"tax_in_cents,omitempty"` TaxType string `xml:"tax_type,omitempty"` TaxRegion string `xml:"tax_region,omitempty"` TaxRate float64 `xml:"tax_rate,omitempty"` PONumber string `xml:"po_number,omitempty"` NetTerms NullInt `xml:"net_terms,omitempty"` SubscriptionAddOns []SubscriptionAddOn `xml:"subscription_add_ons>subscription_add_on,omitempty"` CurrentTermStartedAt NullTime `xml:"current_term_started_at,omitempty"` CurrentTermEndsAt NullTime `xml:"current_term_ends_at,omitempty"` PendingSubscription *PendingSubscription `xml:"pending_subscription,omitempty"` InvoiceCollection *InvoiceCollection `xml:"invoice_collection,omitempty"` RemainingPauseCycles int `xml:"remaining_pause_cycles,omitempty"` CollectionMethod string `xml:"collection_method"` AutoRenew bool `xml:"auto_renew,omitempty"` RenewalBillingCycles NullInt `xml:"renewal_billing_cycles"` CustomFields *CustomFields `xml:"custom_fields,omitempty"` }
Subscription represents an individual subscription.
func (Subscription) MakeUpdate ¶
func (s Subscription) MakeUpdate() UpdateSubscription
MakeUpdate creates an UpdateSubscription with values that need to be passed on update to be retained (meaning nil/zero values will delete that value). After calling MakeUpdate you should modify the struct with your updates. Once you're ready you can call client.Subscriptions.Update
func (*Subscription) UnmarshalXML ¶
func (s *Subscription) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals transactions and handles intermediary state during unmarshaling for types like href.
type SubscriptionAddOn ¶
type SubscriptionAddOn struct { XMLName xml.Name `xml:"subscription_add_on"` Type string `xml:"add_on_type,omitempty"` Code string `xml:"add_on_code"` UnitAmountInCents int `xml:"unit_amount_in_cents"` Quantity int `xml:"quantity,omitempty"` }
SubscriptionAddOn are add ons to subscriptions. https://docs.com/api/subscriptions/subscription-add-ons
type SubscriptionNotes ¶
type SubscriptionNotes struct { XMLName xml.Name `xml:"subscription"` TermsAndConditions string `xml:"terms_and_conditions,omitempty"` CustomerNotes string `xml:"customer_notes,omitempty"` VATReverseChargeNotes string `xml:"vat_reverse_charge_notes,omitempty"` }
SubscriptionNotes is used to update a subscription's notes.
type SubscriptionsService ¶
type SubscriptionsService interface { List(params Params) (*Response, []Subscription, error) ListAccount(accountCode string, params Params) (*Response, []Subscription, error) Get(uuid string) (*Response, *Subscription, error) Create(sub NewSubscription) (*Response, *NewSubscriptionResponse, error) Preview(sub NewSubscription) (*Response, *Subscription, error) Update(uuid string, sub UpdateSubscription) (*Response, *Subscription, error) UpdateNotes(uuid string, n SubscriptionNotes) (*Response, *Subscription, error) PreviewChange(uuid string, sub UpdateSubscription) (*Response, *Subscription, error) Cancel(uuid string) (*Response, *Subscription, error) Reactivate(uuid string) (*Response, *Subscription, error) TerminateWithPartialRefund(uuid string) (*Response, *Subscription, error) TerminateWithFullRefund(uuid string) (*Response, *Subscription, error) TerminateWithoutRefund(uuid string) (*Response, *Subscription, error) Postpone(uuid string, dt time.Time, bulk bool) (*Response, *Subscription, error) Pause(uuid string, cycles int) (*Response, *Subscription, error) Resume(uuid string) (*Response, *Subscription, error) }
SubscriptionsService represents the interactions available for subscriptions.
type TaxDetail ¶
type TaxDetail struct { XMLName xml.Name `xml:"tax_detail"` Name string `xml:"name,omitempty"` Type string `xml:"type,omitempty"` TaxRate float64 `xml:"tax_rate,omitempty"` TaxInCents int `xml:"tax_in_cents,omitempty"` }
TaxDetail holds tax information and is embedded in an Adjustment. TaxDetails are a read only field, so theys houldn't marshall
type Transaction ¶
type Transaction struct { InvoiceNumber int // Read only UUID string `xml:"uuid,omitempty"` // Read only Action string `xml:"action,omitempty"` AmountInCents int `xml:"amount_in_cents"` TaxInCents int `xml:"tax_in_cents,omitempty"` Currency string `xml:"currency"` Status string `xml:"status,omitempty"` Description string `xml:"description,omitempty"` ProductCode string `xml:"-"` // Write only field, is saved on the invoice line item but not the transaction PaymentMethod string `xml:"payment_method,omitempty"` Reference string `xml:"reference,omitempty"` Source string `xml:"source,omitempty"` Recurring NullBool `xml:"recurring,omitempty"` Test bool `xml:"test,omitempty"` Voidable NullBool `xml:"voidable,omitempty"` Refundable NullBool `xml:"refundable,omitempty"` IPAddress net.IP `xml:"ip_address,omitempty"` TransactionError *TransactionError `xml:"transaction_error,omitempty"` // Read only CVVResult CVVResult `xml:"cvv_result"` // Read only AVSResult AVSResult `xml:"avs_result"` // Read only AVSResultStreet string `xml:"avs_result_street,omitempty"` // Read only AVSResultPostal string `xml:"avs_result_postal,omitempty"` // Read only CreatedAt NullTime `xml:"created_at,omitempty"` // Read only Account Account `xml:"details>account"` // Read only }
Transaction represents an individual transaction.
func (Transaction) MarshalXML ¶
func (t Transaction) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML marshals a transaction sending only the fields recurly allows for writes. Read only fields are not encoded, and account is written as <account></account> instead of as <details><account></account></details> (like it is in Transaction).
func (*Transaction) UnmarshalXML ¶
func (t *Transaction) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals transactions and handles intermediary state during unmarshaling for types like href.
type TransactionError ¶
type TransactionError struct { XMLName xml.Name `xml:"transaction_error"` ErrorCode string `xml:"error_code,omitempty"` ErrorCategory string `xml:"error_category,omitempty"` MerchantMessage string `xml:"merchant_message,omitempty"` CustomerMessage string `xml:"customer_message,omitempty"` GatewayErrorCode string `xml:"gateway_error_code,omitempty"` }
TransactionError is an error encounted from your payment gateway that recurly has standardized. https://recurly.readme.io/v2.0/page/transaction-errors
type TransactionResult ¶
type TransactionResult struct { NullMarshal Code string `xml:"code,attr"` Message string `xml:",innerxml"` }
TransactionResult is included in CVV results.
type Transactions ¶
type Transactions []Transaction
Transactions is a sortable slice of Transaction. It implements sort.Interface.
func (Transactions) Len ¶
func (s Transactions) Len() int
func (Transactions) Less ¶
func (s Transactions) Less(i, j int) bool
func (Transactions) Swap ¶
func (s Transactions) Swap(i, j int)
type TransactionsService ¶
type TransactionsService interface { List(params Params) (*Response, []Transaction, error) ListAccount(accountCode string, params Params) (*Response, []Transaction, error) Get(uuid string) (*Response, *Transaction, error) Create(t Transaction) (*Response, *Transaction, error) }
TransactionsService represents the interactions available for transactions.
type UnitAmount ¶
type UnitAmount struct { USD int `xml:"USD,omitempty"` EUR int `xml:"EUR,omitempty"` GBP int `xml:"GBP,omitempty"` CAD int `xml:"CAD,omitempty"` AUD int `xml:"AUD,omitempty"` }
UnitAmount is used in plans where unit amounts are represented in cents in both EUR and USD.
func (UnitAmount) MarshalXML ¶
func (u UnitAmount) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML marshals NullBools to XML. Otherwise nothing is marshaled.
func (*UnitAmount) UnmarshalXML ¶
func (u *UnitAmount) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals an int properly, as well as marshaling an empty string to nil.
type UpdateSubscription ¶
type UpdateSubscription struct { XMLName xml.Name `xml:"subscription"` Timeframe string `xml:"timeframe,omitempty"` PlanCode string `xml:"plan_code,omitempty"` Quantity int `xml:"quantity,omitempty"` UnitAmountInCents int `xml:"unit_amount_in_cents,omitempty"` RenewalBillingCycles NullInt `xml:"renewal_billing_cycles"` CollectionMethod string `xml:"collection_method,omitempty"` AutoRenew bool `xml:"auto_renew,omitempty"` NetTerms NullInt `xml:"net_terms,omitempty"` PONumber string `xml:"po_number,omitempty"` SubscriptionAddOns *[]SubscriptionAddOn `xml:"subscription_add_ons>subscription_add_on,omitempty"` }
UpdateSubscription is used to update subscriptions
Source Files ¶
- accounts.go
- accounts_service.go
- add_ons.go
- add_ons_service.go
- adjustments.go
- adjustments_service.go
- billing.go
- billing_service.go
- client.go
- coupons.go
- coupons_service.go
- credit_payments.go
- credit_payments_service.go
- invoices.go
- invoices_service.go
- plans.go
- plans_service.go
- purchases.go
- purchases_service.go
- redemptions.go
- redemptions_service.go
- responses.go
- services.go
- shipping_addresses.go
- shipping_addresses_service.go
- subscriptions.go
- subscriptions_service.go
- transactions.go
- transactions_service.go
- type_href.go
- type_null_bool.go
- type_null_int19.go
- type_null_marshal.go
- type_null_time.go
- type_unit_amount.go