samples

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var List = map[string]*SampleData{
	"adding-sales-tax":                 addingSalesTax,
	"checkout-subscription-and-add-on": checkoutSubscriptionAndAddOn,
	"placing-a-hold":                   placingAHold,
	"payment-form-modal":               paymentFormModal,
	"saving-card-without-payment":      savingCardWithoutPayment,
	"checkout-one-time-payments":       checkoutOneTimePayments,
	"checkout-single-subscription":     checkoutSingleSubscription,
	"accept-a-card-payment":            cardPayment,
	"saving-card-after-payment":        savingCardAfterPayment,
	"react-elements-card-payment":      reactElementsCardPayment,
	"card-payment-charges-api":         cardPaymentCharges,
	"multiple-plan-subscriptions":      multiPlanSubscriptions,
	"set-up-subscriptions":             singleSubscription,
	"web-elements-sepa-debit-payment":  sepaPayment,
	"web-elements-ideal-payment":       idealPayment,
	"web-elements-fpx-payment":         fpxPayment,
	"charging-a-saved-card":            chargingSavedCard,
}

List contains a mapping of Stripe Samples that we want to be available in the CLI to some of their metadata TODO: what do we want to name these for it to be easier for users to select?

Functions

func Names

func Names() []string

Names returns a list of all the sample's names

Types

type SampleData

type SampleData struct {
	Name        string
	URL         string
	Description string
}

SampleData stores the information needed for Stripe Samples to operate in the CLI

func (*SampleData) BoldName

func (sd *SampleData) BoldName() string

BoldName returns an ansi bold string for the name

func (*SampleData) GitRepo

func (sd *SampleData) GitRepo() string

GitRepo returns a string of the repo with the .git prefix

type Samples

type Samples struct {
	Config *config.Config
	Fs     afero.Fs
	Git    g.Interface
	// contains filtered or unexported fields
}

Samples stores the information for the selected sample in addition to the selected configuration option to copy over

func (*Samples) Cleanup added in v0.6.1

func (s *Samples) Cleanup(name string) error

Cleanup performs cleanup for the recently created sample

func (*Samples) ConfigureDotEnv

func (s *Samples) ConfigureDotEnv(sampleLocation string) error

ConfigureDotEnv takes the .env.example from the provided location and modifies it to automatically configure it for the users settings

func (*Samples) Copy

func (s *Samples) Copy(target string) error

Copy will copy all of the files from the selected configuration above oves. This has a few different behaviors, depending on the configuration. Ultimately, we want the user to do as minimal of folder traversing as possible. What we want to end up with is:

|- example-sample/ +-- client/ +-- server/ +-- readme.md +-- ... `-- .env.example

The behavior here is:

  • If there are no integrations available, copy the top-level files, the client folder, and the selected language inside of the server folder to the server top-level (example above)
  • If the user selects an integration, mirror the structure above for the selected integration (example above)

func (*Samples) DeleteCache added in v1.2.3

func (s *Samples) DeleteCache(sample string) error

DeleteCache forces the local sample cache to refresh in case something goes awry during the initial clone or to clean out stale samples

func (*Samples) GetFiles

func (s *Samples) GetFiles(path string) ([]string, error)

GetFiles returns a list of files for a given path

func (*Samples) GetFolders

func (s *Samples) GetFolders(path string) ([]string, error)

GetFolders returns a list of all folders for a given path

func (*Samples) Initialize

func (s *Samples) Initialize(app string) error

Initialize get the sample ready for the user to copy. It: 1. creates the sample cache folder if it doesn't exist 2. store the path of the locale cache folder for later use 3. if the selected app does not exist in the local cache folder, clone it 4. if the selected app does exist in the local cache folder, pull changes 5. parse the sample cli config file

func (*Samples) MakeFolder

func (s *Samples) MakeFolder(name string) (string, error)

MakeFolder creates the folder that'll contain the Stripe app the user is creating

func (*Samples) PostInstall added in v0.8.4

func (s *Samples) PostInstall() string

PostInstall returns any installation for post installation instructions

func (*Samples) SelectOptions

func (s *Samples) SelectOptions() error

SelectOptions prompts the user to select the integration they want to use (if available) and the language they want the integration to be.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