mock

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mock provides mocks attached to the Recurly client for testing code using the Recurly API client.

This package makes it easy to test code using the Recurly API by focusing on the arguments passed into each function and returning the expected result as structs from the Recurly package. There is no need to deal with XML or make any HTTP requests.

Simple Setup

The basic setup for a test involves creating a new mock client, attaching mocks, and returning expected results.

func TestFoo(t *testing.T) {
	client := mock.NewClient("subdomain", "key")
	client.Billing.OnGet = func(ctx context.Context, accountCode string) (*recurly.Billing, error) {
		if accountCode != "10" {
			t.Fatalf("unexpected account code: %s", accountCode)
		}
		return &recurly.Billing{
			FirstName: "Foo",
			LastName: "Bar",
		}
	}

	if b, err := client.Billing.Get(context.Background(), "10"); err != nil {
		t.Fatal(err)
	} else if diff := cmp.Diff(b, &recurly.Billing{
		FirstName: "Foo",
		LastName: "Bar",
	}); diff != "" {
		t.Fatal(diff)
	} else if !client.Billing.GetInvoked {
		t.Fatal("expected Get() to be invoked")
	}
}

More Common Setup

If you created your own wrapper type to the library, let's call it PaymentsProvider:

// MyBillingInfo is a custom billing holder. *recurly.Billing is converted to
// *MyBillingInfo by combining FirstName and LastName into a single Name field.
type MyBillingInfo{
	Name string
}

type PaymentsProvider interface {
	GetBilling(ctx context.Context, id int) (*MyBillingInfo, error)
}

// Provider implements PaymentsProvider.
type Provider struct {
	Client *recurly.Client
}

func New(subdomain, key string) *Provider {
	return &Provider{Client: recurly.NewClient(subdomain, key)}
}

// GetBilling calls Recurly and converts *recurly.BillingInfo to *MyBillingInfo.
func (p *Provider) GetBilling(ctx context.Context, id int) (*MyBillingInfo, error) {
	// Retrieve billing info from Recurly.
	b, err := p.Client.Billing.Get(ctx, strconv.Atoi(id))
	if err != nil {
		return nil, err
	} else if b == nil {
		return nil, nil
	}

	// Convert to MyBillingInfo.
	return &MyBillingInfo{
		Name: fmt.Sprintf("%s %s", b.FirstName, b.LastName),
	}
}

Then in your test suite you might configure your own wrapper similar to mock.Client

package foo_test

import (
	"context"

	"github.com/your-project/foo"
	"github.com/blacklightcms/recurly/mock"
)

// Provider is a test wrapper for foo.Provider.
type Provider struct {
	*foo.Provider

	Billing mock.Billing
}

// NewProvider returns a new test provider.
func NewProvider() *Provider {
	// Init Provider.
	p := &Provider{Provider: foo.New("foo", "bar")}

	// Point Recurly Client's Billing Service to your mock
	// attached to p.
	p.Provider.Client.Billing = &p.Billing
	return p
}

func TestBilling(t *testing.T) {
	// Init test Provider.
	p := NewProvider()

	// Mock Recurly's response
	p.Billing.OnGet = func(ctx context.Context, id int) (*recurly.Billing, error) {
		return &recurly.Billing{
			FirstName: "Verena",
			LastName: "Example",
		}
	}

	// Call your provider and assert *MyBillingInfo
	if b, err := p.GetBilling(context.Background(), 10); err != nil {
		t.Fatal(err)
	} else if diff := cmp.Diff(b, &foo.MyBillingInfo{
		Name: "Verena Example",
	}); diff != "" {
		t.Fatal(diff)
	} else if !p.Billing.GetInvoked {
		t.Fatal("expected Get() to be invoked")
	}
}

See examples for more.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsService

type AccountsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnGet      func(ctx context.Context, code string) (*recurly.Account, error)
	GetInvoked bool

	OnBalance      func(ctx context.Context, code string) (*recurly.AccountBalance, error)
	BalanceInvoked bool

	OnCreate      func(ctx context.Context, a recurly.Account) (*recurly.Account, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, code string, a recurly.Account) (*recurly.Account, error)
	UpdateInvoked bool

	OnClose      func(ctx context.Context, code string) error
	CloseInvoked bool

	OnReopen      func(ctx context.Context, code string) error
	ReopenInvoked bool

	OnListNotes      func(code string, opts *recurly.PagerOptions) recurly.Pager
	ListNotesInvoked bool
}

AccountsService manages the interactions for accounts.

func (*AccountsService) Balance

func (m *AccountsService) Balance(ctx context.Context, code string) (*recurly.AccountBalance, error)

func (*AccountsService) Close

func (m *AccountsService) Close(ctx context.Context, code string) error

func (*AccountsService) Create

func (*AccountsService) Get

func (m *AccountsService) Get(ctx context.Context, code string) (*recurly.Account, error)

func (*AccountsService) List

func (*AccountsService) ListNotes

func (m *AccountsService) ListNotes(code string, opts *recurly.PagerOptions) recurly.Pager

func (*AccountsService) Reopen

func (m *AccountsService) Reopen(ctx context.Context, code string) error

func (*AccountsService) Update

type AddOnsService

