requests

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Cmd *cobra.Command

	Method  string
	Profile *config.Profile

	Parameters RequestParameters

	// SuppressOutput is used by `trigger` to hide output
	SuppressOutput bool

	DarkStyle bool

	APIBaseURL string

	Livemode bool
	// contains filtered or unexported fields
}

Base encapsulates the required information needed to make requests to the API

func (*Base) InitFlags

func (rb *Base) InitFlags(includeData bool)

InitFlags initialize shared flags for all requests commands

func (*Base) MakeRequest

func (rb *Base) MakeRequest(apiKey, path string, params *RequestParameters, errOnStatus bool) ([]byte, error)

MakeRequest will make a request to the Stripe API with the specific variables given to it

func (*Base) RunRequestsCmd

func (rb *Base) RunRequestsCmd(cmd *cobra.Command, args []string) error

RunRequestsCmd is the interface exposed for the CLI to run network requests through

type Examples

type Examples struct {
	Profile    config.Profile
	APIBaseURL string
	APIVersion string
	APIKey     string
}

Examples stores possible webhook test events to trigger for the CLI

func (*Examples) ChargeCaptured

func (ex *Examples) ChargeCaptured() error

ChargeCaptured first creates a charge that is not captured, then sends another request to specifically capture it to trigger the captured event

func (*Examples) ChargeDisputed added in v0.6.8

func (ex *Examples) ChargeDisputed() error

ChargeDisputed creates a charge that becomes disputed

func (*Examples) ChargeFailed

func (ex *Examples) ChargeFailed() error

ChargeFailed fails to create a charge

func (*Examples) ChargeRefunded added in v0.6.8

func (ex *Examples) ChargeRefunded() error

ChargeRefunded creates a charge, then refunds it

func (*Examples) ChargeSucceeded

func (ex *Examples) ChargeSucceeded() error

ChargeSucceeded successfully creates a charge

func (*Examples) CheckoutSessionCompleted added in v0.6.10

func (ex *Examples) CheckoutSessionCompleted() error

CheckoutSessionCompleted creates and completes a Checkout session https://stripe.com/docs/api/checkout/sessions/create?lang=curl

func (*Examples) CustomerCreated

func (ex *Examples) CustomerCreated() error

CustomerCreated creates a new customer

func (*Examples) CustomerDeleted added in v0.6.8

func (ex *Examples) CustomerDeleted() error

CustomerDeleted creates a customer, then deletes it

func (*Examples) CustomerSourceCreated

func (ex *Examples) CustomerSourceCreated() error

CustomerSourceCreated creates a customer and a token then attaches the card to the customer

func (*Examples) CustomerSourceUpdated

func (ex *Examples) CustomerSourceUpdated() error

CustomerSourceUpdated creates a customer, adds a card, adds metadata to the card to trigger an update

func (*Examples) CustomerSubscriptionDeleted added in v0.6.8

func (ex *Examples) CustomerSubscriptionDeleted() error

CustomerSubscriptionDeleted creates a customer with a card, creates a plan, adds the customer to the plan, then deletes it

func (*Examples) CustomerSubscriptionUpdated

func (ex *Examples) CustomerSubscriptionUpdated() error

CustomerSubscriptionUpdated creates a customer with a card, creates a plan, adds the customer to the plan, then updates the new subscription

func (*Examples) CustomerUpdated

func (ex *Examples) CustomerUpdated() error

CustomerUpdated creates a new customer and adds metadata to trigger an update event

func (*Examples) InvoiceCreated

func (ex *Examples) InvoiceCreated() error

InvoiceCreated first creates a customer, adds an invoice item, then creates an invoice.

func (*Examples) InvoiceFinalized

func (ex *Examples) InvoiceFinalized() error

InvoiceFinalized first creates a customer, adds an invoice item, creates an invoice, and then finalizes the invoice.

func (*Examples) InvoicePaymentFailed added in v0.6.8

func (ex *Examples) InvoicePaymentFailed() error

InvoicePaymentFailed first creates a customer, adds an invoice item, creates the invoice, and then fails the payment

func (*Examples) InvoicePaymentSucceeded

func (ex *Examples) InvoicePaymentSucceeded() error

InvoicePaymentSucceeded first creates a customer, adds an invoice item, creates the invoice, and then pays the invoice

func (*Examples) InvoiceUpdated

func (ex *Examples) InvoiceUpdated() error

InvoiceUpdated first creates a customer, adds an invoice item, creates the invoice, then adds metadata to the invoice to trigger an update

func (*Examples) PaymentIntentCreated

func (ex *Examples) PaymentIntentCreated() error

PaymentIntentCreated creates a payment intent. Requires the data to be assigned to the payment intent

func (*Examples) PaymentIntentFailed

func (ex *Examples) PaymentIntentFailed() error

PaymentIntentFailed creates a failed payment intent

func (*Examples) PaymentIntentSucceeded

func (ex *Examples) PaymentIntentSucceeded() error

PaymentIntentSucceeded creates a successful payment intent

func (*Examples) PaymentMethodAttached

func (ex *Examples) PaymentMethodAttached() error

PaymentMethodAttached creates a customer and payment method, then attaches the customer to the payment method

func (*Examples) ResendEvent added in v0.6.7

func (ex *Examples) ResendEvent(id string) error

ResendEvent resends a webhook event using it's event-id "evt_<id>"

func (*Examples) WebhookEndpointsList

func (ex *Examples) WebhookEndpointsList() WebhookEndpointList

WebhookEndpointsList returns all the webhook endpoints on a users' account

type RequestParameters added in v0.2.1

type RequestParameters struct {
	// contains filtered or unexported fields
}

RequestParameters captures the structure of the parameters that can be sent to Stripe

func (*RequestParameters) AppendData added in v0.5.0

func (r *RequestParameters) AppendData(data []string)

AppendData appends data to the request parameters.

type WebhookEndpoint

type WebhookEndpoint struct {
	Application   string   `json:"application"`
	EnabledEvents []string `json:"enabled_events"`
	URL           string   `json:"url"`
}

WebhookEndpoint contains the data for each webhook endpoint

type WebhookEndpointList

type WebhookEndpointList struct {
	Data []WebhookEndpoint `json:"data"`
}

WebhookEndpointList contains the list of webhook endpoints for the account

Jump to

Keyboard shortcuts

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