type AddOnsService struct {
	OnList      func(planCode string, opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnGet      func(ctx context.Context, planCode string, code string) (*recurly.AddOn, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, planCode string, a recurly.AddOn) (*recurly.AddOn, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, planCode string, code string, a recurly.AddOn) (*recurly.AddOn, error)
	UpdateInvoked bool

	OnDelete      func(ctx context.Context, planCode string, code string) error
	DeleteInvoked bool
}

AddOnsService manages the interactions for add ons.

func (*AddOnsService) Create

func (m *AddOnsService) Create(ctx context.Context, planCode string, a recurly.AddOn) (*recurly.AddOn, error)

func (*AddOnsService) Delete

func (m *AddOnsService) Delete(ctx context.Context, planCode string, code string) error

func (*AddOnsService) Get

func (m *AddOnsService) Get(ctx context.Context, planCode string, code string) (*recurly.AddOn, error)

func (*AddOnsService) List

func (m *AddOnsService) List(planCode string, opts *recurly.PagerOptions) recurly.Pager

func (*AddOnsService) Update

func (m *AddOnsService) Update(ctx context.Context, planCode string, code string, a recurly.AddOn) (*recurly.AddOn, error)

type AdjustmentsService

type AdjustmentsService struct {
	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnGet      func(ctx context.Context, uuid string) (*recurly.Adjustment, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, accountCode string, a recurly.Adjustment) (*recurly.Adjustment, error)
	CreateInvoked bool

	OnDelete      func(ctx context.Context, uuid string) error
	DeleteInvoked bool
}

AdjustmentsService manages the interactions for adjustments.

func (*AdjustmentsService) Create

func (m *AdjustmentsService) Create(ctx context.Context, accountCode string, a recurly.Adjustment) (*recurly.Adjustment, error)

func (*AdjustmentsService) Delete

func (m *AdjustmentsService) Delete(ctx context.Context, uuid string) error

func (*AdjustmentsService) Get

func (*AdjustmentsService) ListAccount

func (m *AdjustmentsService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

type AutomatedExportsService

type AutomatedExportsService struct {
	OnGet      func(ctx context.Context, date time.Time, fileName string) (*recurly.AutomatedExport, error)
	GetInvoked bool

	OnListDates      func(opts *recurly.PagerOptions) recurly.Pager
	ListDatesInvoked bool

	OnListFiles      func(date time.Time, opts *recurly.PagerOptions) recurly.Pager
	ListFilesInvoked bool
}

AutomatedExportsService manages the interactions for automated exports.

func (*AutomatedExportsService) Get

func (*AutomatedExportsService) ListDates

func (*AutomatedExportsService) ListFiles

type BillingService

type BillingService struct {
	OnGet      func(ctx context.Context, accountCode string) (*recurly.Billing, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, accountCode string, b recurly.Billing) (*recurly.Billing, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, accountCode string, b recurly.Billing) (*recurly.Billing, error)
	UpdateInvoked bool

	OnClear      func(ctx context.Context, accountCode string) error
	ClearInvoked bool
}

BillingService manages the interactions for billing.

func (*BillingService) Clear

func (m *BillingService) Clear(ctx context.Context, accountCode string) error

func (*BillingService) Create

func (m *BillingService) Create(ctx context.Context, accountCode string, b recurly.Billing) (*recurly.Billing, error)

func (*BillingService) Get

func (m *BillingService) Get(ctx context.Context, accountCode string) (*recurly.Billing, error)

func (*BillingService) Update

func (m *BillingService) Update(ctx context.Context, accountCode string, b recurly.Billing) (*recurly.Billing, error)

type Client

type Client struct {
	*recurly.Client

	Accounts          AccountsService
	AddOns            AddOnsService
	Adjustments       AdjustmentsService
	Billing           BillingService
	Coupons           CouponsService
	CreditPayments    CreditPaymentsService
	Redemptions       RedemptionsService
	Invoices          InvoicesService
	Plans             PlansService
	Purchases         PurchasesService
	ShippingAddresses ShippingAddressesService
	ShippingMethods   ShippingMethodsService
	Subscriptions     SubscriptionsService
	Transactions      TransactionsService
}

Client is a test wrapper for recurly.Client holding mocks for all of the services.

func NewClient

func NewClient(subdomain, apiKey string) *Client

NewClient returns a new instance of *Client with the services assigned to mocks.

type CouponsService

type CouponsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnGet      func(ctx context.Context, code string) (*recurly.Coupon, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, c recurly.Coupon) (*recurly.Coupon, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)
	UpdateInvoked bool

	OnRestore      func(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)
	RestoreInvoked bool

	OnDelete      func(ctx context.Context, code string) error
	DeleteInvoked bool

	OnGenerate      func(ctx context.Context, code string, n int) (recurly.Pager, error)
	GenerateInvoked bool
}

CouponsService manages the interactions for coupons.

func (*CouponsService) Create

func (*CouponsService) Delete

func (m *CouponsService) Delete(ctx context.Context, code string) error

func (*CouponsService) Generate

func (m *CouponsService) Generate(ctx context.Context, code string, n int) (recurly.Pager, error)

func (*CouponsService) Get

func (m *CouponsService) Get(ctx context.Context, code string) (*recurly.Coupon, error)

func (*CouponsService) List

func (*CouponsService) Restore

func (m *CouponsService) Restore(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)

func (*CouponsService) Update

func (m *CouponsService) Update(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)

type CreditPaymentsService

type CreditPaymentsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnListAccount      func(code string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnGet      func(ctx context.Context, uuid string) (*recurly.CreditPayment, error)
	GetInvoked bool
}

CreditPaymentsService manages the interactions for credit payments.

func (*CreditPaymentsService) Get

func (*CreditPaymentsService) List

func (*CreditPaymentsService) ListAccount

func (m *CreditPaymentsService) ListAccount(code string, opts *recurly.PagerOptions) recurly.Pager

type InvoicesService

type InvoicesService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnGet      func(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)
	GetInvoked bool

	OnGetPDF      func(ctx context.Context, invoiceNumber int, language string) (*bytes.Buffer, error)
	GetPDFInvoked bool

	OnPreview      func(ctx context.Context, accountCode string) (*recurly.Invoice, error)
	PreviewInvoked bool

	OnCreate      func(ctx context.Context, accountCode string, invoice recurly.Invoice) (*recurly.Invoice, error)
	CreateInvoked bool

	OnCollect      func(ctx context.Context, invoiceNumber int, collectInvoice recurly.CollectInvoice) (*recurly.Invoice, error)
	CollectInvoked bool

	OnMarkPaid      func(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)
	MarkPaidInvoked bool

	OnMarkFailed      func(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)
	MarkFailedInvoked bool

	OnRefundVoidLineItems      func(ctx context.Context, invoiceNumber int, refund recurly.InvoiceLineItemsRefund) (*recurly.Invoice, error)
	RefundVoidLineItemsInvoked bool

	OnRefundVoidOpenAmount      func(ctx context.Context, invoiceNumber int, refund recurly.InvoiceRefund) (*recurly.Invoice, error)
	RefundVoidOpenAmountInvoked bool

	OnVoidCreditInvoice      func(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)
	VoidCreditInvoiceInvoked bool

	OnRecordPayment      func(ctx context.Context, pmt recurly.OfflinePayment) (*recurly.Transaction, error)
	RecordPaymentInvoked bool
}

InvoicesService manages the interactions for invoices.

func (*InvoicesService) Collect

func (m *InvoicesService) Collect(ctx context.Context, invoiceNumber int, collectInvoice recurly.CollectInvoice) (*recurly.Invoice, error)

func (*InvoicesService) Create

func (m *InvoicesService) Create(ctx context.Context, accountCode string, invoice recurly.Invoice) (*recurly.Invoice, error)

func (*InvoicesService) Get

func (m *InvoicesService) Get(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)

func (*InvoicesService) GetPDF

func (m *InvoicesService) GetPDF(ctx context.Context, invoiceNumber int, language string) (*bytes.Buffer, error)

func (*InvoicesService) List

func (*InvoicesService) ListAccount

func (m *InvoicesService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

func (*InvoicesService) MarkFailed

func (m *InvoicesService) MarkFailed(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)

func (*InvoicesService) MarkPaid

func (m *InvoicesService) MarkPaid(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)

func (*InvoicesService) Preview

func (m *InvoicesService) Preview(ctx context.Context, accountCode string) (*recurly.Invoice, error)

func (*InvoicesService) RecordPayment

func (*InvoicesService) RefundVoidLineItems

func (m *InvoicesService) RefundVoidLineItems(ctx context.Context, invoiceNumber int, refund recurly.InvoiceLineItemsRefund) (*recurly.Invoice, error)

func (*InvoicesService) RefundVoidOpenAmount

func (m *InvoicesService) RefundVoidOpenAmount(ctx context.Context, invoiceNumber int, refund recurly.InvoiceRefund) (*recurly.Invoice, error)

func (*InvoicesService) VoidCreditInvoice

func (m *InvoicesService) VoidCreditInvoice(ctx context.Context, invoiceNumber int) (*recurly.Invoice, error)

type Pager

type Pager struct {
	OnCount      func(ctx context.Context) (int, error)
	CountInvoked bool

	OnNext      func() bool
	NextInvoked bool

	OnCursor      func() string
	CursorInvoked bool

	OnFetch      func(ctx context.Context, dst interface{}) error
	FetchInvoked bool

	OnFetchAll      func(ctx context.Context, dst interface{}) error
	FetchAllInvoked bool
}

func (*Pager) Count

func (m *Pager) Count(ctx context.Context) (int, error)

func (*Pager) Cursor

func (m *Pager) Cursor() string

func (*Pager) Fetch

func (m *Pager) Fetch(ctx context.Context, dst interface{}) error

func (*Pager) FetchAll

func (m *Pager) FetchAll(ctx context.Context, dst interface{}) error

func (*Pager) Next

func (m *Pager) Next() bool

type PlansService

type PlansService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnGet      func(ctx context.Context, code string) (*recurly.Plan, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, p recurly.Plan) (*recurly.Plan, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, code string, p recurly.Plan) (*recurly.Plan, error)
	UpdateInvoked bool

	OnDelete      func(ctx context.Context, code string) error
	DeleteInvoked bool
}

PlansService manages the interactions for plans.

func (*PlansService) Create

func (m *PlansService) Create(ctx context.Context, p recurly.Plan) (*recurly.Plan, error)

func (*PlansService) Delete

func (m *PlansService) Delete(ctx context.Context, code string) error

func (*PlansService) Get

func (m *PlansService) Get(ctx context.Context, code string) (*recurly.Plan, error)

func (*PlansService) List

func (*PlansService) Update

func (m *PlansService) Update(ctx context.Context, code string, p recurly.Plan) (*recurly.Plan, error)

type PurchasesService

type PurchasesService struct {
	OnCreate      func(ctx context.Context, p recurly.Purchase) (*recurly.InvoiceCollection, error)
	CreateInvoked bool

	OnPreview      func(ctx context.Context, p recurly.Purchase) (*recurly.InvoiceCollection, error)
	PreviewInvoked bool

	OnAuthorize      func(ctx context.Context, p recurly.Purchase) (*recurly.Purchase, error)
	AuthorizeInvoked bool

	OnPending      func(ctx context.Context, p recurly.Purchase) (*recurly.Purchase, error)
	PendingInvoked bool

	OnCapture      func(ctx context.Context, transactionUUID string) (*recurly.InvoiceCollection, error)
	CaptureInvoked bool

	OnCancel      func(ctx context.Context, transactionUUID string) (*recurly.InvoiceCollection, error)
	CancelInvoked bool
}

func (*PurchasesService) Authorize

func (*PurchasesService) Cancel

func (m *PurchasesService) Cancel(ctx context.Context, transactionUUID string) (*recurly.InvoiceCollection, error)

func (*PurchasesService) Capture

func (m *PurchasesService) Capture(ctx context.Context, transactionUUID string) (*recurly.InvoiceCollection, error)

func (*PurchasesService) Create

func (*PurchasesService) Pending

func (*PurchasesService) Preview

type RedemptionsService

type RedemptionsService struct {
	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnListInvoice      func(invoiceNumber int, opts *recurly.PagerOptions) recurly.Pager
	ListInvoiceInvoked bool

	OnListSubscription      func(uuid string, opts *recurly.PagerOptions) recurly.Pager
	ListSubscriptionInvoked bool

	OnRedeem      func(ctx context.Context, code string, r recurly.CouponRedemption) (*recurly.Redemption, error)
	RedeemInvoked bool

	OnDelete      func(ctx context.Context, accountCode, couponCode string) error
	DeleteInvoked bool
}

RedemptionsService manages the interactions for redemptions.

func (*RedemptionsService) Delete

func (m *RedemptionsService) Delete(ctx context.Context, accountCode, couponCode string) error

func (*RedemptionsService) ListAccount

func (m *RedemptionsService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

func (*RedemptionsService) ListInvoice

func (m *RedemptionsService) ListInvoice(invoiceNumber int, opts *recurly.PagerOptions) recurly.Pager

func (*RedemptionsService) ListSubscription

func (m *RedemptionsService) ListSubscription(uuid string, opts *recurly.PagerOptions) recurly.Pager

func (*RedemptionsService) Redeem

type ShippingAddressesService

type ShippingAddressesService struct {
	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnCreate      func(ctx context.Context, accountCode string, address recurly.ShippingAddress) (*recurly.ShippingAddress, error)
	CreateInvoked bool

	OnUpdate      func(ctx context.Context, accountCode string, shippingAddressID int, address recurly.ShippingAddress) (*recurly.ShippingAddress, error)
	UpdateInvoked bool

	OnDelete      func(ctx context.Context, accountCode string, shippingAddressID int) error
	DeleteInvoked bool
}

func (*ShippingAddressesService) Create

func (*ShippingAddressesService) Delete

func (s *ShippingAddressesService) Delete(ctx context.Context, accountCode string, shippingAddressID int) error

func (*ShippingAddressesService) ListAccount

func (s *ShippingAddressesService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

func (*ShippingAddressesService) Update

func (s *ShippingAddressesService) Update(ctx context.Context, accountCode string, shippingAddressID int, address recurly.ShippingAddress) (*recurly.ShippingAddress, error)

type ShippingMethodsService

type ShippingMethodsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnGet      func(ctx context.Context, code string) (*recurly.ShippingMethod, error)
	GetInvoked bool
}

func (*ShippingMethodsService) Get

func (*ShippingMethodsService) List

type SubscriptionsService

type SubscriptionsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnGet      func(ctx context.Context, uuid string) (*recurly.Subscription, error)
	GetInvoked bool

	OnCreate      func(ctx context.Context, sub recurly.NewSubscription) (*recurly.Subscription, error)
	CreateInvoked bool

	OnPreview      func(ctx context.Context, sub recurly.NewSubscription) (*recurly.Subscription, error)
	PreviewInvoked bool

	OnUpdate      func(ctx context.Context, uuid string, sub recurly.UpdateSubscription) (*recurly.Subscription, error)
	UpdateInvoked bool

	OnUpdateNotes      func(ctx context.Context, uuid string, n recurly.SubscriptionNotes) (*recurly.Subscription, error)
	UpdateNotesInvoked bool

	OnPreviewChange      func(ctx context.Context, uuid string, sub recurly.UpdateSubscription) (*recurly.Subscription, error)
	PreviewChangeInvoked bool

	OnCancel      func(ctx context.Context, uuid string) (*recurly.Subscription, error)
	CancelInvoked bool

	OnReactivate      func(ctx context.Context, uuid string) (*recurly.Subscription, error)
	ReactivateInvoked bool

	OnTerminate      func(ctx context.Context, uuid string, refundType string) (*recurly.Subscription, error)
	TerminateInvoked bool

	OnPostpone      func(ctx context.Context, uuid string, dt time.Time, bulk bool) (*recurly.Subscription, error)
	PostponeInvoked bool

	OnPause      func(ctx context.Context, uuid string, cycles int) (*recurly.Subscription, error)
	PauseInvoked bool

	OnResume      func(ctx context.Context, uuid string) (*recurly.Subscription, error)
	ResumeInvoked bool
}

SubscriptionsService mocks the subscription service.

func (*SubscriptionsService) Cancel

func (*SubscriptionsService) Create

func (*SubscriptionsService) Get

func (*SubscriptionsService) List

func (*SubscriptionsService) ListAccount

func (m *SubscriptionsService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

func (*SubscriptionsService) Pause

func (m *SubscriptionsService) Pause(ctx context.Context, uuid string, cycles int) (*recurly.Subscription, error)

func (*SubscriptionsService) Postpone

func (m *SubscriptionsService) Postpone(ctx context.Context, uuid string, dt time.Time, bulk bool) (*recurly.Subscription, error)

func (*SubscriptionsService) Preview

func (*SubscriptionsService) PreviewChange

func (*SubscriptionsService) Reactivate

func (m *SubscriptionsService) Reactivate(ctx context.Context, uuid string) (*recurly.Subscription, error)

func (*SubscriptionsService) Resume

func (*SubscriptionsService) Terminate

func (m *SubscriptionsService) Terminate(ctx context.Context, uuid string, refundType string) (*recurly.Subscription, error)

func (*SubscriptionsService) Update

func (*SubscriptionsService) UpdateNotes

type TransactionsService

type TransactionsService struct {
	OnList      func(opts *recurly.PagerOptions) recurly.Pager
	ListInvoked bool

	OnListAccount      func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
	ListAccountInvoked bool

	OnGet      func(ctx context.Context, uuid string) (*recurly.Transaction, error)
	GetInvoked bool
}

TransactionsService mocks the transaction service.

func (*TransactionsService) Get

func (*TransactionsService) List

func (*TransactionsService) ListAccount

func (m *TransactionsService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager

Jump to

Keyboard shortcuts

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