Open platform to collect and prioritize feedback
feature: add stripe cards (#713)
Guilherme Oenning454ab70734c2
diff --git a/Gopkg.lock b/Gopkg.lockindex 52bda64ef..54851ac99 100644--- a/Gopkg.lock+++ b/Gopkg.lock@@ -154,6 +154,75 @@revision = "05f3235734ad95d0016f6a23902f06461fcf567a"version = "v1.5.2"+[[projects]]+ digest = "1:a6e5980ac8988d88107a4b1f48359f080d021b218b9985bd443e24614ef1b66b"+ name = "github.com/stripe/stripe-go"+ packages = [+ ".",+ "account",+ "applepaydomain",+ "balance",+ "bankaccount",+ "bitcoinreceiver",+ "bitcointransaction",+ "card",+ "charge",+ "client",+ "countryspec",+ "coupon",+ "customer",+ "discount",+ "dispute",+ "ephemeralkey",+ "event",+ "exchangerate",+ "fee",+ "feerefund",+ "file",+ "filelink",+ "form",+ "invoice",+ "invoiceitem",+ "issuerfraudrecord",+ "issuing/authorization",+ "issuing/card",+ "issuing/cardholder",+ "issuing/dispute",+ "issuing/transaction",+ "loginlink",+ "order",+ "orderreturn",+ "paymentintent",+ "paymentsource",+ "payout",+ "plan",+ "product",+ "radar/valuelist",+ "radar/valuelistitem",+ "recipient",+ "refund",+ "reporting/reportrun",+ "reporting/reporttype",+ "reversal",+ "sigma/scheduledqueryrun",+ "sku",+ "source",+ "sourcetransaction",+ "sub",+ "subitem",+ "terminal/connectiontoken",+ "terminal/location",+ "terminal/reader",+ "token",+ "topup",+ "transfer",+ "usagerecord",+ "webhookendpoint",+ ]+ pruneopts = "UT"+ revision = "4fbb4e51a1551a48d073b9900bc6a3d43892646a"+ version = "v55.3.0"+[[projects]]branch = "master"digest = "1:e3d2db9bc633f4635e6418caf0b0734c43821ecd59105d1798458c6ae4d227fd"@@ -239,6 +308,8 @@"github.com/lib/pq","github.com/patrickmn/go-cache","github.com/russross/blackfriday",+ "github.com/stripe/stripe-go",+ "github.com/stripe/stripe-go/client","golang.org/x/crypto/acme","golang.org/x/crypto/acme/autocert","golang.org/x/image/draw",diff --git a/Gopkg.toml b/Gopkg.tomlindex b9f52ba21..5354151c5 100644--- a/Gopkg.toml+++ b/Gopkg.toml@@ -45,6 +45,10 @@ ignored = ["github.com/magefile/mage/mg","github.com/magefile/mage/sh"]version = "v1.16.11"name = "github.com/aws/aws-sdk-go"+[[constraint]]+ version = "v55.3.0"+ name = "github.com/stripe/stripe-go"+[[constraint]]version = "v1.5.0"name = "github.com/disintegration/imaging"diff --git a/app/actions/actions_test.go b/app/actions/actions_test.goindex ae4b82fe7..9ffebce51 100644--- a/app/actions/actions_test.go+++ b/app/actions/actions_test.go@@ -3,6 +3,7 @@ package actions_testimport ("github.com/getfider/fider/app". "github.com/getfider/fider/app/pkg/assert"+ "github.com/getfider/fider/app/pkg/billing""github.com/getfider/fider/app/pkg/blob/fs""github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/jwt"@@ -24,6 +25,7 @@ var services = &app.Services{Tags: inmemory.NewTagStorage(),Notifications: inmemory.NewNotificationStorage(),Blobs: fs.NewStorage(env.Path("tmp")),+ Billing: billing.NewClient(),}func ExpectFailed(result *validate.Result, expectedFields ...string) {diff --git a/app/actions/billing.go b/app/actions/billing.gonew file mode 100644index 000000000..8672b057b--- /dev/null+++ b/app/actions/billing.go@@ -0,0 +1,100 @@+package actions++import (+ "fmt"++ "github.com/getfider/fider/app"+ "github.com/getfider/fider/app/models"+ "github.com/getfider/fider/app/pkg/validate"+)++// CreateEditBillingPaymentInfo is used to create/edit billing payment info+type CreateEditBillingPaymentInfo struct {+ Model *models.CreateEditBillingPaymentInfo+}++// Initialize the model+func (input *CreateEditBillingPaymentInfo) Initialize() interface{} {+ input.Model = new(models.CreateEditBillingPaymentInfo)+ return input.Model+}++// IsAuthorized returns true if current user is authorized to perform this action+func (input *CreateEditBillingPaymentInfo) IsAuthorized(user *models.User, services *app.Services) bool {+ return user != nil && user.IsAdministrator()+}++// Validate is current model is valid+func (input *CreateEditBillingPaymentInfo) Validate(user *models.User, services *app.Services) *validate.Result {+ result := validate.Success()++ if input.Model.Name == "" {+ result.AddFieldFailure("name", "Name is required.")+ }++ if input.Model.Email == "" {+ result.AddFieldFailure("email", "Email is required")+ } else {+ messages := validate.Email(input.Model.Email)+ if len(messages) > 0 {+ result.AddFieldFailure("email", messages...)+ }+ }++ if input.Model.AddressLine1 == "" {+ result.AddFieldFailure("addressLine1", "Address Line 1 is required.")+ }++ if input.Model.AddressLine2 == "" {+ result.AddFieldFailure("addressLine2", "Address Line 2 is required.")+ }++ if input.Model.AddressCity == "" {+ result.AddFieldFailure("addressCity", "City is required.")+ }++ if input.Model.AddressState == "" {+ result.AddFieldFailure("addressState", "State/Region is required.")+ }++ if input.Model.AddressPostalCode == "" {+ result.AddFieldFailure("addressPostalCode", "Postal Code is required.")+ }++ current, err := services.Billing.GetPaymentInfo()++ isNew := current == nil+ isUpdate := current != nil && input.Model.Card == nil+ isReplacing := current != nil && input.Model.Card != nil++ if err != nil {+ return validate.Error(err)+ }++ if (isNew || isReplacing) && (input.Model.Card == nil || input.Model.Card.Token == "") {+ result.AddFieldFailure("card", "Card information is required.")+ }++ if input.Model.AddressCountry == "" {+ result.AddFieldFailure("addressCountry", "Country is required.")+ } else {+ countries := models.GetAllCountries()+ found := false+ for _, c := range countries {+ if c.Code == input.Model.AddressCountry {+ found = true+ }+ }+ if !found {+ result.AddFieldFailure("addressCountry", fmt.Sprintf("'%s' is not a valid country code.", input.Model.AddressCountry))+ }++ if (isNew || isReplacing) && input.Model.Card != nil && input.Model.AddressCountry != input.Model.Card.Country {+ result.AddFieldFailure("addressCountry", "Country that doesn't match with card issue country.")+ } else if isUpdate && input.Model.AddressCountry != current.CardCountry {+ result.AddFieldFailure("addressCountry", "Country that doesn't match with card issue country.")+ }+ }++ return result+}diff --git a/app/actions/billing_test.go b/app/actions/billing_test.gonew file mode 100644index 000000000..87dc30e44--- /dev/null+++ b/app/actions/billing_test.go@@ -0,0 +1,79 @@+package actions_test++import (+ "testing"++ "github.com/getfider/fider/app/actions"+ "github.com/getfider/fider/app/models"+ . "github.com/getfider/fider/app/pkg/assert"+)++func TestCreateEditBillingPaymentInfo_InvalidInput(t *testing.T) {+ RegisterT(t)++ testCases := []struct {+ expected []string+ input *models.CreateEditBillingPaymentInfo+ }{+ {+ expected: []string{"card", "name", "email", "addressLine1", "addressLine2", "addressCity", "addressState", "addressPostalCode", "addressCountry"},+ input: &models.CreateEditBillingPaymentInfo{},+ },+ {+ expected: []string{"card", "email", "addressCity", "addressState", "addressPostalCode", "addressCountry"},+ input: &models.CreateEditBillingPaymentInfo{+ Name: "John",+ AddressLine1: "Street 1",+ AddressLine2: "Street 2",+ Email: "jo@a",+ AddressCountry: "PP",+ },+ },+ {+ expected: []string{"card", "email", "addressCity", "addressState", "addressPostalCode", "addressCountry"},+ input: &models.CreateEditBillingPaymentInfo{+ Name: "John",+ AddressLine1: "Street 1",+ AddressLine2: "Street 2",+ Email: "jo@a",+ AddressCountry: "US",+ Card: &models.CreateEditBillingPaymentInfoCard{+ Country: "IE",+ },+ },+ },+ }++ for _, testCase := range testCases {+ action := &actions.CreateEditBillingPaymentInfo{+ Model: testCase.input,+ }+ services.Billing.SetCurrentTenant(&models.Tenant{ID: 2})+ result := action.Validate(nil, services)+ ExpectFailed(result, testCase.expected...)+ }+}++func TestCreateEditBillingPaymentInfo_ValidInput(t *testing.T) {+ RegisterT(t)++ action := &actions.CreateEditBillingPaymentInfo{+ Model: &models.CreateEditBillingPaymentInfo{+ Name: "Jon Snow",+ AddressLine1: "Street 1",+ AddressLine2: "Street 2",+ AddressCity: "New York",+ AddressPostalCode: "12345",+ AddressState: "NY",+ Email: "[email protected]",+ AddressCountry: "US",+ Card: &models.CreateEditBillingPaymentInfoCard{+ Token: "tok_visa",+ Country: "US",+ },+ },+ }+ services.Billing.SetCurrentTenant(&models.Tenant{ID: 2})+ result := action.Validate(nil, services)+ ExpectSuccess(result)+}diff --git a/app/cmd/routes.go b/app/cmd/routes.goindex c4cf5b3b7..4a8c3f9ce 100644--- a/app/cmd/routes.go+++ b/app/cmd/routes.go@@ -150,6 +150,7 @@ func routes(r *web.Engine) *web.Engine {ui.Get("/admin/billing", handlers.BillingPage())ui.Get("/admin/export", handlers.Page("Export · Site Settings", "", "Export.page"))ui.Get("/admin/export/posts.csv", handlers.ExportPostsToCSV())+ ui.Post("/_api/admin/billing/paymentinfo", handlers.UpdatePaymentInfo())ui.Post("/_api/admin/settings/general", handlers.UpdateSettings())ui.Post("/_api/admin/settings/advanced", handlers.UpdateAdvancedSettings())ui.Post("/_api/admin/settings/privacy", handlers.UpdatePrivacy())diff --git a/app/handlers/billing.go b/app/handlers/billing.goindex 93137e066..5b170b2c1 100644--- a/app/handlers/billing.go+++ b/app/handlers/billing.go@@ -1,6 +1,8 @@package handlersimport (+ "github.com/getfider/fider/app/actions"+ "github.com/getfider/fider/app/models""github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/web")@@ -12,9 +14,62 @@ func BillingPage() web.HandlerFunc {return c.Redirect(c.BaseURL())}+ err := ensureStripeCustomerID(c)+ if err != nil {+ return c.Failure(err)+ }++ paymentInfo, err := c.Services().Billing.GetPaymentInfo()+ if err != nil {+ return c.Failure(err)+ }+return c.Page(web.Props{Title: "Billing · Site Settings",ChunkName: "Billing.page",+ Data: web.Map{+ "paymentInfo": paymentInfo,+ "countries": models.GetAllCountries(),+ },})}}++// UpdatePaymentInfo on stripe based on given input+func UpdatePaymentInfo() web.HandlerFunc {+ return func(c web.Context) error {+ if c.Tenant().Billing == nil {+ return c.Unauthorized()+ }++ input := new(actions.CreateEditBillingPaymentInfo)+ if result := c.BindTo(input); !result.Ok {+ return c.HandleValidation(result)+ }++ err := c.Services().Billing.UpdatePaymentInfo(input.Model)+ if err != nil {+ return c.Failure(err)+ }++ return c.Ok(web.Map{})+ }+}++func ensureStripeCustomerID(c web.Context) error {+ billing := c.Tenant().Billing+ if billing.StripeCustomerID == "" {+ customerID, err := c.Services().Billing.CreateCustomer("")+ if err != nil {+ return err+ }++ billing.StripeCustomerID = customerID+ err = c.Services().Tenants.UpdateBillingSettings(billing)+ if err != nil {+ return err+ }+ }++ return nil+}diff --git a/app/middlewares/security_test.go b/app/middlewares/security_test.goindex b94f4be90..f13b727f5 100644--- a/app/middlewares/security_test.go+++ b/app/middlewares/security_test.go@@ -23,7 +23,7 @@ func TestSecureWithoutCDN(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com ; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com ; img-src 'self' https: data: ; font-src 'self' https://fonts.gstatic.com data: ; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://js.stripe.com ; frame-src 'self' https://js.stripe.com"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)@@ -46,7 +46,7 @@ func TestSecureWithCDN(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com *.test.fider.io"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com *.test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com *.test.fider.io; img-src 'self' https: data: *.test.fider.io; font-src 'self' https://fonts.gstatic.com data: *.test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://js.stripe.com *.test.fider.io; frame-src 'self' https://js.stripe.com"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)@@ -69,7 +69,7 @@ func TestSecureWithCDN_SingleHost(t *testing.T) {return c.NoContent(http.StatusOK)})- expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com test.fider.io"+ expectedPolicy := "base-uri 'self'; default-src 'self'; style-src 'self' 'nonce-" + ctxID + "' https://fonts.googleapis.com test.fider.io; script-src 'self' 'nonce-" + ctxID + "' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com test.fider.io; img-src 'self' https: data: test.fider.io; font-src 'self' https://fonts.gstatic.com data: test.fider.io; object-src 'none'; media-src 'none'; connect-src 'self' https://www.google-analytics.com https://js.stripe.com test.fider.io; frame-src 'self' https://js.stripe.com"Expect(status).Equals(http.StatusOK)Expect(response.Header().Get("Content-Security-Policy")).Equals(expectedPolicy)diff --git a/app/middlewares/setup.go b/app/middlewares/setup.goindex 634c013a8..11380ad52 100644--- a/app/middlewares/setup.go+++ b/app/middlewares/setup.go@@ -5,6 +5,7 @@ import ("time""github.com/getfider/fider/app"+ "github.com/getfider/fider/app/pkg/billing""github.com/getfider/fider/app/pkg/di""github.com/getfider/fider/app/pkg/log""github.com/getfider/fider/app/pkg/web"@@ -68,6 +69,7 @@ func WorkerSetup() worker.MiddlewareFunc {Notifications: postgres.NewNotificationStorage(trx),Emailer: di.NewEmailer(c.Logger()),Blobs: di.NewBlobStorage(c.Database()),+ Billing: billing.NewClient(),})//Execute the chain@@ -156,6 +158,7 @@ func WebSetup() web.MiddlewareFunc {Notifications: postgres.NewNotificationStorage(trx),Emailer: di.NewEmailer(c.Logger()),Blobs: di.NewBlobStorage(c.Engine().Database()),+ Billing: billing.NewClient(),})//Execute the chaindiff --git a/app/models/billing.go b/app/models/billing.gonew file mode 100644index 000000000..670f2ac62--- /dev/null+++ b/app/models/billing.go@@ -0,0 +1,39 @@+package models++// CreateEditBillingPaymentInfo is the input model to create or edit billing payment info+type CreateEditBillingPaymentInfo struct {+ Name string `json:"name"`+ Email string `json:"email"`+ Card *CreateEditBillingPaymentInfoCard `json:"card"`+ AddressLine1 string `json:"addressLine1"`+ AddressLine2 string `json:"addressLine2"`+ AddressCity string `json:"addressCity"`+ AddressState string `json:"addressState"`+ AddressPostalCode string `json:"addressPostalCode"`+ AddressCountry string `json:"addressCountry" format:"upper"`+}++// CreateEditBillingPaymentInfoCard is the input model for a card during billing payment info update+type CreateEditBillingPaymentInfoCard struct {+ Type string `json:"type"`+ Token string `json:"token"`+ Country string `json:"country"`+}++// PaymentInfo is the model for billing payment info+type PaymentInfo struct {+ StripeCardID string `json:"-"`+ CardCountry string `json:"cardCountry"`+ CardBrand string `json:"cardBrand"`+ CardLast4 string `json:"cardLast4"`+ CardExpMonth uint8 `json:"cardExpMonth"`+ CardExpYear uint16 `json:"cardExpYear"`+ AddressCity string `json:"addressCity"`+ AddressCountry string `json:"addressCountry"`+ Name string `json:"name"`+ Email string `json:"email"`+ AddressLine1 string `json:"addressLine1"`+ AddressLine2 string `json:"addressLine2"`+ AddressState string `json:"addressState"`+ AddressPostalCode string `json:"addressPostalCode"`+}diff --git a/app/models/countries.go b/app/models/countries.gonew file mode 100644index 000000000..5247de066--- /dev/null+++ b/app/models/countries.go@@ -0,0 +1,262 @@+package models++// Country is a valid country within Fider+type Country struct {+ Code string `json:"code"`+ Name string `json:"name"`+}++// GetAllCountries returns a list of all known countries+func GetAllCountries() []*Country {+ return []*Country{+ &Country{Code: "AF", Name: "Afghanistan"},+ &Country{Code: "AX", Name: "Åland Islands"},+ &Country{Code: "AL", Name: "Albania"},+ &Country{Code: "DZ", Name: "Algeria"},+ &Country{Code: "AS", Name: "American Samoa"},+ &Country{Code: "AD", Name: "Andorra"},+ &Country{Code: "AO", Name: "Angola"},+ &Country{Code: "AI", Name: "Anguilla"},+ &Country{Code: "AQ", Name: "Antarctica"},+ &Country{Code: "AG", Name: "Antigua and Barbuda"},+ &Country{Code: "AR", Name: "Argentina"},+ &Country{Code: "AM", Name: "Armenia"},+ &Country{Code: "AW", Name: "Aruba"},+ &Country{Code: "AU", Name: "Australia"},+ &Country{Code: "AT", Name: "Austria"},+ &Country{Code: "AZ", Name: "Azerbaijan"},+ &Country{Code: "BS", Name: "Bahamas"},+ &Country{Code: "BH", Name: "Bahrain"},+ &Country{Code: "BD", Name: "Bangladesh"},+ &Country{Code: "BB", Name: "Barbados"},+ &Country{Code: "BY", Name: "Belarus"},+ &Country{Code: "BE", Name: "Belgium"},+ &Country{Code: "BZ", Name: "Belize"},+ &Country{Code: "BJ", Name: "Benin"},+ &Country{Code: "BM", Name: "Bermuda"},+ &Country{Code: "BT", Name: "Bhutan"},+ &Country{Code: "BO", Name: "Bolivia, Plurinational State of"},+ &Country{Code: "BQ", Name: "Bonaire, Sint Eustatius and Saba"},+ &Country{Code: "BA", Name: "Bosnia and Herzegovina"},+ &Country{Code: "BW", Name: "Botswana"},+ &Country{Code: "BV", Name: "Bouvet Island"},+ &Country{Code: "BR", Name: "Brazil"},+ &Country{Code: "IO", Name: "British Indian Ocean Territory"},+ &Country{Code: "BN", Name: "Brunei Darussalam"},+ &Country{Code: "BG", Name: "Bulgaria"},+ &Country{Code: "BF", Name: "Burkina Faso"},+ &Country{Code: "BI", Name: "Burundi"},+ &Country{Code: "KH", Name: "Cambodia"},+ &Country{Code: "CM", Name: "Cameroon"},+ &Country{Code: "CA", Name: "Canada"},+ &Country{Code: "CV", Name: "Cape Verde"},+ &Country{Code: "KY", Name: "Cayman Islands"},+ &Country{Code: "CF", Name: "Central African Republic"},+ &Country{Code: "TD", Name: "Chad"},+ &Country{Code: "CL", Name: "Chile"},+ &Country{Code: "CN", Name: "China"},+ &Country{Code: "CX", Name: "Christmas Island"},+ &Country{Code: "CC", Name: "Cocos (Keeling) Islands"},+ &Country{Code: "CO", Name: "Colombia"},+ &Country{Code: "KM", Name: "Comoros"},+ &Country{Code: "CG", Name: "Congo"},+ &Country{Code: "CD", Name: "Congo, the Democratic Republic of the"},+ &Country{Code: "CK", Name: "Cook Islands"},+ &Country{Code: "CR", Name: "Costa Rica"},+ &Country{Code: "CI", Name: "Côte d'Ivoire"},+ &Country{Code: "HR", Name: "Croatia"},+ &Country{Code: "CU", Name: "Cuba"},+ &Country{Code: "CW", Name: "Curaçao"},+ &Country{Code: "CY", Name: "Cyprus"},+ &Country{Code: "CZ", Name: "Czech Republic"},+ &Country{Code: "DK", Name: "Denmark"},+ &Country{Code: "DJ", Name: "Djibouti"},+ &Country{Code: "DM", Name: "Dominica"},+ &Country{Code: "DO", Name: "Dominican Republic"},+ &Country{Code: "EC", Name: "Ecuador"},+ &Country{Code: "EG", Name: "Egypt"},+ &Country{Code: "SV", Name: "El Salvador"},+ &Country{Code: "GQ", Name: "Equatorial Guinea"},+ &Country{Code: "ER", Name: "Eritrea"},+ &Country{Code: "EE", Name: "Estonia"},+ &Country{Code: "ET", Name: "Ethiopia"},+ &Country{Code: "FK", Name: "Falkland Islands (Malvinas)"},+ &Country{Code: "FO", Name: "Faroe Islands"},+ &Country{Code: "FJ", Name: "Fiji"},+ &Country{Code: "FI", Name: "Finland"},+ &Country{Code: "FR", Name: "France"},+ &Country{Code: "GF", Name: "French Guiana"},+ &Country{Code: "PF", Name: "French Polynesia"},+ &Country{Code: "TF", Name: "French Southern Territories"},+ &Country{Code: "GA", Name: "Gabon"},+ &Country{Code: "GM", Name: "Gambia"},+ &Country{Code: "GE", Name: "Georgia"},+ &Country{Code: "DE", Name: "Germany"},+ &Country{Code: "GH", Name: "Ghana"},+ &Country{Code: "GI", Name: "Gibraltar"},+ &Country{Code: "GR", Name: "Greece"},+ &Country{Code: "GL", Name: "Greenland"},+ &Country{Code: "GD", Name: "Grenada"},+ &Country{Code: "GP", Name: "Guadeloupe"},+ &Country{Code: "GU", Name: "Guam"},+ &Country{Code: "GT", Name: "Guatemala"},+ &Country{Code: "GG", Name: "Guernsey"},+ &Country{Code: "GN", Name: "Guinea"},+ &Country{Code: "GW", Name: "Guinea-Bissau"},+ &Country{Code: "GY", Name: "Guyana"},+ &Country{Code: "HT", Name: "Haiti"},+ &Country{Code: "HM", Name: "Heard Island and McDonald Islands"},+ &Country{Code: "VA", Name: "Holy See (Vatican City State)"},+ &Country{Code: "HN", Name: "Honduras"},+ &Country{Code: "HK", Name: "Hong Kong"},+ &Country{Code: "HU", Name: "Hungary"},+ &Country{Code: "IS", Name: "Iceland"},+ &Country{Code: "IN", Name: "India"},+ &Country{Code: "ID", Name: "Indonesia"},+ &Country{Code: "IR", Name: "Iran, Islamic Republic of"},+ &Country{Code: "IQ", Name: "Iraq"},+ &Country{Code: "IE", Name: "Ireland"},+ &Country{Code: "IM", Name: "Isle of Man"},+ &Country{Code: "IL", Name: "Israel"},+ &Country{Code: "IT", Name: "Italy"},+ &Country{Code: "JM", Name: "Jamaica"},+ &Country{Code: "JP", Name: "Japan"},+ &Country{Code: "JE", Name: "Jersey"},+ &Country{Code: "JO", Name: "Jordan"},+ &Country{Code: "KZ", Name: "Kazakhstan"},+ &Country{Code: "KE", Name: "Kenya"},+ &Country{Code: "KI", Name: "Kiribati"},+ &Country{Code: "KP", Name: "Korea, Democratic People's Republic of"},+ &Country{Code: "KR", Name: "Korea, Republic of"},+ &Country{Code: "KW", Name: "Kuwait"},+ &Country{Code: "KG", Name: "Kyrgyzstan"},+ &Country{Code: "LA", Name: "Lao People's Democratic Republic"},+ &Country{Code: "LV", Name: "Latvia"},+ &Country{Code: "LB", Name: "Lebanon"},+ &Country{Code: "LS", Name: "Lesotho"},+ &Country{Code: "LR", Name: "Liberia"},+ &Country{Code: "LY", Name: "Libya"},+ &Country{Code: "LI", Name: "Liechtenstein"},+ &Country{Code: "LT", Name: "Lithuania"},+ &Country{Code: "LU", Name: "Luxembourg"},+ &Country{Code: "MO", Name: "Macao"},+ &Country{Code: "MK", Name: "Macedonia, the former Yugoslav Republic of"},+ &Country{Code: "MG", Name: "Madagascar"},+ &Country{Code: "MW", Name: "Malawi"},+ &Country{Code: "MY", Name: "Malaysia"},+ &Country{Code: "MV", Name: "Maldives"},+ &Country{Code: "ML", Name: "Mali"},+ &Country{Code: "MT", Name: "Malta"},+ &Country{Code: "MH", Name: "Marshall Islands"},+ &Country{Code: "MQ", Name: "Martinique"},+ &Country{Code: "MR", Name: "Mauritania"},+ &Country{Code: "MU", Name: "Mauritius"},+ &Country{Code: "YT", Name: "Mayotte"},+ &Country{Code: "MX", Name: "Mexico"},+ &Country{Code: "FM", Name: "Micronesia, Federated States of"},+ &Country{Code: "MD", Name: "Moldova, Republic of"},+ &Country{Code: "MC", Name: "Monaco"},+ &Country{Code: "MN", Name: "Mongolia"},+ &Country{Code: "ME", Name: "Montenegro"},+ &Country{Code: "MS", Name: "Montserrat"},+ &Country{Code: "MA", Name: "Morocco"},+ &Country{Code: "MZ", Name: "Mozambique"},+ &Country{Code: "MM", Name: "Myanmar"},+ &Country{Code: "NA", Name: "Namibia"},+ &Country{Code: "NR", Name: "Nauru"},+ &Country{Code: "NP", Name: "Nepal"},+ &Country{Code: "NL", Name: "Netherlands"},+ &Country{Code: "NC", Name: "New Caledonia"},+ &Country{Code: "NZ", Name: "New Zealand"},+ &Country{Code: "NI", Name: "Nicaragua"},+ &Country{Code: "NE", Name: "Niger"},+ &Country{Code: "NG", Name: "Nigeria"},+ &Country{Code: "NU", Name: "Niue"},+ &Country{Code: "NF", Name: "Norfolk Island"},+ &Country{Code: "MP", Name: "Northern Mariana Islands"},+ &Country{Code: "NO", Name: "Norway"},+ &Country{Code: "OM", Name: "Oman"},+ &Country{Code: "PK", Name: "Pakistan"},+ &Country{Code: "PW", Name: "Palau"},+ &Country{Code: "PS", Name: "Palestinian Territory, Occupied"},+ &Country{Code: "PA", Name: "Panama"},+ &Country{Code: "PG", Name: "Papua New Guinea"},+ &Country{Code: "PY", Name: "Paraguay"},+ &Country{Code: "PE", Name: "Peru"},+ &Country{Code: "PH", Name: "Philippines"},+ &Country{Code: "PN", Name: "Pitcairn"},+ &Country{Code: "PL", Name: "Poland"},+ &Country{Code: "PT", Name: "Portugal"},+ &Country{Code: "PR", Name: "Puerto Rico"},+ &Country{Code: "QA", Name: "Qatar"},+ &Country{Code: "RE", Name: "Réunion"},+ &Country{Code: "RO", Name: "Romania"},+ &Country{Code: "RU", Name: "Russian Federation"},+ &Country{Code: "RW", Name: "Rwanda"},+ &Country{Code: "BL", Name: "Saint Barthélemy"},+ &Country{Code: "SH", Name: "Saint Helena, Ascension and Tristan da Cunha"},+ &Country{Code: "KN", Name: "Saint Kitts and Nevis"},+ &Country{Code: "LC", Name: "Saint Lucia"},+ &Country{Code: "MF", Name: "Saint Martin (French part)"},+ &Country{Code: "PM", Name: "Saint Pierre and Miquelon"},+ &Country{Code: "VC", Name: "Saint Vincent and the Grenadines"},+ &Country{Code: "WS", Name: "Samoa"},+ &Country{Code: "SM", Name: "San Marino"},+ &Country{Code: "ST", Name: "Sao Tome and Principe"},+ &Country{Code: "SA", Name: "Saudi Arabia"},+ &Country{Code: "SN", Name: "Senegal"},+ &Country{Code: "RS", Name: "Serbia"},+ &Country{Code: "SC", Name: "Seychelles"},+ &Country{Code: "SL", Name: "Sierra Leone"},+ &Country{Code: "SG", Name: "Singapore"},+ &Country{Code: "SX", Name: "Sint Maarten (Dutch part)"},+ &Country{Code: "SK", Name: "Slovakia"},+ &Country{Code: "SI", Name: "Slovenia"},+ &Country{Code: "SB", Name: "Solomon Islands"},+ &Country{Code: "SO", Name: "Somalia"},+ &Country{Code: "ZA", Name: "South Africa"},+ &Country{Code: "GS", Name: "South Georgia and the South Sandwich Islands"},+ &Country{Code: "SS", Name: "South Sudan"},+ &Country{Code: "ES", Name: "Spain"},+ &Country{Code: "LK", Name: "Sri Lanka"},+ &Country{Code: "SD", Name: "Sudan"},+ &Country{Code: "SR", Name: "Suriname"},+ &Country{Code: "SJ", Name: "Svalbard and Jan Mayen"},+ &Country{Code: "SZ", Name: "Swaziland"},+ &Country{Code: "SE", Name: "Sweden"},+ &Country{Code: "CH", Name: "Switzerland"},+ &Country{Code: "SY", Name: "Syrian Arab Republic"},+ &Country{Code: "TW", Name: "Taiwan, Province of China"},+ &Country{Code: "TJ", Name: "Tajikistan"},+ &Country{Code: "TZ", Name: "Tanzania, United Republic of"},+ &Country{Code: "TH", Name: "Thailand"},+ &Country{Code: "TL", Name: "Timor-Leste"},+ &Country{Code: "TG", Name: "Togo"},+ &Country{Code: "TK", Name: "Tokelau"},+ &Country{Code: "TO", Name: "Tonga"},+ &Country{Code: "TT", Name: "Trinidad and Tobago"},+ &Country{Code: "TN", Name: "Tunisia"},+ &Country{Code: "TR", Name: "Turkey"},+ &Country{Code: "TM", Name: "Turkmenistan"},+ &Country{Code: "TC", Name: "Turks and Caicos Islands"},+ &Country{Code: "TV", Name: "Tuvalu"},+ &Country{Code: "UG", Name: "Uganda"},+ &Country{Code: "UA", Name: "Ukraine"},+ &Country{Code: "AE", Name: "United Arab Emirates"},+ &Country{Code: "GB", Name: "United Kingdom"},+ &Country{Code: "US", Name: "United States"},+ &Country{Code: "UM", Name: "United States Minor Outlying Islands"},+ &Country{Code: "UY", Name: "Uruguay"},+ &Country{Code: "UZ", Name: "Uzbekistan"},+ &Country{Code: "VU", Name: "Vanuatu"},+ &Country{Code: "VE", Name: "Venezuela, Bolivarian Republic of"},+ &Country{Code: "VN", Name: "Viet Nam"},+ &Country{Code: "VG", Name: "Virgin Islands, British"},+ &Country{Code: "VI", Name: "Virgin Islands, U.S."},+ &Country{Code: "WF", Name: "Wallis and Futuna"},+ &Country{Code: "EH", Name: "Western Sahara"},+ &Country{Code: "YE", Name: "Yemen"},+ &Country{Code: "ZM", Name: "Zambia"},+ &Country{Code: "ZW", Name: "Zimbabwe"},+ }+}diff --git a/app/models/identity.go b/app/models/identity.goindex f28ce1301..512323d11 100644--- a/app/models/identity.go+++ b/app/models/identity.go@@ -33,7 +33,8 @@ var (//TenantBilling has all the billing information of given tenanttype TenantBilling struct {- TrialEndsAt time.Time `json:"trialEndsAt"`+ StripeCustomerID string+ TrialEndsAt time.Time `json:"trialEndsAt"`}//Upload represents a file that has been uploaded to Fiderdiff --git a/app/pkg/billing/stripe.go b/app/pkg/billing/stripe.gonew file mode 100644index 000000000..8df83c6a7--- /dev/null+++ b/app/pkg/billing/stripe.go@@ -0,0 +1,186 @@+package billing++import (+ "fmt"+ "strconv"++ "github.com/getfider/fider/app/models"+ "github.com/getfider/fider/app/pkg/env"+ "github.com/getfider/fider/app/pkg/errors"+ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/client"+)++var sc *client.API++func init() {+ stripe.LogLevel = 0+ sc = &client.API{}+ sc.Init(env.Config.Stripe.SecretKey, nil)+}++// Client is a billing client wrapper for Stripe+type Client struct {+ sc *client.API+ tenant *models.Tenant+ user *models.User+}++// NewClient creates a new billing client+func NewClient() *Client {+ return &Client{+ sc: sc,+ }+}++// SetCurrentTenant to current context+func (c *Client) SetCurrentTenant(tenant *models.Tenant) {+ c.tenant = tenant+}++// SetCurrentUser to current context+func (c *Client) SetCurrentUser(user *models.User) {+ c.user = user+}++// CreateCustomer on stripe+func (c *Client) CreateCustomer(email string) (string, error) {+ if c.tenant.Billing == nil {+ return "", errors.New("Tenant doesn't have a billing record")+ }++ if c.tenant.Billing.StripeCustomerID == "" {+ params := &stripe.CustomerParams{+ Email: stripe.String(email),+ Description: stripe.String(customerDesc(c.tenant)),+ }+ params.AddMetadata("tenant_id", strconv.Itoa(c.tenant.ID))+ customer, err := c.sc.Customers.New(params)+ if err != nil {+ return "", errors.Wrap(err, "failed to create Stripe customer")+ }+ return customer.ID, nil+ }++ return c.tenant.Billing.StripeCustomerID, nil+}++// GetPaymentInfo from a stripe card+func (c *Client) GetPaymentInfo() (*models.PaymentInfo, error) {+ if c.tenant.Billing == nil || c.tenant.Billing.StripeCustomerID == "" {+ return nil, nil+ }++ customerID := c.tenant.Billing.StripeCustomerID++ customer, err := c.sc.Customers.Get(customerID, &stripe.CustomerParams{})+ if err != nil {+ return nil, errors.Wrap(err, "failed to get customer")+ }++ if customer.Metadata["tenant_id"] != strconv.Itoa(c.tenant.ID) {+ panic(fmt.Sprintf("Stripe TenantID (%s) doesn't match current Tenant ID (%s). Aborting.", customer.Metadata["tenant_id"], strconv.Itoa(c.tenant.ID)))+ }++ if customer.DefaultSource == nil {+ return nil, nil+ }++ card, err := c.sc.Cards.Get(customer.DefaultSource.ID, &stripe.CardParams{+ Customer: stripe.String(customerID),+ })+ if err != nil {+ return nil, errors.Wrap(err, "failed to get customer's card")+ }++ info := &models.PaymentInfo{+ Email: customer.Email,+ Name: card.Name,+ StripeCardID: card.ID,+ CardCountry: card.Country,+ CardBrand: string(card.Brand),+ CardLast4: card.Last4,+ CardExpMonth: card.ExpMonth,+ CardExpYear: card.ExpYear,+ AddressCity: card.AddressCity,+ AddressCountry: card.AddressCountry,+ AddressLine1: card.AddressLine1,+ AddressLine2: card.AddressLine2,+ AddressState: card.AddressState,+ AddressPostalCode: card.AddressZip,+ }++ return info, nil+}++// UpdatePaymentInfo creates or updates customer payment info on stripe+func (c *Client) UpdatePaymentInfo(input *models.CreateEditBillingPaymentInfo) error {+ customerID := c.tenant.Billing.StripeCustomerID+ current, err := c.GetPaymentInfo()+ if err != nil {+ return err+ }++ // email is different, update it+ if current == nil || current.Email != input.Email {+ _, err = c.sc.Customers.Update(customerID, &stripe.CustomerParams{+ Email: stripe.String(input.Email),+ Description: stripe.String(customerDesc(c.tenant)),+ })+ if err != nil {+ return errors.Wrap(err, "failed to update customer billing email")+ }+ }++ // new card, just create it+ if current == nil || current.StripeCardID == "" {+ _, err = c.sc.Cards.New(&stripe.CardParams{+ Customer: stripe.String(customerID),+ Token: stripe.String(input.Card.Token),+ })+ if err != nil {+ return errors.Wrap(err, "failed to create stripe card")+ }+ return nil+ }++ // replacing card, create new and delete old+ if input.Card != nil && input.Card.Token != "" {+ _, err = c.sc.Cards.New(&stripe.CardParams{+ Customer: stripe.String(customerID),+ Token: stripe.String(input.Card.Token),+ })+ if err != nil {+ return errors.Wrap(err, "failed to create new stripe card")+ }++ _, err = c.sc.Cards.Del(current.StripeCardID, &stripe.CardParams{+ Customer: stripe.String(customerID),+ Token: stripe.String(input.Card.Token),+ })+ if err != nil {+ return errors.Wrap(err, "failed to delete old stripe card")+ }+ return nil+ }++ // updating card, just update current card+ _, err = c.sc.Cards.Update(current.StripeCardID, &stripe.CardParams{+ Customer: stripe.String(customerID),+ Name: stripe.String(input.Name),+ AddressCity: stripe.String(input.AddressCity),+ AddressCountry: stripe.String(input.AddressCountry),+ AddressLine1: stripe.String(input.AddressLine1),+ AddressLine2: stripe.String(input.AddressLine2),+ AddressState: stripe.String(input.AddressState),+ AddressZip: stripe.String(input.AddressPostalCode),+ })+ if err != nil {+ return errors.Wrap(err, "failed to update stripe card")+ }+ return nil+}++func customerDesc(tenant *models.Tenant) string {+ return fmt.Sprintf("%s [%s]", tenant.Name, tenant.Subdomain)+}diff --git a/app/pkg/mock/setup.go b/app/pkg/mock/setup.goindex ac4c92b84..a1f358a3e 100644--- a/app/pkg/mock/setup.go+++ b/app/pkg/mock/setup.go@@ -3,6 +3,7 @@ package mockimport ("github.com/getfider/fider/app""github.com/getfider/fider/app/models"+ "github.com/getfider/fider/app/pkg/billing""github.com/getfider/fider/app/pkg/blob/fs""github.com/getfider/fider/app/pkg/email/noop""github.com/getfider/fider/app/pkg/env"@@ -55,6 +56,7 @@ func createServices(seed bool) *app.Services {OAuth: &OAuthService{},Emailer: noop.NewSender(),Blobs: fs.NewStorage(env.Path("tmp")),+ Billing: billing.NewClient(),}if seed {diff --git a/app/pkg/web/engine.go b/app/pkg/web/engine.goindex d2836a320..bc36c08af 100644--- a/app/pkg/web/engine.go+++ b/app/pkg/web/engine.go@@ -27,15 +27,16 @@ var (cspBase = "base-uri 'self'"cspDefault = "default-src 'self'"cspStyle = "style-src 'self' 'nonce-%[1]s' https://fonts.googleapis.com %[2]s"- cspScript = "script-src 'self' 'nonce-%[1]s' https://cdn.polyfill.io https://www.google-analytics.com %[2]s"+ cspScript = "script-src 'self' 'nonce-%[1]s' https://cdn.polyfill.io https://js.stripe.com https://www.google-analytics.com %[2]s"cspFont = "font-src 'self' https://fonts.gstatic.com data: %[2]s"cspImage = "img-src 'self' https: data: %[2]s"cspObject = "object-src 'none'"+ cspFrame = "frame-src 'self' https://js.stripe.com"cspMedia = "media-src 'none'"- cspConnect = "connect-src 'self' https://www.google-analytics.com %[2]s"+ cspConnect = "connect-src 'self' https://www.google-analytics.com https://js.stripe.com %[2]s"//CspPolicyTemplate is the template used to generate the policy- CspPolicyTemplate = fmt.Sprintf("%s; %s; %s; %s; %s; %s; %s; %s; %s", cspBase, cspDefault, cspStyle, cspScript, cspImage, cspFont, cspObject, cspMedia, cspConnect)+ CspPolicyTemplate = fmt.Sprintf("%s; %s; %s; %s; %s; %s; %s; %s; %s; %s", cspBase, cspDefault, cspStyle, cspScript, cspImage, cspFont, cspObject, cspMedia, cspConnect, cspFrame))type notFoundHandler struct {diff --git a/app/services.go b/app/services.goindex 16de55709..134a31861 100644--- a/app/services.go+++ b/app/services.go@@ -2,6 +2,7 @@ package appimport ("github.com/getfider/fider/app/models"+ "github.com/getfider/fider/app/pkg/billing""github.com/getfider/fider/app/pkg/blob""github.com/getfider/fider/app/pkg/email""github.com/getfider/fider/app/pkg/oauth"@@ -18,6 +19,7 @@ type Services struct {Posts storage.PostEmailer email.SenderBlobs blob.Storage+ Billing *billing.Client}// SetCurrentTenant to current context@@ -28,6 +30,7 @@ func (s *Services) SetCurrentTenant(tenant *models.Tenant) {s.Posts.SetCurrentTenant(tenant)s.Notifications.SetCurrentTenant(tenant)s.Blobs.SetCurrentTenant(tenant)+ s.Billing.SetCurrentTenant(tenant)}// SetCurrentUser to current context@@ -37,4 +40,5 @@ func (s *Services) SetCurrentUser(user *models.User) {s.Tenants.SetCurrentUser(user)s.Posts.SetCurrentUser(user)s.Notifications.SetCurrentUser(user)+ s.Billing.SetCurrentUser(user)}diff --git a/app/storage/inmemory/tenant.go b/app/storage/inmemory/tenant.goindex 78633e4ce..8d8cdc888 100644--- a/app/storage/inmemory/tenant.go+++ b/app/storage/inmemory/tenant.go@@ -109,6 +109,12 @@ func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) erreturn nil}+// UpdateBillingSettings of current tenant+func (s *TenantStorage) UpdateBillingSettings(billing *models.TenantBilling) error {+ s.current.Billing = billing+ return nil+}+// UpdateAdvancedSettings of current tenantfunc (s *TenantStorage) UpdateAdvancedSettings(settings *models.UpdateTenantAdvancedSettings) error {for _, tenant := range s.tenants {diff --git a/app/storage/postgres/tenant.go b/app/storage/postgres/tenant.goindex c0e646a51..7c22cfba7 100644--- a/app/storage/postgres/tenant.go+++ b/app/storage/postgres/tenant.go@@ -44,7 +44,8 @@ func (t *dbTenant) toModel() *models.Tenant {if t.Billing != nil && t.Billing.TrialEndsAt.Valid {tenant.Billing = &models.TenantBilling{- TrialEndsAt: t.Billing.TrialEndsAt.Time,+ TrialEndsAt: t.Billing.TrialEndsAt.Time,+ StripeCustomerID: t.Billing.StripeCustomerID.String,}}@@ -52,7 +53,8 @@ func (t *dbTenant) toModel() *models.Tenant {}type dbTenantBilling struct {- TrialEndsAt dbx.NullTime `db:"trial_ends_at"`+ StripeCustomerID dbx.NullString `db:"stripe_customer_id"`+ TrialEndsAt dbx.NullTime `db:"trial_ends_at"`}type dbEmailVerification struct {@@ -184,7 +186,8 @@ func (s *TenantStorage) First() (*models.Tenant, error) {err := s.trx.Get(&tenant, `SELECT t.id, t.name, t.subdomain, t.cname, t.invitation, t.welcome_message, t.status, t.is_private, t.logo_bkey, t.custom_css,- tb.trial_ends_at AS billing_trial_ends_at+ tb.trial_ends_at AS billing_trial_ends_at,+ tb.stripe_customer_id AS billing_stripe_customer_idFROM tenants tLEFT JOIN tenants_billing tbON tb.tenant_id = t.id@@ -203,7 +206,8 @@ func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error) {err := s.trx.Get(&tenant, `SELECT t.id, t.name, t.subdomain, t.cname, t.invitation, t.welcome_message, t.status, t.is_private, t.logo_bkey, t.custom_css,- tb.trial_ends_at AS billing_trial_ends_at+ tb.trial_ends_at AS billing_trial_ends_at,+ tb.stripe_customer_id AS billing_stripe_customer_idFROM tenants tLEFT JOIN tenants_billing tbON tb.tenant_id = t.id@@ -237,6 +241,16 @@ func (s *TenantStorage) UpdateSettings(settings *models.UpdateTenantSettings) erreturn nil}+// UpdateBillingSettings of current tenant+func (s *TenantStorage) UpdateBillingSettings(billing *models.TenantBilling) error {+ query := "UPDATE tenants_billing SET stripe_customer_id = $1 WHERE tenant_id = $2"+ _, err := s.trx.Execute(query, billing.StripeCustomerID, s.current.ID)+ if err != nil {+ return errors.Wrap(err, "failed update tenant billing settings")+ }+ return nil+}+// UpdateAdvancedSettings of current tenantfunc (s *TenantStorage) UpdateAdvancedSettings(settings *models.UpdateTenantAdvancedSettings) error {query := "UPDATE tenants SET custom_css = $1 WHERE id = $2"diff --git a/app/storage/storage.go b/app/storage/storage.goindex 468c28ceb..dc57fb5da 100644--- a/app/storage/storage.go+++ b/app/storage/storage.go@@ -76,6 +76,7 @@ type Tenant interface {Activate(id int) errorGetByDomain(domain string) (*models.Tenant, error)UpdateSettings(settings *models.UpdateTenantSettings) error+ UpdateBillingSettings(billing *models.TenantBilling) errorUpdateAdvancedSettings(settings *models.UpdateTenantAdvancedSettings) errorUpdatePrivacy(settings *models.UpdateTenantPrivacy) errorIsSubdomainAvailable(subdomain string) (bool, error)diff --git a/package-lock.json b/package-lock.jsonindex 751c8d81c..fe0890e43 100644--- a/package-lock.json+++ b/package-lock.json@@ -151,6 +151,16 @@"@types/react": "*"}},+ "@types/react-stripe-elements": {+ "version": "1.1.10",+ "resolved": "https://registry.npmjs.org/@types/react-stripe-elements/-/react-stripe-elements-1.1.10.tgz",+ "integrity": "sha512-FcGRb2Rwolgx6/epqnZ4ZOMHTx6wUBhkVFWWvob46fBBece3cvxCaP/vPFhf3+dUHfQeITCjMEavdB6rrbZFzg==",+ "dev": true,+ "requires": {+ "@types/react": "*",+ "@types/stripe-v3": "*"+ }+ },"@types/react-textarea-autosize": {"version": "4.3.3","resolved": "https://registry.npmjs.org/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.3.tgz",@@ -160,6 +170,12 @@"@types/react": "*"}},+ "@types/stripe-v3": {+ "version": "3.0.9",+ "resolved": "https://registry.npmjs.org/@types/stripe-v3/-/stripe-v3-3.0.9.tgz",+ "integrity": "sha512-4E3XeLo1h8e1Bg8OehIJX/q7OZblmbiDccpT4GlMQosvPyqSAkoE0PGar8/L1jz/ACP5ZqDfZQygDBx6LldGew==",+ "dev": true+ },"@types/tough-cookie": {"version": "2.3.4","resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.4.tgz",@@ -435,14 +451,12 @@"ajv-errors": {"version": "1.0.1","resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",- "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==",- "dev": true+ "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="},"ajv-keywords": {"version": "3.2.0","resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz",- "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=",- "dev": true+ "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo="},"amdefine": {"version": "1.0.1",@@ -1056,8 +1070,7 @@"big.js": {"version": "3.2.0","resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz",- "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==",- "dev": true+ "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q=="},"binary-extensions": {"version": "1.12.0",@@ -2369,8 +2382,7 @@"emojis-list": {"version": "2.1.0","resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",- "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",- "dev": true+ "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k="},"encodeurl": {"version": "1.0.2",@@ -2958,8 +2970,7 @@"fast-json-stable-stringify": {"version": "2.0.0","resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",- "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",- "dev": true+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="},"fast-levenshtein": {"version": "2.0.6",@@ -3006,6 +3017,15 @@"escape-string-regexp": "^1.0.5"}},+ "file-loader": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-3.0.1.tgz",+ "integrity": "sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==",+ "requires": {+ "loader-utils": "^1.0.2",+ "schema-utils": "^1.0.0"+ }+ },"filename-regex": {"version": "2.0.1","resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz",@@ -6332,8 +6352,7 @@"json5": {"version": "0.5.1","resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",- "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",- "dev": true+ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="},"jsprim": {"version": "1.4.1",@@ -6419,7 +6438,6 @@"version": "1.1.0","resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz","integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",- "dev": true,"requires": {"big.js": "^3.1.3","emojis-list": "^2.0.0",@@ -8024,8 +8042,7 @@"punycode": {"version": "2.1.1","resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",- "dev": true+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="},"puppeteer": {"version": "1.11.0",@@ -8239,6 +8256,14 @@"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz","integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="},+ "react-stripe-elements": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/react-stripe-elements/-/react-stripe-elements-2.0.1.tgz",+ "integrity": "sha512-P70Yd55FZGgOChvgSyegPOisfc/5kWVucYvb9je9RhTMm44fY5Q0yQz9yL0kLcYfCPkJWVmXl6Ex7FiMEuAdtg==",+ "requires": {+ "prop-types": "^15.5.10"+ }+ },"react-test-renderer": {"version": "16.7.0","resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-16.7.0.tgz",@@ -8829,7 +8854,6 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz","integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",- "dev": true,"requires": {"ajv": "^6.1.0","ajv-errors": "^1.0.0",@@ -8840,7 +8864,6 @@"version": "6.6.2","resolved": "https://registry.npmjs.org/ajv/-/ajv-6.6.2.tgz","integrity": "sha512-FBHEW6Jf5TB9MGBgUUA9XHkTbjXYfAUjY43ACMfmdMRHniyoMHjHjzD50OK8LGDWQwp4rWEsIq5kEqq7rvIM1g==",- "dev": true,"requires": {"fast-deep-equal": "^2.0.1","fast-json-stable-stringify": "^2.0.0",@@ -8851,14 +8874,12 @@"fast-deep-equal": {"version": "2.0.1","resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",- "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",- "dev": true+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="},"json-schema-traverse": {"version": "0.4.1","resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",- "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",- "dev": true+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="}}},@@ -10217,7 +10238,6 @@"version": "4.2.2","resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz","integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",- "dev": true,"requires": {"punycode": "^2.1.0"}diff --git a/package.json b/package.jsonindex e92bbaad4..a96b51fe1 100644--- a/package.json+++ b/package.json@@ -8,6 +8,7 @@"react": "16.7.0","react-dom": "16.7.0","react-icons": "3.2.2",+ "react-stripe-elements": "2.0.1","react-textarea-autosize": "7.1.0","react-toastify": "4.5.2","tslib": "1.9.3"@@ -15,6 +16,7 @@"devDependencies": {"@types/enzyme": "3.1.15","@types/enzyme-adapter-react-16": "1.0.3",+ "@types/react-stripe-elements": "1.1.10","@types/jest": "23.3.11","@types/jsdom": "12.2.1","@types/marked": "0.5.0",@@ -27,6 +29,7 @@"dotenv": "6.2.0","enzyme": "3.8.0","enzyme-adapter-react-16": "1.7.1",+ "file-loader": "3.0.1","fork-ts-checker-webpack-plugin": "0.5.2","jest": "23.6.0","mini-css-extract-plugin": "0.5.0",@@ -71,7 +74,7 @@"node"],"moduleNameMapper": {- "^.*\\.(png|scss)$": "<rootDir>/public/jest.assets.ts",+ "^.*\\.(png|scss|svg)$": "<rootDir>/public/jest.assets.ts","@fider/(.*)": "<rootDir>/public/$1"}}diff --git a/public/assets/images/card-americanexpress.svg b/public/assets/images/card-americanexpress.svgnew file mode 100644index 000000000..52b26e831--- /dev/null+++ b/public/assets/images/card-americanexpress.svg@@ -0,0 +1,17 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="m40 1e-3h700c22.092 0 40 17.909 40 40v420c0 22.092-17.908 40-40 40h-700c-22.091 0-40-17.908-40-40v-420c0-22.091 17.909-40 40-40z"+ fill="#2557D6"+ />+ <path+ d="m0.253 235.69h37.441l8.442-19.51h18.9l8.42 19.51h73.668v-14.915l6.576 14.98h38.243l6.576-15.202v15.138h183.08l-0.085-32.026h3.542c2.479 0.083 3.204 0.302 3.204 4.226v27.8h94.689v-7.455c7.639 3.92 19.518 7.455 35.148 7.455h39.836l8.525-19.51h18.9l8.337 19.51h76.765v-18.532l11.626 18.532h61.515v-122.51h-60.88v14.468l-8.522-14.468h-62.471v14.468l-7.828-14.468h-84.38c-14.123 0-26.539 1.889-36.569 7.153v-7.153h-58.229v7.153c-6.383-5.426-15.079-7.153-24.75-7.153h-212.74l-14.274 31.641-14.659-31.641h-67.005v14.468l-7.362-14.468h-57.145l-26.539 58.246v64.261h3e-3zm236.34-17.67h-22.464l-0.083-68.794-31.775 68.793h-19.24l-31.858-68.854v68.854h-44.57l-8.42-19.592h-45.627l-8.505 19.592h-23.801l39.241-87.837h32.559l37.269 83.164v-83.164h35.766l28.678 59.587 26.344-59.587h36.485l1e-3 87.838zm-165.9-37.823l-14.998-35.017-14.915 35.017h29.913zm255.3 37.821h-73.203v-87.837h73.203v18.291h-51.289v15.833h50.06v18.005h-50.061v17.542h51.289l1e-3 18.166zm103.16-64.18c0 14.004-9.755 21.24-15.439 23.412 4.794 1.748 8.891 4.838 10.84 7.397 3.094 4.369 3.628 8.271 3.628 16.116v17.255h-22.104l-0.083-11.077c0-5.285 0.528-12.886-3.458-17.112-3.202-3.09-8.083-3.76-15.973-3.76h-23.523v31.95h-21.914v-87.838h50.401c11.199 0 19.451 0.283 26.535 4.207 6.933 3.924 11.09 9.652 11.09 19.45zm-27.699 13.042c-3.013 1.752-6.573 1.81-10.841 1.81h-26.62v-19.51h26.982c3.818 0 7.804 0.164 10.393 1.584 2.842 1.28 4.601 4.003 4.601 7.765 0 3.84-1.674 6.929-4.515 8.351zm62.844 51.138h-22.358v-87.837h22.358v87.837zm259.56 0h-31.053l-41.535-65.927v65.927h-44.628l-8.527-19.592h-45.521l-8.271 19.592h-25.648c-10.649 0-24.138-2.257-31.773-9.715-7.701-7.458-11.708-17.56-11.708-33.533 0-13.027 2.395-24.936 11.812-34.347 7.085-7.01 18.18-10.242 33.28-10.242h21.215v18.821h-20.771c-7.997 0-12.514 1.14-16.862 5.203-3.735 3.699-6.298 10.69-6.298 19.897 0 9.41 1.951 16.196 6.023 20.628 3.373 3.476 9.506 4.53 15.272 4.53h9.842l30.884-69.076h32.835l37.102 83.081v-83.08h33.366l38.519 61.174v-61.174h22.445v87.833zm-133.2-37.82l-15.165-35.017-15.081 35.017h30.246zm189.04 178.08c-5.322 7.457-15.694 11.238-29.736 11.238h-42.319v-18.84h42.147c4.181 0 7.106-0.527 8.868-2.175 1.665-1.474 2.605-3.554 2.591-5.729 0-2.561-1.064-4.593-2.677-5.811-1.59-1.342-3.904-1.95-7.722-1.95-20.574-0.67-46.244 0.608-46.244-27.194 0-12.742 8.443-26.156 31.439-26.156h43.649v-17.479h-40.557c-12.237 0-21.129 2.81-27.425 7.174v-7.175h-59.985c-9.595 0-20.854 2.279-26.179 7.175v-7.175h-107.12v7.175c-8.524-5.892-22.908-7.175-29.549-7.175h-70.656v7.175c-6.745-6.258-21.742-7.175-30.886-7.175h-79.077l-18.094 18.764-16.949-18.764h-118.13v122.59h115.9l18.646-19.062 17.565 19.062 71.442 0.061v-28.838h7.021c9.479 0.14 20.66-0.228 30.523-4.312v33.085h58.928v-31.952h2.842c3.628 0 3.985 0.144 3.985 3.615v28.333h179.01c11.364 0 23.244-2.786 29.824-7.845v7.845h56.78c11.815 0 23.354-1.587 32.134-5.649l2e-3 -22.84zm-354.94-47.155c0 24.406-19.005 29.445-38.159 29.445h-27.343v29.469h-42.591l-26.984-29.086-28.042 29.086h-86.802v-87.859h88.135l26.961 28.799 27.875-28.799h70.021c17.389 0 36.929 4.613 36.929 28.945zm-174.22 40.434h-53.878v-17.48h48.11v-17.926h-48.11v-15.974h54.939l23.969 25.604-25.03 25.776zm86.81 10.06l-33.644-35.789 33.644-34.65v70.439zm49.757-39.066h-28.318v-22.374h28.572c7.912 0 13.404 3.09 13.404 10.772 0 7.599-5.238 11.602-13.658 11.602zm148.36-40.373h73.138v18.17h-51.315v15.973h50.062v17.926h-50.062v17.48l51.314 0.08v18.23h-73.139l2e-3 -87.859zm-28.119 47.029c4.878 1.725 8.865 4.816 10.734 7.375 3.095 4.291 3.542 8.294 3.631 16.037v17.418h-22.002v-10.992c0-5.286 0.531-13.112-3.542-17.198-3.201-3.147-8.083-3.899-16.076-3.899h-23.42v32.09h-22.02v-87.859h50.594c11.093 0 19.173 0.47 26.366 4.146 6.915 4.004 11.266 9.487 11.266 19.511-1e-3 14.022-9.764 21.178-15.531 23.371zm-12.385-11.107c-2.932 1.667-6.556 1.811-10.818 1.811h-26.622v-19.732h26.982c3.902 0 7.807 0.08 10.458 1.587 2.84 1.423 4.538 4.146 4.538 7.903 0 3.758-1.699 6.786-4.538 8.431zm197.82 5.597c4.27 4.229 6.554 9.571 6.554 18.613 0 18.9-12.322 27.723-34.425 27.723h-42.68v-18.84h42.51c4.157 0 7.104-0.525 8.95-2.175 1.508-1.358 2.589-3.333 2.589-5.729 0-2.561-1.17-4.592-2.675-5.811-1.675-1.34-3.986-1.949-7.803-1.949-20.493-0.67-46.157 0.609-46.157-27.192 0-12.744 8.355-26.158 31.33-26.158h43.932v18.7h-40.198c-3.984 0-6.575 0.145-8.779 1.587-2.4 1.422-3.29 3.534-3.29 6.319 0 3.314 2.037 5.57 4.795 6.546 2.311 0.77 4.795 0.995 8.526 0.995l11.797 0.306c11.895 0.276 20.061 2.248 25.024 7.065zm86.955-23.52h-39.938c-3.986 0-6.638 0.144-8.867 1.587-2.312 1.423-3.202 3.534-3.202 6.322 0 3.314 1.951 5.568 4.791 6.544 2.312 0.771 4.795 0.996 8.444 0.996l11.878 0.304c11.983 0.284 19.982 2.258 24.86 7.072 0.891 0.67 1.422 1.422 2.033 2.175v-25h1e-3z"+ fill="#fff"+ />+</svg>\ No newline at end of filediff --git a/public/assets/images/card-diners.svg b/public/assets/images/card-diners.svgnew file mode 100644index 000000000..427801323--- /dev/null+++ b/public/assets/images/card-diners.svg@@ -0,0 +1,25 @@+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"+ fill="#0079BE"+ />+ <path+ d="m599.93 251.45c0-99.415-82.98-168.13-173.9-168.1h-78.242c-92.003-0.033-167.73 68.705-167.73 168.1 0 90.93 75.727 165.64 167.73 165.2h78.242c90.914 0.436 173.9-74.294 173.9-165.2z"+ fill="#fff"+ />+ <path+ d="m348.28 97.43c-84.07 0.027-152.19 68.308-152.21 152.58 0.02 84.258 68.144 152.53 152.21 152.56 84.09-0.027 152.23-68.303 152.24-152.56-0.011-84.272-68.149-152.55-152.24-152.58z"+ fill="#0079BE"+ />+ <path+ d="m252.07 249.6c0.08-41.181 25.746-76.297 61.94-90.25v180.48c-36.194-13.948-61.861-49.045-61.94-90.23zm131 90.274v-180.53c36.207 13.92 61.914 49.057 61.979 90.257-0.065 41.212-25.772 76.322-61.979 90.269z"+ fill="#fff"+ />+</svg>\ No newline at end of filediff --git a/public/assets/images/card-discover.svg b/public/assets/images/card-discover.svgnew file mode 100644index 000000000..8aa7e300a--- /dev/null+++ b/public/assets/images/card-discover.svg@@ -0,0 +1,16 @@+<svg xmlns="http://www.w3.org/2000/svg" width="780" height="500" viewBox="0 0 780 500">+ <g fill-rule="evenodd">+ <path+ d="M54.992 0C24.627 0 0 24.63 0 55.004v390.992C0 476.376 24.619 501 54.992 501h670.016C755.373 501 780 476.37 780 445.996V55.004C780 24.624 755.381 0 725.008 0H54.992z"+ fill="#4D4D4D"+ />+ <path+ d="M327.152 161.893c8.837 0 16.248 1.784 25.268 6.09v22.751c-8.544-7.863-15.955-11.154-25.756-11.154-19.264 0-34.414 15.015-34.414 34.05 0 20.075 14.681 34.196 35.37 34.196 9.312 0 16.586-3.12 24.8-10.857v22.763c-9.341 4.14-16.911 5.776-25.756 5.776-31.278 0-55.582-22.596-55.582-51.737 0-28.826 24.951-51.878 56.07-51.878zm-97.113.627c11.546 0 22.11 3.72 30.943 10.994l-10.748 13.248c-5.35-5.646-10.41-8.028-16.564-8.028-8.853 0-15.3 4.745-15.3 10.989 0 5.354 3.619 8.188 15.944 12.482 23.365 8.044 30.29 15.176 30.29 30.926 0 19.193-14.976 32.553-36.32 32.553-15.63 0-26.994-5.795-36.458-18.872l13.268-12.03c4.73 8.61 12.622 13.222 22.42 13.222 9.163 0 15.947-5.952 15.947-13.984 0-4.164-2.055-7.734-6.158-10.258-2.066-1.195-6.158-2.977-14.2-5.647-19.291-6.538-25.91-13.527-25.91-27.185 0-16.225 14.214-28.41 32.846-28.41zm234.723 1.728h22.437l28.084 66.592 28.446-66.592h22.267l-45.494 101.686h-11.053l-44.687-101.686zm-397.348.152h30.15c33.312 0 56.534 20.382 56.534 49.641 0 14.59-7.104 28.696-19.118 38.057-10.108 7.901-21.626 11.445-37.574 11.445H67.414V164.4zm96.135 0h20.54v99.143h-20.54V164.4zm411.734 0h58.252v16.8H595.81v22.005h36.336v16.791h-36.336v26.762h37.726v16.785h-58.252V164.4zm71.858 0h30.455c23.69 0 37.265 10.71 37.265 29.272 0 15.18-8.514 25.14-23.986 28.105l33.148 41.766h-25.26l-28.429-39.828h-2.678v39.828h-20.515V164.4zm20.515 15.616v30.025h6.002c13.117 0 20.069-5.362 20.069-15.328 0-9.648-6.954-14.697-19.745-14.697h-6.326zM87.94 181.199v65.559h5.512c13.273 0 21.656-2.394 28.11-7.88 7.103-5.955 11.376-15.465 11.376-24.98 0-9.499-4.273-18.725-11.376-24.681-6.785-5.78-14.837-8.018-28.11-8.018H87.94z"+ fill="#FFF"+ />+ <path+ d="m415.13 161.21c30.941 0 56.022 23.58 56.022 52.709v0.033c0 29.13-25.081 52.742-56.021 52.742s-56.022-23.613-56.022-52.742v-0.033c0-29.13 25.082-52.71 56.022-52.71zm364.85 127.15c-26.05 18.33-221.08 149.34-558.75 212.62h503.76c30.365 0 54.992-24.63 54.992-55.004v-157.62z"+ fill="#F47216"+ />+ </g>+</svg>\ No newline at end of filediff --git a/public/assets/images/card-jcb.svg b/public/assets/images/card-jcb.svgnew file mode 100644index 000000000..954410927--- /dev/null+++ b/public/assets/images/card-jcb.svg@@ -0,0 +1,65 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"+ fill="#0E4C96"+ />+ <path+ d="m632.24 361.27c0 41.615-33.729 75.36-75.36 75.36h-409.13v-297.88c0-41.626 33.733-75.37 75.365-75.37l409.12-1e-3 1e-3 297.89z"+ fill="#fff"+ />+ <linearGradient+ id="c"+ x1="83.977"+ x2="84.977"+ y1="645.5"+ y2="645.5"+ gradientTransform="matrix(132.87 0 0 -323.02 -10686 2.0876e5)"+ gradientUnits="userSpaceOnUse"+ >+ <stop stop-color="#007B40" offset="0" />+ <stop stop-color="#55B330" offset="1" />+ </linearGradient>+ <path+ d="m498.86 256.54c11.684 0.253 23.437-0.516 35.076 0.4 11.787 2.199 14.629 20.043 4.156 25.888-7.141 3.851-15.633 1.433-23.379 2.113h-15.852l-1e-3 -28.401zm41.833-32.145c2.596 9.164-6.238 17.392-15.066 16.13h-26.767c0.185-8.642-0.368-18.021 0.271-26.208 10.725 0.301 21.549-0.616 32.21 0.479 4.581 1.151 8.414 4.917 9.352 9.599zm64.428-135.9c0.498 17.501 0.071 35.927 0.214 53.783-0.035 72.596 0.072 145.19-0.055 217.79-0.47 27.207-24.582 50.844-51.601 51.387-27.046 0.111-54.095 0.016-81.142 0.047v-109.75c29.47-0.154 58.959 0.307 88.417-0.232 13.667-0.859 28.632-9.875 29.27-24.914 1.61-15.103-12.632-25.551-26.152-27.201-5.198-0.135-5.044-1.516 0-2.117 12.892-2.787 23.02-16.133 19.226-29.499-3.236-14.058-18.772-19.499-31.697-19.472-26.351-0.18-52.709-0.026-79.062-0.077 0.172-20.489-0.354-41 0.286-61.474 2.087-26.716 26.806-48.747 53.447-48.27h78.849v-1e-3z"+ fill="url(#c)"+ />+ <linearGradient+ id="b"+ x1="83.984"+ x2="84.979"+ y1="645.5"+ y2="645.5"+ gradientTransform="matrix(133.43 0 0 -323.02 -11031 2.0876e5)"+ gradientUnits="userSpaceOnUse"+ >+ <stop stop-color="#1D2970" offset="0" />+ <stop stop-color="#006DBA" offset="1" />+ </linearGradient>+ <path+ d="m174.74 139.54c0.674-27.163 24.889-50.611 51.875-51.007 26.944-0.083 53.891-0.012 80.837-0.036-0.074 90.885 0.148 181.78-0.112 272.66-1.038 26.835-24.99 49.835-51.679 50.308-26.996 0.099-53.995 0.014-80.992 0.042v-113.45c26.223 6.194 53.722 8.832 80.473 4.721 15.993-2.574 33.488-10.424 38.902-27.014 3.986-14.191 1.742-29.126 2.334-43.691v-33.824h-46.297c-0.208 22.369 0.426 44.779-0.335 67.125-1.248 13.734-14.846 22.46-27.8 21.994-16.066 0.17-47.898-11.639-47.898-11.639-0.08-41.918 0.466-94.409 0.692-136.18z"+ fill="url(#b)"+ />+ <linearGradient+ id="a"+ x1="83.978"+ x2="84.977"+ y1="645.5"+ y2="645.5"+ gradientTransform="matrix(132.96 0 0 -323.03 -10842 2.0877e5)"+ gradientUnits="userSpaceOnUse"+ >+ <stop stop-color="#6E2B2F" offset="0" />+ <stop stop-color="#E30138" offset="1" />+ </linearGradient>+ <path+ d="m324.72 211.89c-2.434 0.517-0.489-8.301-1.113-11.646 0.165-21.15-0.347-42.323 0.283-63.458 2.083-26.829 26.991-48.916 53.739-48.288h78.766c-0.073 90.884 0.147 181.78-0.111 272.66-1.039 26.834-24.992 49.833-51.681 50.308-26.997 0.1-53.997 0.015-80.997 0.043v-124.3c18.44 15.128 43.5 17.483 66.473 17.524 17.316-6e-3 34.534-2.674 51.35-6.67v-22.772c-18.953 9.446-41.232 15.446-62.243 10.019-14.655-3.65-25.294-17.812-25.056-32.937-1.699-15.728 7.524-32.335 22.981-37.011 19.189-6.008 40.107-1.413 58.096 6.397 3.854 2.019 7.765 4.521 6.222-1.921v-17.9c-30.084-7.156-62.101-9.792-92.329-2.004-8.749 2.469-17.271 6.212-24.38 11.958z"+ fill="url(#a)"+ />+</svg>\ No newline at end of filediff --git a/public/assets/images/card-mastercard.svg b/public/assets/images/card-mastercard.svgnew file mode 100644index 000000000..a4cf75a00--- /dev/null+++ b/public/assets/images/card-mastercard.svg@@ -0,0 +1,31 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"+ fill="#16366F"+ />+ <path+ d="m449.01 250c0 99.143-80.37 179.5-179.51 179.5s-179.5-80.361-179.5-179.5c0-99.133 80.362-179.5 179.5-179.5 99.137 0 179.51 80.37 179.51 179.5"+ fill="#D9222A"+ />+ <path+ d="m510.49 70.496c-46.38 0-88.643 17.596-120.5 46.466-6.49 5.889-12.548 12.237-18.125 18.996h36.266c4.966 6.037 9.536 12.388 13.685 19.013h-63.635c-3.827 6.121-7.28 12.469-10.341 19.008h84.312c2.893 6.185 5.431 12.53 7.6 19.004h-99.512c-2.091 6.235-3.832 12.581-5.217 19.009h109.94c2.689 12.49 4.044 25.231 4.041 38.008 0 19.934-3.254 39.113-9.254 57.02h-99.512c2.164 6.479 4.7 12.825 7.595 19.01h84.317c-3.064 6.54-6.52 12.889-10.347 19.013h-63.625c4.154 6.629 8.73 12.979 13.685 18.996h36.258c-5.57 6.772-11.63 13.126-18.13 19.012 31.86 28.867 74.118 46.454 120.5 46.454 99.138-1e-3 179.51-80.362 179.51-179.5 0-99.13-80.37-179.5-179.51-179.5"+ fill="#EE9F2D"+ />+ <path d="m666.08 350.06c0-3.201 2.592-5.801 5.796-5.801s5.796 2.6 5.796 5.801c0 3.199-2.592 5.799-5.796 5.799-3.202-1e-3 -5.797-2.598-5.796-5.799zm5.796 4.408c2.435-1e-3 4.407-1.975 4.408-4.408 0-2.433-1.972-4.404-4.404-4.404h-4e-3c-2.429-4e-3 -4.4 1.963-4.404 4.392v0.013c-3e-3 2.432 1.967 4.406 4.399 4.408 1e-3 -1e-3 3e-3 -1e-3 5e-3 -1e-3zm-0.783-1.86h-1.188v-5.094h2.149c0.45 0 0.908 0 1.305 0.254 0.413 0.278 0.646 0.77 0.646 1.278 0 0.57-0.337 1.104-0.883 1.312l0.937 2.25h-1.315l-0.78-2.016h-0.87v2.016h-1e-3zm0-2.89h0.658c0.246 0 0.504 0.02 0.725-0.1 0.196-0.125 0.296-0.359 0.296-0.584 0-0.195-0.12-0.42-0.288-0.516-0.207-0.131-0.536-0.101-0.758-0.101h-0.633v1.301zm-443.5-80.063c-2.045-0.237-2.945-0.301-4.35-0.301-11.045 0-16.637 3.789-16.637 11.268 0 4.611 2.73 7.546 6.987 7.546 7.938 0 13.659-7.56 14-18.513zm14.171 32.996h-16.146l0.371-7.676c-4.925 6.067-11.496 8.95-20.425 8.95-10.562 0-17.804-8.25-17.804-20.229 0-18.024 12.596-28.54 34.217-28.54 2.208 0 5.041 0.2 7.941 0.569 0.605-2.441 0.763-3.486 0.763-4.8 0-4.908-3.396-6.738-12.5-6.738-9.533-0.108-17.396 2.271-20.625 3.334 0.204-1.23 2.7-16.658 2.7-16.658 9.712-2.846 16.117-3.917 23.325-3.917 16.733 0 25.596 7.512 25.58 21.712 0.032 3.805-0.597 8.5-1.58 14.671-1.692 10.731-5.32 33.718-5.817 39.322zm-62.158 0h-19.488l11.163-69.997-24.925 69.997h-13.28l-1.64-69.597-11.734 69.597h-18.242l15.238-91.054h28.02l1.7 50.966 17.092-50.966h31.167l-15.071 91.054m354.98-32.996c-2.037-0.237-2.942-0.301-4.342-0.301-11.041 0-16.634 3.789-16.634 11.268 0 4.611 2.726 7.546 6.983 7.546 7.939 0 13.664-7.56 13.993-18.513zm14.183 32.996h-16.145l0.365-7.676c-4.925 6.067-11.5 8.95-20.42 8.95-10.566 0-17.8-8.25-17.8-20.229 0-18.024 12.587-28.54 34.212-28.54 2.208 0 5.037 0.2 7.934 0.569 0.604-2.441 0.763-3.486 0.763-4.8 0-4.908-3.392-6.738-12.496-6.738-9.533-0.108-17.388 2.271-20.63 3.334 0.205-1.23 2.709-16.658 2.709-16.658 9.713-2.846 16.113-3.917 23.312-3.917 16.741 0 25.604 7.512 25.588 21.712 0.032 3.805-0.597 8.5-1.58 14.671-1.682 10.731-5.32 33.718-5.812 39.322zm-220.39-1.125c-5.334 1.68-9.492 2.399-14 2.399-9.963 0-15.4-5.725-15.4-16.267-0.142-3.27 1.433-11.879 2.67-19.737 1.125-6.917 8.45-50.53 8.45-50.53h19.371l-2.262 11.209h11.7l-2.643 17.796h-11.742c-2.25 14.083-5.454 31.625-5.491 33.95 0 3.817 2.037 5.483 6.67 5.483 2.221 0 3.941-0.226 5.255-0.7l-2.578 16.397m59.391-0.6c-6.654 2.033-13.075 3.017-19.879 3-21.683-0.021-32.987-11.346-32.987-33.032 0-25.313 14.38-43.947 33.9-43.947 15.97 0 26.17 10.433 26.17 26.796 0 5.429-0.7 10.729-2.387 18.212h-38.575c-1.304 10.742 5.57 15.217 16.837 15.217 6.935 0 13.188-1.43 20.142-4.663l-3.221 18.417zm-10.887-43.9c0.107-1.543 2.054-13.217-9.013-13.217-6.171 0-10.583 4.704-12.38 13.217h21.393zm-123.42-5.017c0 9.367 4.541 15.825 14.841 20.676 7.892 3.709 9.113 4.809 9.113 8.17 0 4.617-3.48 6.7-11.192 6.7-5.812 0-11.22-0.907-17.458-2.92 0 0-2.563 16.32-2.68 17.101 4.43 0.966 8.38 1.861 20.28 2.19 20.562 0 30.058-7.829 30.058-24.75 0-10.175-3.975-16.146-13.737-20.633-8.171-3.75-9.109-4.588-9.109-8.046 0-4.004 3.238-6.046 9.538-6.046 3.825 0 9.05 0.408 14 1.113l2.775-17.175c-5.046-0.8-12.696-1.442-17.15-1.442-21.8 0-29.346 11.387-29.279 25.062m229.09-23.116c5.413 0 10.459 1.42 17.413 4.92l3.187-19.762c-2.854-1.12-12.904-7.7-21.416-7.7-13.042 0-24.066 6.47-31.82 17.15-11.31-3.746-15.959 3.825-21.659 11.367l-5.062 1.179c0.383-2.483 0.73-4.95 0.613-7.446h-17.896c-2.445 22.917-6.779 46.13-10.171 69.075l-0.884 4.976h19.496c3.254-21.143 5.038-34.681 6.121-43.842l7.342-4.084c1.096-4.08 4.529-5.458 11.416-5.292-0.926 5.008-1.389 10.09-1.383 15.184 0 24.225 13.071 39.308 34.05 39.308 5.404 0 10.042-0.712 17.221-2.657l3.431-20.76c-6.46 3.18-11.761 4.676-16.561 4.676-11.328 0-18.183-8.362-18.183-22.184-1e-3 -20.05 10.195-34.108 24.745-34.108" />+ <path+ d="m185.21 297.24h-19.491l11.17-69.988-24.925 69.988h-13.282l-1.642-69.588-11.733 69.588h-18.243l15.238-91.042h28.02l0.788 56.362 18.904-56.362h30.267l-15.071 91.042"+ fill="#fff"+ />+ <path d="m647.52 211.6l-4.319 26.308c-5.33-7.012-11.054-12.087-18.612-12.087-9.834 0-18.784 7.454-24.642 18.425-8.158-1.692-16.597-4.563-16.597-4.563l-4e-3 0.067c0.658-6.133 0.92-9.875 0.862-11.146h-17.9c-2.437 22.917-6.77 46.13-10.157 69.075l-0.893 4.976h19.492c2.633-17.097 4.65-31.293 6.133-42.551 6.659-6.017 9.992-11.267 16.721-10.917-2.979 7.206-4.725 15.504-4.725 24.017 0 18.513 9.367 30.725 23.534 30.725 7.141 0 12.62-2.462 17.966-8.17l-0.912 6.884h18.433l14.842-91.043h-19.222zm-24.37 73.942c-6.634 0-9.983-4.909-9.983-14.597 0-14.553 6.271-24.875 15.112-24.875 6.695 0 10.32 5.104 10.32 14.508 1e-3 14.681-6.369 24.964-15.449 24.964z" />+ <path+ d="m233.19 264.26c-2.042-0.236-2.946-0.3-4.346-0.3-11.046 0-16.634 3.788-16.634 11.267 0 4.604 2.73 7.547 6.98 7.547 7.945-1e-3 13.666-7.559 14-18.514zm14.179 32.984h-16.146l0.367-7.663c-4.921 6.054-11.5 8.95-20.421 8.95-10.567 0-17.804-8.25-17.804-20.229 0-18.032 12.591-28.542 34.216-28.542 2.209 0 5.042 0.2 7.938 0.571 0.604-2.442 0.762-3.487 0.762-4.808 0-4.908-3.391-6.73-12.496-6.73-9.537-0.108-17.395 2.272-20.629 3.322 0.204-1.226 2.7-16.638 2.7-16.638 9.709-2.858 16.121-3.93 23.321-3.93 16.738 0 25.604 7.518 25.588 21.705 0.029 3.82-0.605 8.512-1.584 14.675-1.687 10.725-5.32 33.725-5.812 39.317zm261.38-88.592l-3.192 19.767c-6.95-3.496-12-4.921-17.407-4.921-14.551 0-24.75 14.058-24.75 34.107 0 13.821 6.857 22.181 18.183 22.181 4.8 0 10.096-1.492 16.554-4.677l-3.42 20.75c-7.184 1.959-11.816 2.672-17.226 2.672-20.976 0-34.05-15.084-34.05-39.309 0-32.55 18.059-55.3 43.888-55.3 8.507 1e-3 18.562 3.609 21.42 4.73m31.442 55.608c-2.041-0.236-2.941-0.3-4.346-0.3-11.042 0-16.634 3.788-16.634 11.267 0 4.604 2.729 7.547 6.984 7.547 7.937-1e-3 13.662-7.559 13.996-18.514zm14.179 32.984h-16.15l0.37-7.663c-4.924 6.054-11.5 8.95-20.42 8.95-10.563 0-17.804-8.25-17.804-20.229 0-18.032 12.595-28.542 34.212-28.542 2.213 0 5.042 0.2 7.941 0.571 0.601-2.442 0.763-3.487 0.763-4.808 0-4.908-3.392-6.73-12.496-6.73-9.533-0.108-17.396 2.272-20.629 3.322 0.204-1.226 2.704-16.638 2.704-16.638 9.709-2.858 16.116-3.93 23.316-3.93 16.742 0 25.604 7.518 25.583 21.705 0.034 3.82-0.595 8.512-1.579 14.675-1.682 10.725-5.324 33.725-5.811 39.317zm-220.39-1.122c-5.338 1.68-9.496 2.409-14 2.409-9.963 0-15.4-5.726-15.4-16.266-0.138-3.281 1.437-11.881 2.675-19.738 1.12-6.926 8.446-50.533 8.446-50.533h19.367l-2.259 11.212h9.942l-2.646 17.788h-9.975c-2.25 14.091-5.463 31.619-5.496 33.949 0 3.83 2.042 5.483 6.671 5.483 2.22 0 3.938-0.217 5.254-0.692l-2.579 16.388m59.392-0.591c-6.65 2.033-13.08 3.013-19.88 3-21.684-0.021-32.987-11.346-32.987-33.033 0-25.321 14.38-43.95 33.9-43.95 15.97 0 26.17 10.429 26.17 26.8 0 5.433-0.7 10.733-2.382 18.212h-38.575c-1.306 10.741 5.569 15.221 16.837 15.221 6.93 0 13.188-1.434 20.137-4.676l-3.22 18.426zm-10.892-43.912c0.117-1.538 2.059-13.217-9.013-13.217-6.166 0-10.579 4.717-12.375 13.217h21.388zm-123.42-5.004c0 9.365 4.542 15.816 14.842 20.675 7.891 3.708 9.112 4.812 9.112 8.17 0 4.617-3.483 6.7-11.187 6.7-5.817 0-11.225-0.908-17.467-2.92 0 0-2.554 16.32-2.67 17.1 4.42 0.967 8.374 1.85 20.274 2.191 20.567 0 30.059-7.829 30.059-24.746 0-10.18-3.971-16.15-13.738-20.637-8.167-3.758-9.112-4.583-9.112-8.046 0-4 3.245-6.058 9.541-6.058 3.821 0 9.046 0.42 14.004 1.125l2.771-17.18c-5.041-0.8-12.691-1.441-17.146-1.441-21.804 0-29.345 11.379-29.283 25.067m398.45 50.629h-18.437l0.917-6.893c-5.347 5.717-10.825 8.18-17.967 8.18-14.168 0-23.53-12.213-23.53-30.725 0-24.63 14.521-45.393 31.709-45.393 7.558 0 13.28 3.088 18.604 10.096l4.325-26.308h19.221l-14.842 91.043zm-28.745-17.109c9.075 0 15.45-10.283 15.45-24.953 0-9.405-3.63-14.509-10.325-14.509-8.838 0-15.116 10.317-15.116 24.875-1e-3 9.686 3.357 14.587 9.991 14.587zm-56.843-56.929c-2.439 22.917-6.773 46.13-10.162 69.063l-0.891 4.975h19.491c6.971-45.275 8.658-54.117 19.588-53.009 1.742-9.266 4.982-17.383 7.399-21.479-8.163-1.7-12.721 2.913-18.688 11.675 0.471-3.787 1.334-7.466 1.163-11.225h-17.9m-160.42 0c-2.446 22.917-6.78 46.13-10.167 69.063l-0.887 4.975h19.5c6.962-45.275 8.646-54.117 19.569-53.009 1.75-9.266 4.992-17.383 7.4-21.479-8.154-1.7-12.716 2.913-18.678 11.675 0.47-3.787 1.325-7.466 1.162-11.225h-17.899m254.57 68.242c0-3.214 2.596-5.8 5.796-5.8 3.197-3e-3 5.792 2.587 5.795 5.785v0.015c-1e-3 3.2-2.595 5.794-5.795 5.796-3.2-2e-3 -5.794-2.596-5.796-5.796zm5.796 4.404c2.432 1e-3 4.403-1.97 4.403-4.401v-2e-3c3e-3 -2.433-1.968-4.406-4.399-4.408h-4e-3c-2.435 1e-3 -4.408 1.974-4.409 4.408 3e-3 2.432 1.976 4.403 4.409 4.403zm-0.784-1.87h-1.188v-5.084h2.154c0.446 0 0.908 8e-3 1.296 0.254 0.416 0.283 0.654 0.767 0.654 1.274 0 0.575-0.338 1.113-0.888 1.317l0.941 2.236h-1.319l-0.78-2.008h-0.87v2.008 3e-3zm0-2.88h0.654c0.245 0 0.513 0.018 0.729-0.1 0.195-0.125 0.295-0.361 0.295-0.587-9e-3 -0.21-0.115-0.404-0.287-0.524-0.204-0.117-0.542-0.085-0.763-0.085h-0.629v1.296h1e-3z"+ fill="#fff"+ />+</svg>\ No newline at end of filediff --git a/public/assets/images/card-unknown.svg b/public/assets/images/card-unknown.svgnew file mode 100644index 000000000..a8ca58d69--- /dev/null+++ b/public/assets/images/card-unknown.svg@@ -0,0 +1,28 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"+ fill="#000C9D"+ />+ <rect x="66.908" y="106.91" width="110.32" height="99.679" fill="#9D9400" />+ <path+ d="m94.714 284.15v-3.795h-5.117v-11.27h-4.198l-0.402 11.27h-11.443l10.58-25.07-3.967-1.725-11.673 27.141v3.449h16.445v9.66h4.658v-9.66h5.117zm19.586-30.589c-4.025 0-7.878 1.381-11.213 4.6l2.588 2.934c2.645-2.473 5.002-3.68 8.395-3.68 4.197 0 7.532 2.357 7.532 6.727 0 4.773-3.737 6.959-7.532 6.959h-2.358l-0.575 3.795h3.335c4.658 0 8.223 1.84 8.223 7.531 0 4.945-3.278 8.107-8.855 8.107-3.22 0-6.555-1.322-8.798-3.967l-3.22 2.645c2.99 3.68 7.705 5.232 12.133 5.232 8.165 0 13.742-5.174 13.742-12.018 0-6.152-4.37-9.371-9.027-9.717 4.197-0.807 7.762-4.43 7.762-9.199 0-5.406-4.715-9.949-12.132-9.949zm34.477 0c-5.347 0-8.912 1.896-12.075 5.693l3.335 2.529c2.53-2.934 4.658-4.197 8.568-4.197 4.427 0 7.072 2.76 7.072 7.188 0 6.496-3.22 10.809-18.17 25.127v3.908h23.518l0.575-4.08h-18.63c13.052-11.904 17.71-17.826 17.71-25.07 0-6.325-4.428-11.098-11.903-11.098zm48.738 36.339h-8.28v-35.648h-4.198l-11.73 7.244 2.07 3.393 9.085-5.463v30.476h-9.775v3.908h22.828v-3.91zm69.587-5.75v-3.795h-5.117v-11.27h-4.198l-0.402 11.27h-11.443l10.58-25.07-3.967-1.725-11.673 27.141v3.449h16.445v9.66h4.658v-9.66h5.117zm19.585-30.589c-4.025 0-7.877 1.381-11.212 4.6l2.587 2.934c2.645-2.473 5.003-3.68 8.395-3.68 4.198 0 7.533 2.357 7.533 6.727 0 4.773-3.738 6.959-7.533 6.959h-2.357l-0.575 3.795h3.335c4.657 0 8.222 1.84 8.222 7.531 0 4.945-3.277 8.107-8.855 8.107-3.22 0-6.555-1.322-8.797-3.967l-3.22 2.645c2.99 3.68 7.705 5.232 12.132 5.232 8.165 0 13.743-5.174 13.743-12.018 0-6.152-4.37-9.371-9.028-9.717 4.198-0.807 7.763-4.43 7.763-9.199 0-5.406-4.715-9.949-12.133-9.949zm34.478 0c-5.348 0-8.913 1.896-12.075 5.693l3.335 2.529c2.53-2.934 4.657-4.197 8.567-4.197 4.428 0 7.073 2.76 7.073 7.188 0 6.496-3.221 10.809-18.171 25.127v3.908h23.518l0.575-4.08h-18.63c13.053-11.904 17.71-17.826 17.71-25.07 0-6.325-4.427-11.098-11.902-11.098zm48.737 36.339h-8.28v-35.648h-4.196l-11.729 7.244 2.069 3.393 9.085-5.463v30.476h-9.774v3.908h22.827l-2e-3 -3.91zm69.588-5.75v-3.795h-5.119v-11.27h-4.197l-0.401 11.27h-11.443l10.58-25.07-3.969-1.725-11.672 27.141v3.449h16.445v9.66h4.656v-9.66h5.12zm19.584-30.589c-4.023 0-7.877 1.381-11.213 4.6l2.588 2.934c2.646-2.473 5.002-3.68 8.396-3.68 4.195 0 7.531 2.357 7.531 6.727 0 4.773-3.736 6.959-7.531 6.959h-2.358l-0.574 3.795h3.334c4.658 0 8.225 1.84 8.225 7.531 0 4.945-3.278 8.107-8.854 8.107-3.222 0-6.556-1.322-8.799-3.967l-3.22 2.645c2.988 3.68 7.703 5.232 12.134 5.232 8.163 0 13.741-5.174 13.741-12.018 0-6.152-4.371-9.371-9.026-9.717 4.196-0.807 7.762-4.43 7.762-9.199-3e-3 -5.406-4.718-9.949-12.136-9.949zm34.479 0c-5.348 0-8.912 1.896-12.076 5.693l3.337 2.529c2.528-2.934 4.657-4.197 8.565-4.197 4.428 0 7.072 2.76 7.072 7.188 0 6.496-3.219 10.809-18.17 25.127v3.908h23.518l0.576-4.08h-18.631c13.053-11.904 17.711-17.826 17.711-25.07 0-6.326-4.428-11.098-11.904-11.098h2e-3zm48.736 36.339h-8.279v-35.648h-4.197l-11.729 7.244 2.07 3.393 9.084-5.463v30.476h-9.775v3.908h22.828l-2e-3 -3.91zm69.588-5.75v-3.795h-5.117v-11.27h-4.197l-0.401 11.27h-11.443l10.58-25.07-3.967-1.725-11.672 27.141v3.449h16.445v9.66h4.655v-9.66h5.117zm19.584-30.589c-4.023 0-7.877 1.381-11.211 4.6l2.588 2.934c2.646-2.473 5.002-3.68 8.396-3.68 4.196 0 7.532 2.357 7.532 6.727 0 4.773-3.737 6.959-7.532 6.959h-2.357l-0.574 3.795h3.334c4.658 0 8.224 1.84 8.224 7.531 0 4.945-3.277 8.107-8.855 8.107-3.219 0-6.555-1.322-8.797-3.967l-3.221 2.645c2.99 3.68 7.705 5.232 12.133 5.232 8.166 0 13.742-5.174 13.742-12.018 0-6.152-4.369-9.371-9.027-9.717 4.197-0.807 7.764-4.43 7.764-9.199 0-5.406-4.715-9.949-12.133-9.949h-6e-3zm34.478 0c-5.347 0-8.912 1.896-12.074 5.693l3.334 2.529c2.531-2.934 4.658-4.197 8.567-4.197 4.429 0 7.072 2.76 7.072 7.188 0 6.496-3.221 10.809-18.17 25.127v3.908h23.519l0.575-4.08h-18.631c13.054-11.904 17.711-17.826 17.711-25.07 2e-3 -6.325-4.428-11.098-11.903-11.098zm48.739 36.339h-8.278v-35.648h-4.2l-11.729 7.244 2.068 3.393 9.086-5.463v30.476h-9.775v3.908h22.828v-3.91z"+ fill="#fff"+ />+ <path+ d="m72.219 389.2h6.445v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.945v25.84h6.446v3.32h-16.797v-3.32zm25.468 0h6.446v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.945v25.84h6.445v3.32h-16.797v-3.32zm40.918 0h13.77v3.32h-18.516v-3.32c1.497-1.549 3.535-3.625 6.114-6.229 2.591-2.617 4.218-4.305 4.882-5.061 1.263-1.42 2.142-2.617 2.637-3.594 0.508-0.988 0.762-1.959 0.762-2.91 0-1.549-0.547-2.811-1.64-3.789-1.081-0.977-2.495-1.465-4.24-1.465-1.237 0-2.545 0.215-3.925 0.646-1.367 0.43-2.831 1.08-4.394 1.953v-3.986c1.588-0.637 3.072-1.119 4.453-1.443 1.38-0.326 2.643-0.486 3.789-0.486 3.021 0 5.429 0.754 7.226 2.264 1.797 1.512 2.696 3.529 2.696 6.055 0 1.199-0.228 2.338-0.684 3.418-0.442 1.068-1.256 2.332-2.441 3.789-0.326 0.377-1.361 1.471-3.106 3.281-1.745 1.796-4.206 4.315-7.383 7.557zm34.024-12.402c1.888 0.404 3.359 1.244 4.414 2.521 1.067 1.275 1.601 2.852 1.601 4.727 0 2.877-0.99 5.104-2.968 6.682-1.979 1.574-4.792 2.361-8.438 2.361-1.224 0-2.487-0.125-3.789-0.371-1.289-0.234-2.623-0.594-4.004-1.074v-3.809c1.093 0.639 2.292 1.119 3.594 1.445 1.302 0.324 2.663 0.488 4.082 0.488 2.474 0 4.356-0.488 5.645-1.465 1.302-0.979 1.953-2.396 1.953-4.26 0-1.719-0.605-3.061-1.817-4.021-1.198-0.979-2.872-1.465-5.02-1.465h-3.398v-3.242h3.555c1.94 0 3.425-0.385 4.453-1.152 1.029-0.781 1.543-1.9 1.543-3.359 0-1.496-0.534-2.645-1.601-3.438-1.055-0.809-2.572-1.211-4.551-1.211-1.081 0-2.24 0.117-3.477 0.354-1.237 0.232-2.597 0.598-4.082 1.092v-3.514c1.498-0.418 2.897-0.73 4.2-0.939 1.314-0.207 2.551-0.311 3.71-0.311 2.995 0 5.365 0.682 7.11 2.049 1.745 1.354 2.617 3.189 2.617 5.508 0 1.615-0.462 2.98-1.387 4.102-0.925 1.105-2.24 1.872-3.945 2.302zm26.289-13.438h15.488v3.32h-11.874v7.148c0.573-0.195 1.146-0.34 1.719-0.43 0.573-0.105 1.146-0.156 1.719-0.156 3.255 0 5.833 0.893 7.734 2.676s2.852 4.199 2.852 7.246c0 3.139-0.977 5.578-2.93 7.324-1.954 1.732-4.708 2.598-8.262 2.598-1.224 0-2.474-0.104-3.75-0.312-1.263-0.207-2.571-0.521-3.926-0.938v-3.965c1.172 0.639 2.383 1.113 3.633 1.426s2.572 0.469 3.965 0.469c2.253 0 4.037-0.594 5.352-1.777s1.972-2.793 1.972-4.824-0.657-3.639-1.972-4.824-3.099-1.775-5.352-1.775c-1.055 0-2.109 0.117-3.164 0.352-1.041 0.234-2.109 0.6-3.203 1.092l-1e-3 -14.65zm33.867 15.313c-1.875 0-3.353 0.502-4.434 1.506-1.067 1.002-1.601 2.383-1.601 4.141s0.534 3.137 1.601 4.139c1.082 1.004 2.56 1.506 4.434 1.506 1.875 0 3.354-0.502 4.434-1.504 1.08-1.016 1.62-2.396 1.62-4.141 0-1.758-0.54-3.139-1.62-4.141-1.068-1.004-2.546-1.506-4.434-1.506zm-3.945-1.68c-1.693-0.416-3.015-1.203-3.965-2.363-0.938-1.158-1.406-2.57-1.406-4.236 0-2.332 0.827-4.174 2.48-5.527 1.667-1.354 3.945-2.029 6.836-2.029 2.904 0 5.183 0.676 6.836 2.027 1.653 1.355 2.48 3.197 2.48 5.529 0 1.666-0.475 3.078-1.425 4.236-0.938 1.16-2.247 1.947-3.926 2.363 1.9 0.443 3.378 1.311 4.434 2.598 1.067 1.289 1.601 2.865 1.601 4.729 0 2.824-0.866 4.992-2.598 6.504-1.719 1.51-4.186 2.266-7.402 2.266s-5.69-0.756-7.422-2.266c-1.719-1.512-2.578-3.68-2.578-6.504 0-1.863 0.534-3.439 1.602-4.729 1.067-1.289 2.551-2.154 4.453-2.598zm-1.446-6.228c0 1.51 0.469 2.688 1.407 3.533 0.95 0.848 2.278 1.271 3.984 1.271 1.693 0 3.015-0.424 3.965-1.271 0.963-0.848 1.445-2.023 1.445-3.535 0-1.51-0.481-2.688-1.445-3.535-0.951-0.846-2.272-1.271-3.965-1.271-1.706 0-3.034 0.426-3.984 1.271-0.938 0.847-1.407 2.025-1.407 3.537z"+ fill="#fff"+ fill-opacity=".784"+ />+ <path+ d="m325.45 388.23h6.444v-22.246l-7.012 1.406v-3.594l6.973-1.406h3.946v25.84h6.444v3.32h-16.797l2e-3 -3.32zm36.738-12.404c1.889 0.404 3.359 1.244 4.415 2.521 1.067 1.275 1.602 2.852 1.602 4.727 0 2.877-0.989 5.105-2.969 6.68-1.979 1.576-4.791 2.363-8.438 2.363-1.224 0-2.487-0.123-3.79-0.371-1.288-0.232-2.622-0.592-4.003-1.074v-3.809c1.094 0.639 2.292 1.121 3.595 1.445 1.303 0.326 2.662 0.488 4.082 0.488 2.474 0 4.354-0.488 5.645-1.465 1.302-0.977 1.953-2.396 1.953-4.258 0-1.719-0.605-3.061-1.816-4.023-1.197-0.977-2.871-1.465-5.02-1.465h-3.398v-3.242h3.556c1.939 0 3.425-0.385 4.453-1.152 1.028-0.781 1.543-1.9 1.543-3.359 0-1.496-0.533-2.643-1.603-3.438-1.055-0.807-2.571-1.209-4.55-1.209-1.081 0-2.24 0.115-3.479 0.35-1.236 0.234-2.598 0.6-4.081 1.096v-3.518c1.497-0.416 2.896-0.729 4.198-0.938 1.315-0.209 2.553-0.312 3.71-0.312 2.996 0 5.365 0.686 7.11 2.053 1.744 1.354 2.616 3.189 2.616 5.508 0 1.613-0.462 2.98-1.386 4.102-0.923 1.103-2.239 1.872-3.945 2.3zm16.915 12.404h13.771v3.32h-18.518v-3.32c1.498-1.551 3.536-3.627 6.114-6.23 2.59-2.617 4.218-4.305 4.883-5.059 1.264-1.42 2.143-2.617 2.637-3.594 0.508-0.99 0.762-1.961 0.762-2.91 0-1.549-0.547-2.812-1.64-3.789-1.081-0.977-2.494-1.465-4.239-1.465-1.236 0-2.545 0.215-3.926 0.645-1.367 0.43-2.831 1.08-4.396 1.953v-3.984c1.589-0.639 3.073-1.119 4.453-1.445s2.645-0.488 3.789-0.488c3.021 0 5.43 0.756 7.227 2.268 1.797 1.51 2.695 3.527 2.695 6.055 0 1.195-0.227 2.336-0.684 3.418-0.441 1.066-1.256 2.33-2.441 3.789-0.325 0.377-1.36 1.471-3.104 3.279-1.746 1.796-4.206 4.315-7.383 7.557zm22.753 0h6.447v-22.246l-7.014 1.406v-3.594l6.975-1.406h3.943v25.84h6.445v3.32h-16.798l2e-3 -3.32zm49.472-12.404c1.889 0.404 3.358 1.244 4.414 2.521 1.067 1.275 1.604 2.852 1.604 4.727 0 2.877-0.99 5.105-2.971 6.68-1.979 1.576-4.791 2.363-8.438 2.363-1.223 0-2.485-0.123-3.788-0.371-1.289-0.232-2.623-0.592-4.005-1.074v-3.809c1.095 0.639 2.293 1.121 3.595 1.445 1.303 0.326 2.664 0.488 4.082 0.488 2.475 0 4.354-0.488 5.645-1.465 1.303-0.977 1.953-2.396 1.953-4.258 0-1.719-0.605-3.061-1.814-4.023-1.198-0.977-2.873-1.465-5.021-1.465h-3.396v-3.242h3.554c1.94 0 3.424-0.385 4.453-1.152 1.028-0.781 1.543-1.9 1.543-3.359 0-1.496-0.533-2.643-1.603-3.438-1.055-0.807-2.569-1.209-4.551-1.209-1.08 0-2.238 0.115-3.477 0.35-1.236 0.234-2.599 0.6-4.082 1.096v-3.518c1.497-0.416 2.897-0.729 4.2-0.938 1.314-0.209 2.552-0.312 3.709-0.312 2.996 0 5.365 0.686 7.109 2.053 1.746 1.354 2.617 3.189 2.617 5.508 0 1.613-0.461 2.98-1.387 4.102-0.923 1.103-2.238 1.872-3.945 2.3zm24.356-10l-9.959 15.568h9.959v-15.568zm-1.036-3.435h4.961v19.004h4.159v3.281h-4.159v6.875h-3.925v-6.875h-13.166v-3.811l12.132-18.477h-2e-3v3e-3zm15.706 0h15.486v3.32h-11.875v7.146c0.574-0.195 1.146-0.338 1.721-0.43 0.572-0.104 1.146-0.156 1.718-0.156 3.256 0 5.834 0.893 7.735 2.676 1.9 1.785 2.851 4.199 2.851 7.246 0 3.139-0.978 5.58-2.931 7.324-1.953 1.73-4.707 2.598-8.262 2.598-1.223 0-2.473-0.104-3.75-0.311-1.262-0.209-2.57-0.521-3.926-0.939v-3.965c1.172 0.639 2.383 1.113 3.633 1.426 1.25 0.314 2.572 0.469 3.967 0.469 2.252 0 4.035-0.592 5.351-1.775 1.315-1.186 1.973-2.793 1.973-4.824s-0.656-3.641-1.973-4.824c-1.314-1.186-3.099-1.777-5.351-1.777-1.055 0-2.108 0.117-3.164 0.352-1.043 0.234-2.11 0.6-3.203 1.094v-14.65zm25.466 0h15.489v3.32h-11.877v7.146c0.572-0.195 1.146-0.338 1.72-0.43 0.571-0.104 1.146-0.156 1.719-0.156 3.256 0 5.832 0.893 7.733 2.676 1.9 1.785 2.853 4.199 2.853 7.246 0 3.139-0.978 5.58-2.93 7.324-1.953 1.73-4.707 2.598-8.263 2.598-1.225 0-2.475-0.104-3.75-0.311-1.264-0.209-2.571-0.521-3.926-0.939v-3.965c1.172 0.639 2.383 1.113 3.633 1.426 1.25 0.314 2.572 0.469 3.965 0.469 2.252 0 4.037-0.592 5.353-1.775 1.313-1.186 1.973-2.793 1.973-4.824s-0.658-3.641-1.973-4.824c-1.316-1.186-3.101-1.777-5.353-1.777-1.055 0-2.108 0.117-3.164 0.352-1.043 0.234-2.108 0.6-3.202 1.094v-14.65z"+ fill="#fff"+ fill-opacity=".784"+ />+</svg>\ No newline at end of filediff --git a/public/assets/images/card-visa.svg b/public/assets/images/card-visa.svgnew file mode 100644index 000000000..4fded8808--- /dev/null+++ b/public/assets/images/card-visa.svg@@ -0,0 +1,21 @@+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="780"+ height="500"+ enable-background="new 0 0 780 500"+ version="1.1"+ viewBox="0 0 780 500"+>+ <path+ d="M40,0h700c22.092,0,40,17.909,40,40v420c0,22.092-17.908,40-40,40H40c-22.091,0-40-17.908-40-40V40 C0,17.909,17.909,0,40,0z"+ fill="#0E4595"+ />+ <path+ d="m293.2 348.73l33.361-195.76h53.36l-33.385 195.76h-53.336zm246.11-191.54c-10.57-3.966-27.137-8.222-47.822-8.222-52.725 0-89.865 26.55-90.18 64.603-0.299 28.13 26.514 43.822 46.752 53.186 20.771 9.595 27.752 15.714 27.654 24.283-0.131 13.121-16.586 19.116-31.922 19.116-21.357 0-32.703-2.967-50.227-10.276l-6.876-3.11-7.489 43.823c12.463 5.464 35.51 10.198 59.438 10.443 56.09 0 92.5-26.246 92.916-66.882 0.199-22.269-14.016-39.216-44.801-53.188-18.65-9.055-30.072-15.099-29.951-24.268 0-8.137 9.668-16.839 30.557-16.839 17.449-0.27 30.09 3.535 39.938 7.5l4.781 2.26 7.232-42.429m137.31-4.223h-41.232c-12.773 0-22.332 3.487-27.941 16.234l-79.244 179.4h56.031s9.16-24.123 11.232-29.418c6.125 0 60.555 0.084 68.338 0.084 1.596 6.853 6.49 29.334 6.49 29.334h49.514l-43.188-195.64zm-65.418 126.41c4.412-11.279 21.26-54.723 21.26-54.723-0.316 0.522 4.379-11.334 7.074-18.684l3.605 16.879s10.219 46.729 12.354 56.528h-44.293zm-363.3-126.41l-52.24 133.5-5.567-27.13c-9.725-31.273-40.025-65.155-73.898-82.118l47.766 171.2 56.456-0.064 84.004-195.39h-56.521"+ fill="#fff"+ />+ <path+ d="m146.92 152.96h-86.041l-0.681 4.073c66.938 16.204 111.23 55.363 129.62 102.41l-18.71-89.96c-3.23-12.395-12.597-16.094-24.186-16.527"+ fill="#F2AE14"+ />+</svg>\ No newline at end of filediff --git a/public/components/common/CardInfo.scss b/public/components/common/CardInfo.scssnew file mode 100644index 000000000..6360d9008--- /dev/null+++ b/public/components/common/CardInfo.scss@@ -0,0 +1,17 @@+@import '~@fider/assets/styles/variables.scss';++.c-card-info {+ span, img {+ vertical-align: middle;+ margin-right: 5px;+ }+ img {+ max-width: 40px;+ max-height: 40px;+ }+ .c-card-info-exp {+ margin-left: 5px;+ font-size: $font-size-small;+ color: $gray-darker;+ }+}\ No newline at end of filediff --git a/public/components/common/CardInfo.tsx b/public/components/common/CardInfo.tsxnew file mode 100644index 000000000..59e026a79--- /dev/null+++ b/public/components/common/CardInfo.tsx@@ -0,0 +1,50 @@+import React from "react";+import "./CardInfo.scss";+import { Fider } from "@fider/services";++const visa = require("@fider/assets/images/card-visa.svg");+const diners = require("@fider/assets/images/card-diners.svg");+const americanExpress = require("@fider/assets/images/card-americanexpress.svg");+const discover = require("@fider/assets/images/card-discover.svg");+const jcb = require("@fider/assets/images/card-jcb.svg");+const unknown = require("@fider/assets/images/card-unknown.svg");+const masterCard = require("@fider/assets/images/card-mastercard.svg");++interface CardBrandProps {+ brand: string;+ last4: string;+ expMonth: number;+ expYear: number;+}++export const CardInfo = (props: CardBrandProps) => {+ return (+ <p className="c-card-info">+ <img src={`${Fider.settings.globalAssetsURL}${brandImage(props.brand)}`} alt={props.brand} />+ <span>+ **** **** **** {props.last4}{" "}+ <span className="c-card-info-exp">+ Exp. {props.expMonth}/{props.expYear}+ </span>+ </span>+ </p>+ );+};++const brandImage = (brand: string) => {+ switch (brand) {+ case "Visa":+ return visa;+ case "American Express":+ return americanExpress;+ case "MasterCard":+ return masterCard;+ case "Discover":+ return discover;+ case "JCB":+ return jcb;+ case "Diners Club":+ return diners;+ }+ return unknown;+};diff --git a/public/components/common/form/DisplayError.tsx b/public/components/common/form/DisplayError.tsxindex bea46ca4a..07c6b775a 100644--- a/public/components/common/form/DisplayError.tsx+++ b/public/components/common/form/DisplayError.tsx@@ -10,8 +10,8 @@ interface DisplayErrorProps {fields?: string[];}-export const hasError = (field: string, error?: Failure): boolean => {- if (error && error.errors) {+export const hasError = (field?: string, error?: Failure): boolean => {+ if (field && error && error.errors) {for (const err of error.errors) {if (err.field === field) {return true;diff --git a/public/components/common/form/Field.tsx b/public/components/common/form/Field.tsxindex 7ec779270..72bf6b769 100644--- a/public/components/common/form/Field.tsx+++ b/public/components/common/form/Field.tsx@@ -1,21 +1,37 @@import React from "react";import { classSet } from "@fider/services";+import { ValidationContext } from "./Form";+import { DisplayError, hasError } from "./DisplayError";interface FieldProps {className?: string;label?: string;+ field?: string;+ afterLabel?: JSX.Element;}export const Field: React.StatelessComponent<FieldProps> = props => {+ const fields = props.field ? [props.field] : undefined;return (- <div- className={classSet({- "c-form-field": true,- [props.className!]: props.className- })}- >- {!!props.label && <label>{props.label}</label>}- {props.children}- </div>+ <ValidationContext.Consumer>+ {ctx => (+ <div+ className={classSet({+ "c-form-field": true,+ "m-error": hasError(props.field, ctx.error),+ [props.className!]: props.className+ })}+ >+ {!!props.label && (+ <label>+ {props.label}+ {props.afterLabel}+ </label>+ )}+ {props.children}+ <DisplayError fields={fields} error={ctx.error} />+ </div>+ )}+ </ValidationContext.Consumer>);};diff --git a/public/components/common/form/Form.scss b/public/components/common/form/Form.scssindex 0e8b2d37b..cad38b9f5 100644--- a/public/components/common/form/Form.scss+++ b/public/components/common/form/Form.scss@@ -44,53 +44,51 @@.c-form-field-wrapper {position: relative;margin: 0 0 5px;+ }- input[type=text],- textarea,- select {- -webkit-appearance: none;- appearance: none;- width: 100%;- padding: 10px;- outline: 0;- margin: 0;- resize: none !important;- border: 1px solid $gray-light;- border-radius: 3px;-- &:focus {- border: 1px solid $gray;- box-shadow: 0px 0px 1px 1px $gray-light;- }-- &:disabled {- opacity: .45;- cursor: not-allowed;- }- & + .icon {- pointer-events: none;- cursor: default;- position: absolute;- opacity: .5;- width: 35px;- height: 100%;- padding: 12px 0px;- margin: 0;- top: 0;- right: 0;- position: absolute;-- &.link {- cursor: pointer;- pointer-events: inherit;- }- }+ input[type=text],+ textarea,+ select,+ .StripeElement {+ background-color: $white;+ -webkit-appearance: none;+ appearance: none;+ width: 100%;+ padding: 10px;+ outline: 0;+ margin: 0;+ resize: none !important;+ border: 1px solid $gray-light;+ border-radius: 3px;++ &:focus {+ border: 1px solid $gray;+ box-shadow: 0px 0px 1px 1px $gray-light;+ }++ &:disabled {+ opacity: .45;+ cursor: not-allowed;}- select {- height: 38px;- background-color: $white;+ & + .icon {+ pointer-events: none;+ cursor: default;+ position: absolute;+ opacity: .5;+ width: 35px;+ height: 100%;+ padding: 12px 0px;+ margin: 0;+ top: 0;+ right: 0;+ position: absolute;++ &.link {+ cursor: pointer;+ pointer-events: inherit;+ }}}diff --git a/public/components/common/index.tsx b/public/components/common/index.tsxindex b15399db7..0fc48dd6a 100644--- a/public/components/common/index.tsx+++ b/public/components/common/index.tsx@@ -1,4 +1,5 @@export * from "./Button";+export * from "./CardInfo";export * from "./form/Form";export * from "./form/Input";export * from "./form/ImageUploader";diff --git a/public/models/billing.ts b/public/models/billing.tsnew file mode 100644index 000000000..255938857--- /dev/null+++ b/public/models/billing.ts@@ -0,0 +1,14 @@+export interface PaymentInfo {+ cardBrand: string;+ cardLast4: string;+ cardExpMonth: number;+ cardExpYear: number;+ addressCity: string;+ addressCountry: string;+ name: string;+ email: string;+ addressLine1: string;+ addressLine2: string;+ addressState: string;+ addressPostalCode: string;+}diff --git a/public/models/index.ts b/public/models/index.tsindex be6347622..317710ccb 100644--- a/public/models/index.ts+++ b/public/models/index.ts@@ -1,4 +1,5 @@export * from "./post";export * from "./identity";+export * from "./billing";export * from "./settings";export * from "./notification";diff --git a/public/pages/Administration/components/PaymentInfoModal.tsx b/public/pages/Administration/components/PaymentInfoModal.tsxnew file mode 100644index 000000000..d828df7f1--- /dev/null+++ b/public/pages/Administration/components/PaymentInfoModal.tsx@@ -0,0 +1,263 @@+import React from "react";+import { injectStripe, CardElement } from "react-stripe-elements";+import { Input, Field, Button, Form, Select, SelectOption, Modal, CardInfo } from "@fider/components";+import { Failure, actions } from "@fider/services";+import { PaymentInfo } from "@fider/models";++type PatchedTokenResponse = stripe.TokenResponse & {+ error?: { decline_code?: string };+};++interface StripeProps {+ createToken(options?: stripe.TokenOptions): Promise<PatchedTokenResponse>;+ createSource(sourceData?: stripe.SourceOptions): Promise<stripe.SourceResponse>;+ paymentRequest: stripe.Stripe["paymentRequest"];+}++interface PaymentInfoModalProps {+ paymentInfo?: PaymentInfo;+ stripe?: StripeProps;+ countries: Array<{ code: string; name: string }>;+ onClose: () => void;+}++interface PaymentInfoModalState {+ changingCard: boolean;+ name: string;+ email: string;+ addressLine1: string;+ addressLine2: string;+ addressCity: string;+ addressState: string;+ addressPostalCode: string;+ addressCountry: string;+ stripe: stripe.Stripe | null;+ error?: Failure;+}++class PaymentInfoModal extends React.Component<PaymentInfoModalProps, PaymentInfoModalState> {+ constructor(props: PaymentInfoModalProps) {+ super(props);+ this.state = {+ stripe: null,+ changingCard: false,+ name: this.props.paymentInfo ? this.props.paymentInfo.name : "",+ email: this.props.paymentInfo ? this.props.paymentInfo.email : "",+ addressLine1: this.props.paymentInfo ? this.props.paymentInfo.addressLine1 : "",+ addressLine2: this.props.paymentInfo ? this.props.paymentInfo.addressLine2 : "",+ addressCity: this.props.paymentInfo ? this.props.paymentInfo.addressCity : "",+ addressState: this.props.paymentInfo ? this.props.paymentInfo.addressState : "",+ addressPostalCode: this.props.paymentInfo ? this.props.paymentInfo.addressPostalCode : "",+ addressCountry: this.props.paymentInfo ? this.props.paymentInfo.addressCountry : ""+ };+ }++ public handleSubmit = async () => {+ if (this.props.paymentInfo && !this.state.changingCard) {+ const response = await actions.updatePaymentInfo({+ ...this.state+ });++ if (response.ok) {+ location.reload();+ } else {+ this.setState({+ error: response.error+ });+ }++ return;+ }++ if (this.props.stripe) {+ const result = await this.props.stripe.createToken({+ name: this.state.name,+ address_line1: this.state.addressLine1,+ address_line2: this.state.addressLine2,+ address_city: this.state.addressCity,+ address_state: this.state.addressState,+ address_zip: this.state.addressPostalCode,+ address_country: this.state.addressCountry+ });++ if (result.token) {+ const response = await actions.updatePaymentInfo({+ ...this.state,+ card: {+ type: result.token.type,+ token: result.token.id,+ country: result.token.card ? result.token.card.country : ""+ }+ });++ if (response.ok) {+ location.reload();+ } else {+ this.setState({+ error: response.error+ });+ }+ } else if (result.error) {+ this.setState({+ error: {+ errors: [+ {+ field: "card",+ message: result.error.message!+ }+ ]+ }+ });+ }+ }+ };++ private setName = (name: string) => {+ this.setState({ name });+ };++ private setEmail = (email: string) => {+ this.setState({ email });+ };++ private setAddressLine1 = (addressLine1: string) => {+ this.setState({ addressLine1 });+ };++ private setAddressLine2 = (addressLine2: string) => {+ this.setState({ addressLine2 });+ };++ private setAddressCity = (addressCity: string) => {+ this.setState({ addressCity });+ };++ private setAddressState = (addressState: string) => {+ this.setState({ addressState });+ };++ private setAddressPostalCode = (addressPostalCode: string) => {+ this.setState({ addressPostalCode });+ };++ private setAddressCountry = (option: SelectOption | undefined) => {+ if (option) {+ this.setState({ addressCountry: option.value });+ }+ };++ private closeModal = async () => {+ this.props.onClose();+ };++ private changeCard = () => {+ this.setState({ changingCard: true });+ };++ public render() {+ return (+ <Modal.Window isOpen={true} center={false} size="large" onClose={this.props.onClose}>+ <Modal.Content>+ <Form className="c-payment-info-modal" error={this.state.error}>+ <div className="row">+ {(!this.props.paymentInfo || this.state.changingCard) && (+ <div className="col-md-12">+ <Field label="Card" field="card">+ <CardElement />+ <p className="info">+ We neither store or see your card information. We integrate directly with Stripe.+ </p>+ </Field>+ </div>+ )}+ {this.props.paymentInfo && !this.state.changingCard && (+ <div className="col-md-12">+ <Field+ label="Card"+ field="card"+ afterLabel={+ <span className="ui info clickable" onClick={this.changeCard}>+ change+ </span>+ }+ >+ <CardInfo+ expMonth={this.props.paymentInfo.cardExpMonth}+ expYear={this.props.paymentInfo.cardExpYear}+ brand={this.props.paymentInfo.cardBrand}+ last4={this.props.paymentInfo.cardLast4}+ />+ </Field>+ </div>+ )}+ <div className="col-md-12">+ <Input label="Name" field="name" value={this.state.name} onChange={this.setName} />+ </div>+ <div className="col-md-12">+ <Input label="Email" field="email" value={this.state.email} onChange={this.setEmail} />+ </div>+ <div className="col-md-6">+ <Input+ label="Address Line 1"+ value={this.state.addressLine1}+ field="addressLine1"+ onChange={this.setAddressLine1}+ />+ </div>+ <div className="col-md-6">+ <Input+ label="Address Line 2"+ value={this.state.addressLine2}+ field="addressLine2"+ onChange={this.setAddressLine2}+ />+ </div>+ <div className="col-md-3">+ <Input label="City" field="addressCity" value={this.state.addressCity} onChange={this.setAddressCity} />+ </div>+ <div className="col-md-3">+ <Input+ label="State / Region"+ field="addressState"+ value={this.state.addressState}+ onChange={this.setAddressState}+ />+ </div>+ <div className="col-md-3">+ <Input+ label="Postal Code"+ field="addressPostalCode"+ value={this.state.addressPostalCode}+ onChange={this.setAddressPostalCode}+ />+ </div>+ <div className="col-md-3">+ <Select+ label="Country"+ field="addressCountry"+ onChange={this.setAddressCountry}+ defaultValue={this.state.addressCountry}+ options={[+ { value: "", label: "" },+ ...this.props.countries.map(x => ({ value: x.code, label: x.name }))+ ]}+ />+ </div>+ </div>+ </Form>+ </Modal.Content>++ <Modal.Footer>+ <Button onClick={this.handleSubmit} color="positive">+ Save+ </Button>+ <Button color="cancel" onClick={this.closeModal}>+ Close+ </Button>+ </Modal.Footer>+ </Modal.Window>+ );+ }+}++export default injectStripe(PaymentInfoModal);diff --git a/public/pages/Administration/pages/Billing.page.scss b/public/pages/Administration/pages/Billing.page.scssnew file mode 100644index 000000000..d76cfd728--- /dev/null+++ b/public/pages/Administration/pages/Billing.page.scss@@ -0,0 +1,4 @@+@import '~@fider/assets/styles/variables.scss';++#p-admin-billing {+}\ No newline at end of filediff --git a/public/pages/Administration/pages/Billing.page.tsx b/public/pages/Administration/pages/Billing.page.tsxindex 37ae5eb7c..51b119dab 100644--- a/public/pages/Administration/pages/Billing.page.tsx+++ b/public/pages/Administration/pages/Billing.page.tsx@@ -1,16 +1,103 @@+import "./Billing.page.scss";+import React from "react";import { FaFileInvoice } from "react-icons/fa";import { AdminBasePage } from "../components/AdminBasePage";+import { Segment, Button, CardInfo } from "@fider/components";+import { PaymentInfo } from "@fider/models";+import { Fider } from "@fider/services";+import PaymentInfoModal from "../components/PaymentInfoModal";+import { StripeProvider, Elements } from "react-stripe-elements";++interface BillingPageProps {+ paymentInfo?: PaymentInfo;+ countries: Array<{ code: string; name: string }>;+}++interface BillingPageState {+ stripe: stripe.Stripe | null;+ showModal: boolean;+}-export default class BillingPage extends AdminBasePage<{}, {}> {+export default class BillingPage extends AdminBasePage<BillingPageProps, BillingPageState> {public id = "p-admin-billing";public name = "billing";public icon = FaFileInvoice;public title = "Billing";public subtitle = "Manage your subscription";+ constructor(props: BillingPageProps) {+ super(props);+ this.state = {+ stripe: null,+ showModal: false+ };+ }++ private openModal = async () => {+ if (!this.state.stripe) {+ const script = document.createElement("script");+ script.src = "https://js.stripe.com/v3/";+ script.onload = () => {+ this.setState({+ stripe: Stripe(Fider.settings.stripePublicKey!),+ showModal: true+ });+ };+ document.body.appendChild(script);+ } else {+ this.setState({+ showModal: true+ });+ }+ };++ private closeModal = async () => {+ this.setState({+ showModal: false+ });+ };+public content() {- return <h4>Work in progress</h4>;+ return (+ <>+ {this.state.showModal && (+ <StripeProvider stripe={this.state.stripe}>+ <Elements>+ <PaymentInfoModal+ paymentInfo={this.props.paymentInfo}+ countries={this.props.countries}+ onClose={this.closeModal}+ />+ </Elements>+ </StripeProvider>+ )}+ <div className="row">+ <div className="col-md-4">+ <Segment className="l-payment-info">+ <h4>Payment Info</h4>+ {this.props.paymentInfo && (+ <>+ <CardInfo+ expMonth={this.props.paymentInfo.cardExpMonth}+ expYear={this.props.paymentInfo.cardExpYear}+ brand={this.props.paymentInfo.cardBrand}+ last4={this.props.paymentInfo.cardLast4}+ />+ <Button onClick={this.openModal}>Edit</Button>+ </>+ )}+ {!this.props.paymentInfo && (+ <>+ <p>You don't have any payment method set up. Start by adding one.</p>+ <Button onClick={this.openModal}>Add</Button>+ </>+ )}+ </Segment>+ </div>+ </div>+ </>+ );}}diff --git a/public/pages/Administration/pages/ManageMembers.page.tsx b/public/pages/Administration/pages/ManageMembers.page.tsxindex d4cd7b0f1..615a3ef9e 100644--- a/public/pages/Administration/pages/ManageMembers.page.tsx+++ b/public/pages/Administration/pages/ManageMembers.page.tsx@@ -188,8 +188,8 @@ export default class ManageMembersPage extends AdminBasePage<ManageMembersPagePr</p><ul className="l-legend info"><li>- <strong>· Administrators</strong> have full access to edit and manage content, permissions and- settings.+ <strong>· Administrators</strong>have full access to edit and manage content, permissions and all+ site settings{Fider.isBillingEnabled ? ", including billing." : "."}</li><li><strong>· Collaborators</strong> can edit and manage content, but not permissions and settings.diff --git a/public/services/actions/billing.ts b/public/services/actions/billing.tsnew file mode 100644index 000000000..5bfbc8008--- /dev/null+++ b/public/services/actions/billing.ts@@ -0,0 +1,20 @@+import { http, Result } from "@fider/services";++interface UpdatePaymentInfoRequest {+ name: string;+ card?: {+ type: string;+ token: string;+ country: string;+ };+ addressLine1: string;+ addressLine2: string;+ addressCity: string;+ addressState: string;+ addressPostalCode: string;+ addressCountry: string;+}++export const updatePaymentInfo = async (request: UpdatePaymentInfoRequest): Promise<Result> => {+ return http.post("/_api/admin/billing/paymentinfo", request).then(http.event("billing", "updatepaymentinfo"));+};diff --git a/public/services/actions/index.ts b/public/services/actions/index.tsindex ade45197f..89511ab7d 100644--- a/public/services/actions/index.ts+++ b/public/services/actions/index.ts@@ -2,6 +2,7 @@ export * from "./user";export * from "./tag";export * from "./post";export * from "./tenant";+export * from "./billing";export * from "./notification";export * from "./invite";export * from "./infra";diff --git a/vendor/github.com/stripe/stripe-go/.gitignore b/vendor/github.com/stripe/stripe-go/.gitignorenew file mode 100644index 000000000..d35143d26--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/.gitignore@@ -0,0 +1,9 @@+.env+*.test+*.coverprofile+++# Because our only dependencies are test-related, I'm leaving out `go.sum` for+# the time being. Feel free to revisit this decision in the future if it+# appears to be causing problems.+/go.sumdiff --git a/vendor/github.com/stripe/stripe-go/.travis.yml b/vendor/github.com/stripe/stripe-go/.travis.ymlnew file mode 100644index 000000000..31a298964--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/.travis.yml@@ -0,0 +1,58 @@+before_install:+ # Install various build dependencies. We use `travis_retry` because `go get`+ # will occasionally fail intermittently.++ # The testify require framework is used for assertions in the test suite+ - travis_retry go get -u github.com/stretchr/testify/require++ # Install lint / code coverage / coveralls tooling+ - travis_retry go get -u golang.org/x/net/http2+ - travis_retry go get -u golang.org/x/tools/cmd/cover+ - travis_retry go get -u github.com/modocache/gover+ - travis_retry go get -u github.com/mattn/goveralls+ - travis_retry go get -u golang.org/x/lint/golint++ # Unpack and start the Stripe API stub so that the test suite can talk to it+ - |+ if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then+ mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/+ curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"+ tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"+ fi+ - |+ stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock -https-port 12112 > /dev/null &+ STRIPE_MOCK_PID=$!++cache:+ directories:+ - stripe-mock++env:+ global:+ # If changing this number, please also change it in `testing/testing.go`.+ - STRIPE_MOCK_VERSION=0.38.0++go:+ - "1.9"+ - "1.10"+ - "1.11"+ - tip++language: go++matrix:+ allow_failures:+ - go: tip+ fast_finish: true++script:+ - make+ - make coverage++after_script:+ # Merge all coverage reports located in subdirectories and put them under: gover.coverprofile+ - gover+ # Send code coverage report to coveralls.io+ - goveralls -service=travis-ci -coverprofile=gover.coverprofile++sudo: falsediff --git a/vendor/github.com/stripe/stripe-go/CHANGELOG b/vendor/github.com/stripe/stripe-go/CHANGELOGnew file mode 100644index 000000000..1d38c0c54--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/CHANGELOG@@ -0,0 +1 @@+CHANGELOG has changed to be Markdown-formatted. Please see CHANGELOG.md.diff --git a/vendor/github.com/stripe/stripe-go/CHANGELOG.md b/vendor/github.com/stripe/stripe-go/CHANGELOG.mdnew file mode 100644index 000000000..fd494f737--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/CHANGELOG.md@@ -0,0 +1,1013 @@+# Changelog++## 55.3.0 - 2019-01-02+* [#742](https://github.com/stripe/stripe-go/pull/742) Add field `FraudType` to `IssuerFraudRecord`++## 55.2.0 - 2018-12-31+* [#741](https://github.com/stripe/stripe-go/pull/741) Add missing parameters `InvoiceNow` and `Prorate` for subscription cancellation++## 55.1.0 - 2018-12-27+* [#743](https://github.com/stripe/stripe-go/pull/743) Add support for `clear_usage` on `SubscriptionItem` deletion++## 55.0.0 - 2018-12-13+* [#739](https://github.com/stripe/stripe-go/pull/739) Use `ApplicationFee` struct for `FeeRefund.Fee` (minor breaking change)++## 54.2.0 - 2018-11-30+* [#734](https://github.com/stripe/stripe-go/pull/734) Put `/v1/` prefix as part of all paths instead of URL++## 54.1.1 - 2018-11-30+* [#733](https://github.com/stripe/stripe-go/pull/733) Fix malformed URL generated for the uploads API when using `NewBackends`++## 54.1.0 - 2018-11-28+* [#730](https://github.com/stripe/stripe-go/pull/730) Add support for the Review resource+* [#731](https://github.com/stripe/stripe-go/pull/731) Add missing properties on the Refund resource++## 54.0.0 - 2018-11-27+* [#721](https://github.com/stripe/stripe-go/pull/721) Add support for `RadarValueList` and `RadarValueListItem`+* [#721](https://github.com/stripe/stripe-go/pull/721) Remove `Closed` and `Forgiven` from `InvoiceParams`+* [#721](https://github.com/stripe/stripe-go/pull/721) Add `PaidOutOfBand` to `InvoicePayParams`++## 53.4.0 - 2018-11-26+* [#728](https://github.com/stripe/stripe-go/pull/728) Add `IssuingCard` to `EphemeralKeyParams`++## 53.3.0 - 2018-11-26+* [#727](https://github.com/stripe/stripe-go/pull/727) Add support for `TransferData` on payment intent create and update++## 53.2.0 - 2018-11-21+* [#725](https://github.com/stripe/stripe-go/pull/725) Improved error deserialization++## 53.1.0 - 2018-11-15+* [#723](https://github.com/stripe/stripe-go/pull/723) Add support for `last_payment_error` on `PaymentIntent`.+* [#724](https://github.com/stripe/stripe-go/pull/724) Add support for `transfer_data[destination]` on `PaymentIntent`.++## 53.0.1 - 2018-11-12+* [#714](https://github.com/stripe/stripe-go/pull/714) Fix bug in retry logic that would cause the client to panic++## 53.0.0 - 2018-11-08+* [#716](https://github.com/stripe/stripe-go/pull/716) Drop support for Go 1.8.+* [#715](https://github.com/stripe/stripe-go/pull/715) Ship changes to the `PaymentIntent` resource to match the final layout.+* [#717](https://github.com/stripe/stripe-go/pull/717) Add support for `flat_amount` on `Plan` tiers.+* [#718](https://github.com/stripe/stripe-go/pull/718) Add support for `supported_transfer_countries` on `CountrySpec`.+* [#720](https://github.com/stripe/stripe-go/pull/720) Add support for `review` on `PaymentIntent`.+* [#707](https://github.com/stripe/stripe-go/pull/707) Add new invoice methods and fixes to the Issuing Cardholder resource (multiple breaking changes)+ * Move to API version 2018-11-08.+ * Add support for new API methods, properties and parameters for `Invoice`.+ * Add support for `default_source` on `Subscription` and `Invoice`.++## 52.1.0 - 2018-10-31+* [#705](https://github.com/stripe/stripe-go/pull/705) Add support for the `Person` resource+* [#706](https://github.com/stripe/stripe-go/pull/706) Add support for the `WebhookEndpoint` resource++## 52.0.0 - 2018-10-29+* [#711](https://github.com/stripe/stripe-go/pull/711) Set `Request.GetBody` when making requests+* [#711](https://github.com/stripe/stripe-go/pull/711) Drop support for Go 1.7 (hasn't been supported by Go core since the release of Go 1.9 in August 2017)++## 51.4.0 - 2018-10-19+* [#708](https://github.com/stripe/stripe-go/pull/708) Add Stripe Terminal endpoints to master to `client.API`++## 51.3.0 - 2018-10-09+* [#704](https://github.com/stripe/stripe-go/pull/704) Add support for `subscription_cancel_at_period_end` on the Upcoming Invoice API.++## 51.2.0 - 2018-10-09+* [#702](https://github.com/stripe/stripe-go/pull/702) Add support for `delivery_success` filter when listing Events.++## 51.1.0 - 2018-10-03+* [#700](https://github.com/stripe/stripe-go/pull/700) Add support for `on_behalf_of` on Subscription and Charge resources.++## 51.0.0 - 2018-09-27+* [#698](https://github.com/stripe/stripe-go/pull/698) Move to API version 2018-09-24+ * Rename `FileUpload` to `File` (and all `FileUpload*` structs to `File*`)+ * Fix file links client++## 50.0.0 - 2018-09-24+* [#695](https://github.com/stripe/stripe-go/pull/695) Rename `Transaction` to `DisputedTransaction` in `IssuingDisputeParams` (minor breaking change)+* [#695](https://github.com/stripe/stripe-go/pull/695) Add support for Stripe Terminal++## 49.2.0 - 2018-09-24+* [#697](https://github.com/stripe/stripe-go/pull/697) Fix `number` JSON tag on the `IssuingCardDetails` resource.++## 49.1.0 - 2018-09-11+* [#694](https://github.com/stripe/stripe-go/pull/694) Add `ErrorCodeResourceMissing` error code constant++## 49.0.0 - 2018-09-11+* [#693](https://github.com/stripe/stripe-go/pull/693) Change `Product` under `Plan` from a string to a full `Product` struct pointer (this is a minor breaking change -- upgrade by changing to `plan.Product.ID`)++## 48.3.0 - 2018-09-06+* [#691](https://github.com/stripe/stripe-go/pull/691) Add `InvoicePrefix` to `Customer` and `CustomerParams`++## 48.2.0 - 2018-09-05+* [#690](https://github.com/stripe/stripe-go/pull/690) Add support for reporting resources++## 48.1.0 - 2018-09-05+* [#683](https://github.com/stripe/stripe-go/pull/683) Add `StatusTransitions` filter parameters to `OrderListParams`++## 48.0.0 - 2018-09-05+* [#681](https://github.com/stripe/stripe-go/pull/681) Handle deserialization of `OrderItem` parent into an object if expanded (minor breaking change)++## 47.0.0 - 2018-09-04+* New major version for better compatibility with Go's new module system (no breaking changes)++## 46.1.0 - 2018-09-04+* [#688](https://github.com/stripe/stripe-go/pull/688) Encode `Params` in `AppendToAsSourceOrExternalAccount` (bug fix)+* [#689](https://github.com/stripe/stripe-go/pull/689) Add `go.mod` for the new module system++## 46.0.0 - 2018-09-04+* [#686](https://github.com/stripe/stripe-go/pull/686) Add `Mandate` and `Receiver` to `SourceObjectParams` and change `Date` on `SourceMandateAcceptance` to `int64` (minor breaking change)++## 45.0.0 - 2018-08-30+* [#680](https://github.com/stripe/stripe-go/pull/680) Change `SubscriptionTaxPercent` on `Invoice` from `int64` to `float64` (minor breaking change)++## 44.0.0 - 2018-08-28+* [#678](https://github.com/stripe/stripe-go/pull/678) Allow payment intent capture to take its own parameters++## 43.1.1 - 2018-08-28+* [#675](https://github.com/stripe/stripe-go/pull/675) Fix incorrectly encoded parameter in `UsageRecordSummaryListParams`++## 43.1.0 - 2018-08-28+* [#669](https://github.com/stripe/stripe-go/pull/669) Add `AuthorizationCode` to `Charge`+* [#671](https://github.com/stripe/stripe-go/pull/671) Fix deserialization of `TaxID` on `CustomerTaxInfo`++## 43.0.0 - 2018-08-23+* [#668](https://github.com/stripe/stripe-go/pull/668) Move to API version 2018-08-23+ * Add `TaxInfo` and `TaxInfoVerification` to `Customer`+ * Rename `Amount` to `UnitAmount` on `PlanTierParams`+ * Remove `BusinessVATID` from `Customer`+ * Remove `AtPeriodEnd` from `SubscriptionCancelParams`++## 42.3.0 - 2018-08-23+* [#667](https://github.com/stripe/stripe-go/pull/667) Add `Forgive` to `InvoicePayParams`++## 42.2.0 - 2018-08-22+* [#666](https://github.com/stripe/stripe-go/pull/666) Add `Subscription` to `SubscriptionItem`++## 42.1.0 - 2018-08-22+* [#664](https://github.com/stripe/stripe-go/pull/664) Add `AvailablePayoutMethods` to `Card`++## 42.0.0 - 2018-08-20+* [#663](https://github.com/stripe/stripe-go/pull/663) Add support for usage record summaries and rename `Live` on `IssuerFraudRecord, `SourceTransaction`, and `UsageRecord` to `Livemode` (a minor breaking change)++## 41.0.0 - 2018-08-17+* [#659](https://github.com/stripe/stripe-go/pull/659) Remove mutating Bitcoin receiver API calls (these were no longer functional anyway)+* [#661](https://github.com/stripe/stripe-go/pull/661) Correct `IssuingCardShipping`'s type to `int64`+* [#662](https://github.com/stripe/stripe-go/pull/662) Rename `IssuingCardShipping`'s `Eta` to `ETA`++## 40.2.0 - 2018-08-15+* [#657](https://github.com/stripe/stripe-go/pull/657) Use integer-indexed encoding for all arrays++## 40.1.0 - 2018-08-10+* [#656](https://github.com/stripe/stripe-go/pull/656) Expose new `ValidatePayload` functions for validating incoming payloads without constructing an event++## 40.0.2 - 2018-08-07+* [#652](https://github.com/stripe/stripe-go/pull/652) Change the type of `FileUpload.Links` to `FileLinkList` (this is a bug fix given that the previous type would never have worked)++## 40.0.1 - 2018-08-07+* [#653](https://github.com/stripe/stripe-go/pull/653) All `BackendImplementation`s should sleep by default on retries++## 40.0.0 - 2018-08-06+* [#648](https://github.com/stripe/stripe-go/pull/648) Introduce buffers so a request's body can be read multiple times (this modifies the interface of a few exported internal functions so it's technically breaking, but it will probably not be breaking for most users)+* [#649](https://github.com/stripe/stripe-go/pull/649) Rename `BackendConfiguration` to `BackendImplementation` (likewise, technically breaking, but minor)+* [#650](https://github.com/stripe/stripe-go/pull/650) Export `webhook.ComputeSignature`++## 39.0.0 - 2018-08-04+* [#646](https://github.com/stripe/stripe-go/pull/646) Set request body before every retry (this modifies the interface of a few exported internal functions so it's technically breaking, but it will probably not be breaking for most users)++## 38.2.0 - 2018-08-03+* [#644](https://github.com/stripe/stripe-go/pull/644) Add support for file links+* [#645](https://github.com/stripe/stripe-go/pull/645) Add support for `Cancel` to topups++## 38.1.0 - 2018-08-01+* [#643](https://github.com/stripe/stripe-go/pull/643) Bug fix and various code/logging improvements to retry code++## 38.0.0 - 2018-07-30+* [#641](https://github.com/stripe/stripe-go/pull/641) Minor breaking changes to correct a few naming inconsistencies:+ * `IdentityVerificationDetailsCodeScanIdCountryNotSupported` becomes `IdentityVerificationDetailsCodeScanIDCountryNotSupported`+ * `IdentityVerificationDetailsCodeScanIdTypeNotSupported` becomes `IdentityVerificationDetailsCodeScanIDTypeNotSupported`+ * `BitcoinUri` on `BitcoinReceiver` becomes `BitcoinURI`+ * `NetworkId` on `IssuingAuthorization` becomes `NetworkID`++## 37.0.0 - 2018-07-30+* [#637](https://github.com/stripe/stripe-go/pull/637) Add support for Sigma scheduled query runs+* [#639](https://github.com/stripe/stripe-go/pull/639) Move to API version `2018-07-27` (breaking)+ * Remove `SKUs` from `Product`+ * Subscription creation and update can no longer take a source+ * Change `PercentOff` on coupon struct and params from integer to float+* [#640](https://github.com/stripe/stripe-go/pull/640) Add missing field `Created` to `Account`++## 36.3.0 - 2018-07-27+* [#636](https://github.com/stripe/stripe-go/pull/636) Add `RiskScore` to `ChargeOutcome`++## 36.2.0 - 2018-07-26+* [#635](https://github.com/stripe/stripe-go/pull/635) Add support for Stripe Issuing++## 36.1.2 - 2018-07-24+* [#633](https://github.com/stripe/stripe-go/pull/633) Fix encoding of list params for bank accounts and cards++## 36.1.1 - 2018-07-17+* [#627](https://github.com/stripe/stripe-go/pull/627) Wire an `http.Client` from `NewBackends` through to backends++## 36.1.0 - 2018-07-11+* [#624](https://github.com/stripe/stripe-go/pull/624) Add `AutoAdvance` for `Invoice`++## 36.0.0 - 2018-07-09+* [#606](https://github.com/stripe/stripe-go/pull/606) Add support for payment intents+* [#623](https://github.com/stripe/stripe-go/pull/623) Changed `Payout.Destination` from `string` to `*PayoutDestination` to support expanding (minor breaking change)++## 35.13.0 - 2018-07-06+* [#622](https://github.com/stripe/stripe-go/pull/622) Correct position of `DeclineChargeOn` (it was added accidentally on `LegalEntityParams` when it should have been on `AccountParams`)++## 35.12.0 - 2018-07-05+* [#620](https://github.com/stripe/stripe-go/pull/620) Add support for `Quantity` and `UnitAmount` to `InvoiceItemParams` and `Quantity` to `InvoiceItem`++## 35.11.0 - 2018-07-05+* [#618](https://github.com/stripe/stripe-go/pull/618) Add support for `DeclineChargeOn` to `Account` and `AccountParams`++## 35.10.0 - 2018-07-04+* [#616](https://github.com/stripe/stripe-go/pull/616) Adding missing clients to the `API` struct including a `UsageRecords` entry++## 35.9.0 - 2018-07-03+* [#611](https://github.com/stripe/stripe-go/pull/611) Introduce `GetBackendWithConfig` and make logging configurable per backend++## 35.8.0 - 2018-06-28+* [#607](https://github.com/stripe/stripe-go/pull/607) Add support for `PartnerID` from `stripe.SetAppInfo`++## 35.7.0 - 2018-06-26+* [#604](https://github.com/stripe/stripe-go/pull/604) Add extra parameters `CustomerReference` and `ShippingFromZip` to `ChargeLevel3Params` and `ChargeLevel3`++## 35.6.0 - 2018-06-25+* [#603](https://github.com/stripe/stripe-go/pull/603) Add support for Level III data on charge creation++## 35.5.0 - 2018-06-22+* [#601](https://github.com/stripe/stripe-go/pull/601) Add missing parameters for retrieving an upcoming invoice++## 35.4.0 - 2018-06-21+* [#599](https://github.com/stripe/stripe-go/pull/599) Add `ExchangeRate` to `BalanceTransaction`++## 35.3.0 - 2018-06-20+* [#596](https://github.com/stripe/stripe-go/pull/596) Add `Type` to `ProductListParams` so that products can be listed by type++## 35.2.0 - 2018-06-19+* [#595](https://github.com/stripe/stripe-go/pull/595) Add `Product` to `PlanListParams` so that plans can be listed by product++## 35.1.0 - 2018-06-17+* [#592](https://github.com/stripe/stripe-go/pull/592) Add `Name` field to `Coupon` and `CouponParams`++## 35.0.0 - 2018-06-15+* [#557](https://github.com/stripe/stripe-go/pull/557) Add automatic retries for intermittent errors (enabling using `BackendConfiguration.SetMaxNetworkRetries`)+* [#589](https://github.com/stripe/stripe-go/pull/589) Fix all `Get` methods to support standardized parameter structs + remove some deprecated functions+ * `IssuerFraudRecordListParams` now uses `*string` for `Charge` (set it using `stripe.String` like elsewhere)+ * `event.Get` now takes `stripe.EventParams` instead of `Params` for consistency+ * The `Get` method for `countryspec`, `exchangerate`, `issuerfraudrecord` now take an extra params struct parameter to be consistent and allow setting a connected account (use `stripe.CountrySpecParams`, `stripe.ExchangeRateParams`, and `IssuerFraudRecordParams`)+ * `charge.MarkFraudulent` and `charge.MarkSafe` have been removed; use `charge.Update` instead+ * `charge.CloseDispute` and `charge.UpdateDispute` have been removed; use `dispute.Update` or `dispute.Close` instead+ * `loginlink.New` now properly passes its params struct into its API call++## 34.3.0 - 2018-06-14+* [#587](https://github.com/stripe/stripe-go/pull/587) Use `net/http` constants instead of string literals for HTTP verbs (this is an internal cleanup and should not affect library behavior)++## 34.2.0 - 2018-06-14+* [#581](https://github.com/stripe/stripe-go/pull/581) Push parameter encoding into `BackendConfiguration.Call` (this is an internal cleanup and should not affect library behavior)++## 34.1.0 - 2018-06-13+* [#586](https://github.com/stripe/stripe-go/pull/586) Add `AmountPaid`, `AmountRemaining`, `BillingReason` (including new `InvoiceBillingReason` and constants), and `SubscriptionProrationDate` to `Invoice`++## 34.0.0 - 2018-06-12+* [#585](https://github.com/stripe/stripe-go/pull/585) Remove `File` in favor of `FileUpload`, and consolidating both classes which were already nearly identical except `MIMEType` has been replaced by `Type` (this is technically a breaking change, but quite a small one)++## 33.1.0 - 2018-06-12+* [#578](https://github.com/stripe/stripe-go/pull/578) Improve expansion parsing by not discarding unmarshal errors++## 33.0.0 - 2018-06-11+* [#583](https://github.com/stripe/stripe-go/pull/583) Add new account constants, rename one, and fix `DueBy` (this is technically a breaking change, but quite a small one)++## 32.4.1 - 2018-06-11+* [#582](https://github.com/stripe/stripe-go/pull/582) Fix unmarshaling of `LegalEntity` (specifically when we have `legal_entity[additional_owners][][verification]`) so that it comes out as a struct++## 32.4.0 - 2018-06-07+* [#577](https://github.com/stripe/stripe-go/pull/577) Add `DocumentBack` to account legal entity identity verification parameters and response++## 32.3.0 - 2018-06-07+* [#576](https://github.com/stripe/stripe-go/pull/576) Fix plan transform usage to use `BucketSize` instead of `DivideBy`; note this is technically a breaking API change, but we've released it as a minor because the previous manifestation didn't work++## 32.2.0 - 2018-06-06+* [#571](https://github.com/stripe/stripe-go/pull/571) Add `HostedInvoiceURL` and `InvoicePDF` to `Invoice`+* [#573](https://github.com/stripe/stripe-go/pull/573) Add `FormatURLPath` helper to allow safer URL path building++## 32.1.0 - 2018-06-06+* [#572](https://github.com/stripe/stripe-go/pull/572) Add `Active` to plan parameters and response++## 32.0.1 - 2018-06-06+* [#569](https://github.com/stripe/stripe-go/pull/569) Fix unmarshaling of expanded transaction sources in balance transactions++## 32.0.0 - 2018-06-06+* [#544](https://github.com/stripe/stripe-go/pull/544) **MAJOR** changes that make all fields on parameter structs pointers, and rename many fields on parameter and response structs to be consistent with naming in the REST API; we've written [a migration guide with complete details](https://github.com/stripe/stripe-go/blob/master/v32_migration_guide.md) to help with the upgrade++## 31.0.0 - 2018-06-06+* [#566](https://github.com/stripe/stripe-go/pull/566) Support `DisputeParams` in `dispute.Close`++## 30.8.1 - 2018-05-24+* [#562](https://github.com/stripe/stripe-go/pull/562) Add `go.mod` for vgo support++## 30.8.0 - 2018-05-22+* [#558](https://github.com/stripe/stripe-go/pull/558) Add `SubscriptionItem` to `InvoiceLine`++## 30.7.0 - 2018-05-09+* [#552](https://github.com/stripe/stripe-go/pull/552) Add support for issuer fraud records++## 30.6.1 - 2018-05-04+* [#550](https://github.com/stripe/stripe-go/pull/550) Append standard `Params` as well as card options when encoding `CardParams`++## 30.6.0 - 2018-04-17+* [#546](https://github.com/stripe/stripe-go/pull/546) Add `SubParams.TrialFromPlan` and `SubItemsParams.ClearUsage`++## 30.5.0 - 2018-04-09+* [#543](https://github.com/stripe/stripe-go/pull/543) Support listing orders by customer (add `Customer` to `OrderListParams`)++## 30.4.0 - 2018-04-06+* [#541](https://github.com/stripe/stripe-go/pull/541) Add `Mandate` on `Source` (and associated mandate structs)++## 30.3.0 - 2018-04-02+* [#538](https://github.com/stripe/stripe-go/pull/538) Introduce flexible billing primitives for subscriptions++## 30.2.0 - 2018-03-23+* [#535](https://github.com/stripe/stripe-go/pull/535) Add constant for redirect status `not_required` (`RedirectFlowStatusNotRequired`)++## 30.1.0 - 2018-03-17+* [#534](https://github.com/stripe/stripe-go/pull/534) Add `AmountZero` to `InvoiceItemParams`++## 30.0.0 - 2018-03-14+* [#533](https://github.com/stripe/stripe-go/pull/533) Make `DestPayment` under `Transfer` expandable by changing it from a string to a `Charge`++## 29.3.1 - 2018-03-08+* [#530](https://github.com/stripe/stripe-go/pull/530) Fix mixed up types in `CountrySpec.SupportedBankAccountCurrencies`++## 29.3.0 - 2018-03-01+* [#527](https://github.com/stripe/stripe-go/pull/527) Add `MaidenName`, `PersonalIDNumber`, `PersonalIDNumberProvided` fields to `Owner` struct++## 29.2.0 - 2018-02-26+* [#525](https://github.com/stripe/stripe-go/pull/525) Support shipping carrier and tracking number in orders+* [#526](https://github.com/stripe/stripe-go/pull/526) Fix ignored `commonParams` when returning an order++## 29.1.1 - 2018-02-21+* [#522](https://github.com/stripe/stripe-go/pull/522) Bump API version and fix creating plans with a product++## 29.1.0 - 2018-02-21+* [#520](https://github.com/stripe/stripe-go/pull/520) Add support for topups++## 29.0.1 - 2018-02-16+**WARNING:** Please use 29.1.1 instead.+* [#519](https://github.com/stripe/stripe-go/pull/519) Correct the implementation of `PaymentSource.MarshalJSON` to also handle bank account sources++## 29.0.0 - 2018-02-14+**WARNING:** Please use 29.1.1 instead.+* [#518](https://github.com/stripe/stripe-go/pull/518) Bump API version to 2018-02-06 and add support for Product & Plan API++## 28.12.0 - 2018-02-09+* [#517](https://github.com/stripe/stripe-go/pull/517) Add `BillingCycleAnchor` to `Sub` and `BillingCycleAnchorUnchanged` to `SubParams`++## 28.11.0 - 2018-01-29+* [#516](https://github.com/stripe/stripe-go/pull/516) Add `AmountZero` to `PlanParams` to it's possible to send zero values when creating or updating a plan++## 28.10.1 - 2018-01-18+* [#512](https://github.com/stripe/stripe-go/pull/512) Encode empty values found in maps (like `Meta`)++## 28.10.0 - 2018-01-09+* [#509](https://github.com/stripe/stripe-go/pull/509) Plumb through additional possible errors when unmarshaling polymorphic types (please test your integrations while upgrading)++## 28.9.0 - 2018-01-08+* [#506](https://github.com/stripe/stripe-go/pull/506) Add support for recursing into slices in `event.GetObjValue`++## 28.8.0 - 2017-12-12+* [#500](https://github.com/stripe/stripe-go/pull/500) Support sharing for bank accounts and cards (adds `ID` field to bank account and charge parameters)++## 28.7.0 - 2017-12-05+* [#494](https://github.com/stripe/stripe-go/pull/494) Add `Automatic` to `Payout` struct++## 28.6.1 - 2017-11-02+* [#492](https://github.com/stripe/stripe-go/pull/492) Correct name of user agent header used to send Go version to Stripe's API++## 28.6.0 - 2017-10-31+* [#491](https://github.com/stripe/stripe-go/pull/491) Support for exchange rates APIs++## 28.5.0 - 2017-10-27+* [#488](https://github.com/stripe/stripe-go/pull/488) Support for listing source transactions++## 28.4.2 - 2017-10-25+* [#486](https://github.com/stripe/stripe-go/pull/486) Send the required `object=bank_account` parameter when adding a bank account through an account+* [#487](https://github.com/stripe/stripe-go/pull/487) Make bank account's `account_holder_name` and `account_holder_type` parameters truly optional++## 28.4.1 - 2017-10-24+* [#484](https://github.com/stripe/stripe-go/pull/484) Error early when params not specified for card-related API calls++## 28.4.0 - 2017-10-19+* [#477](https://github.com/stripe/stripe-go/pull/477) Support context on API requests with `Params.Context` and `ListParams.Context`++## 28.3.2 - 2017-10-19+* [#479](https://github.com/stripe/stripe-go/pull/479) Pass token in only one of `external_account` *or* source when appending card++## 28.3.1 - 2017-10-17+* [#476](https://github.com/stripe/stripe-go/pull/476) Make initializing new backends concurrency-safe++## 28.3.0 - 2017-10-10+* [#359](https://github.com/stripe/stripe-go/pull/359) Add support for verify sources (added `Values` on `SourceVerifyParams`)++## 28.2.0 - 2017-10-09+* [#472](https://github.com/stripe/stripe-go/pull/472) Add support for `statement_descriptor` in source objects+* [#473](https://github.com/stripe/stripe-go/pull/473) Add support for detaching sources from customers++## 28.1.0 - 2017-10-05+* [#471](https://github.com/stripe/stripe-go/pull/471) Add support for `RedirectFlow.FailureReason` for sources++## 28.0.1 - 2017-10-03+* [#468](https://github.com/stripe/stripe-go/pull/468) Fix encoding of pointer-based scalars (e.g. `Active *bool` in `Product`)+* [#470](https://github.com/stripe/stripe-go/pull/470) Fix concurrent race in `form` package's encoding caches++## 28.0.0 - 2017-09-27+* [#467](https://github.com/stripe/stripe-go/pull/467) Change `Product.Get` to include `ProductParams` for request metadata+* [#467](https://github.com/stripe/stripe-go/pull/467) Fix sending extra parameters on product and SKU requests++## 27.0.2 - 2017-09-26+* [#465](https://github.com/stripe/stripe-go/pull/465) Fix encoding of `CVC` parameter in `CardParams`++## 27.0.1 - 2017-09-20+* [#461](https://github.com/stripe/stripe-go/pull/461) Fix encoding of `TypeData` under sources++## 27.0.0 - 2017-09-19+* [#458](https://github.com/stripe/stripe-go/pull/458) Remove `ChargeParams.Token` (this seems like it was added accidentally)++## 26.0.0 - 2017-09-17+* Introduce `form` package so it's no longer necessary to build conditional structures to encode parameters -- this may result in parameters that were set but previously not encoded to now be encoded so **PLEASE TEST CAREFULLY WHEN UPGRADING**!+* Alphabetize all struct fields -- this may result in position-based struct initialization to fail if it was being used+* Switch to stripe-mock for testing (test suite now runs completely!)+* Remote Displayer interface and Display implementations+* Add `FraudDetails` to `ChargeParams`+* Remove `FraudReport` from `ChargeParams` (use `FraudDetails` instead)++## 25.2.0 - 2017-09-13+* Add `OnBehalfOf` to charge parameters.+* Add `OnBehalfOf` to subscription parameters.++## 25.1.0 - 2017-09-06+* Use bearer token authentication for API requests++## 25.0.0 - 2017-08-21+* All `Del` methods now take params as second argument (which may be `nil`)+* Product `Delete` has been renamed to `Del` for consistency+* Product `Delete` now returns `(*Product, error)` for consistency+* SKU `Delete` has been renamed to `Del` for consistency+* SKU `Delete` now returns `(*SKU, error)` for consistency++## 24.3.0 - 2017-08-08+* Add `FeeZero` to invoice and `TaxPercentZero` to subscription for zeroing values++## 24.2.0 - 2017-07-25+* Add "range queries" for supported parameters (e.g. `created[gte]=123`)++## 24.1.0 - 2017-07-17+* Add metadata to subscription items++## 24.0.0 - 2017-06-27+ `Pay` on invoice now takes specific pay parameters++## 23.2.1 - 2017-06-26+* Fix bank account retrieval when using a customer ID++## 23.2.0 - 2017-06-26+* Support sharing path while creating a source++## 23.1.0 - 2017-06-26+* Add LoginLinks to client list++## 23.0.0 - 2017-06-23+ plan.Del now takes `stripe.PlanParams` as a second argument++## 22.6.0 - 2017-06-19+* Support for ephemeral keys++## 22.5.0 - 2017-06-15+* Support for checking webhook signatures++## 22.4.1 - 2017-06-15+* Fix returned type of subscription items list+* Note: I meant to release this as 22.3.1, but I'm leaving it as it was released++## 22.3.0 - 2017-06-14+* Fix parameters for subscription items list++## 22.2.0 - 2017-06-13+* Support subscription items when getting upcoming invoice+* Support setting subscription's quantity to zero when getting upcoming invoice++## 22.1.1 - 2017-06-12+* Handle `deleted` parameter when updating subscription items in a subscription++## 22.1.0 - 2017-05-25+* Change `Logger` to a `log.Logger`-like interface so other loggers are usable++## 22.0.0 - 2017-05-25+* Add support for login links+* Add support for new `Type` for accounts+* Make `Event` `Request` (renamed from `Req`) a struct with a new idempotency key+* Rename `Event` `UserID` to `Account`++## 21.5.1 - 2017-05-23+* Fix plan update so `TrialPeriod` parameter is sent++## 21.5.0 - 2017-05-15+* Implement `Get` for `RequestValues`++## 21.4.1 - 2017-05-11+* Pass extra parameters to API calls on bank account deletion++## 21.4.0 - 2017-05-04+* Add `Billing` and `DueDate` filters to invoice listing+* Add `Billing` filter to subscription listing++## 21.3.0 - 2017-05-02+* Add `DetailsCode` to `IdentityVerification`++## 21.2.0 - 2017-04-19+* Send user agent information with `X-Stripe-Client-User-Agent`+* Add `stripe.SetAppInfo` for plugin authors to register app information++## 21.1.0 - 2017-04-12+* Allow coupon to be specified when creating orders+* No longer require that items have descriptions when creating orders++## 21.0.0 - 2017-04-07+* Balances are now retrieved by payout instead of by transfer++## 20.0.0 - 2017-04-06+* Bump API version to 2017-04-06: https://stripe.com/docs/upgrades#2017-04-06+* Add support for payouts and recipient transfers+* Change the transfer resource to support its new format+* Deprecate recipient creation+* Disputes under charges are now expandable and collapsed by default+* Rules under charge outcomes are now expandable and collapsed by default++## 19.17.0 - 2017-04-06+* Please see 20.0.0 (bad release)++## 19.16.0 - 2017-03-23+* Allow the ID of an identity document to be passed into an account owner update++## 19.15.0 - 2017-03-22+* Add `ShippingCarrier` to dispute evidence++## 19.14.0 - 2017-03-20+* Add `Period`, `Plan`, and `Quantity` to `InvoiceItem`++## 19.13.0 - 2017-03-20+* Add `AdditionalOwnersEmpty` to allow additional owners to be unset++## 19.12.0 - 2017-03-17+* Add new form of file upload using `io.FileReader` and filename++## 19.11.0 - 2017-03-13+* Add `Token` to `SourceObjectParams`++## 19.10.0 - 2017-03-13+* Add `CouponEmpty` (allowing a coupon to be cleared) to customer parameters+* Add `CouponEmpty` (allowing a coupon to be cleared) to subscription parameters++## 19.9.0 - 2017-03-08+* Add missing value "all" to subscription statuses++## 19.8.0 - 2017-03-02+* Add subscription items client to main `client.API` struct++## 19.7.0 - 2017-03-01+* Add `Statement` (statement descriptor) to `CaptureParams`++## 19.6.0 - 2017-02-22+* Add new parameters for invoices and subscriptions++## 19.5.0 - 2017-02-13+* Add new rich `Destination` type to `ChargeParams`++## 19.4.0 - 2017-02-03+* Support Connect account as payment source++## 19.3.0 - 2017-02-02+* Add transfer group to charges and transfers++## 19.2.0 - 2017-01-23+* Add `Rule` to `ChargeOutcome`++## 19.1.0 - 2017-01-18+* Add support for updating sources++## 19.0.2 - 2017-01-04+* Fix subscription `trial_period_days` to be populated by the right value++## 19.0.1 - 2016-12-08+* Include verification document details when persisting `LegalEntity`++## 19.0.0 - 2016-12-07+* Remote `SubProrationDateNow` field from `InvoiceParams`++## 18.14.1 - 2016-12-05+* Truncate `tax_percent` at four decimals (e.g. 3.9750%) instead of two++## 18.14.0 - 2016-11-23+* Add retrieve method for 3-D Secure resources++## 18.13.0 - 2016-11-15+* Add `PaymentSource` to `API`++## 18.12.0 - 2016-11-14+* Allow bank accounts to be created as a customer source++## 18.11.0 - 2016-11-14+* Add `TrialPeriodEnd` to `SubParams`++## 18.10.0 - 2016-11-09+* Add `StatusTransitions` to `Order`++## 18.9.0 - 2016-11-04+* Add `Application` to `Charge`++## 18.8.0 - 2016-10-24+* Add `Review` to `Charge` for the charge reviews++## 18.7.0 - 2016-10-18+* Add `RiskLevel` to `ChargeOutcome`++## 18.6.0 - 2016-10-18+* Support for 403 status codes (permission denied)++## 18.5.0 - 2016-10-18+* Add `Status` to `SubListParams` to allow filtering subscriptions by status++## 18.4.0 - 2016-10-14+* Add `HasEvidence` and `PastDue` to `EvidenceDetails`++## 18.3.0 - 2016-10-10+* Add `NoDiscountable` to `InvoiceItemParams`++## 18.2.0 - 2016-10-10+* Add `BusinessLogo` to `Account`+* Add `ReceiptNumber` to `Charge`+* Add `DestPayment` to `Transfer`++## 18.1.0 - 2016-10-04+* Support for Apple Pay domains++## 18.0.0 - 2016-10-03+* Support for subscription items+* Correct `SourceTx` on `Transfer` to be a `SourceTransaction`+* Change `Charge` on `Resource` to be expandable (now a struct instead of string)++## 17.5.0 - 2016-09-22+* Support customer-related operations for bank accounts++## 17.4.2 - 2016-09-19+* Fix but where some parameters were not being included on order update++## 17.4.1 - 2016-09-15+* Fix bug that required a date of birth to be included on account update++## 17.4.0 - 2016-09-13+* Add missing Kana and Kanji address and name fields to account's legal entity+* Add `ReceiptNumber` and `Status` to `Refund`++## 17.3.0 - 2016-09-07+* Add support for sources endpoint++## 17.2.0 - 2016-08-29+* Add order returns to `API`++## 17.1.0 - 2016-08-22+* Add `DeactiveOn` to `Product`++## 17.0.0 - 2016-08-18+* Allow expansion of destination on transfers+* Allow expansion of sources on balance transactions++## 16.8.0 - 2016-08-17+* Add `OriginatingTransaction` to `Fee`++## 16.7.1 - 2016-08-17+* Allow params to be nil when retrieving a refund++## 16.7.0 - 2016-08-11+* Add support for 3-D Secure++## 16.6.0 - 2016-08-09+* Add `ReceiptNumber` to `Invoice`++## 16.5.0 - 2016-08-08+* Add `Meta` to `Account`++## 16.4.0 - 2016-08-05+* Allow the migration of recipients to accounts+* Add `MigratedTo` to `Recipient`++## 16.3.1 - 2016-07-25+* URL-escape the IDs of coupons and plans when making API requests++## 16.3.0 - 2016-07-19+* Add `NoClosed` to `InvoiceParams` to allow an invoice to be reopened++## 16.2.1 - 2016-07-11+* Consider `SubParams.QuantityZero` when updating a subscription++## 16.2.0 - 2016-07-07+* Upgrade API version to 2016-07-06++## 16.1.0 - 2016-07-07+* Add `Returns` field to `Order`++## 16.0.0 - 2016-06-30+* Remove `Name` field on `SKU`; it's not actually supported+* Support updating `Product` on `SKU`++## 15.6.0 - 2016-06-24+* Allow product and SKU attributes to be updated++## 15.5.0 - 2016-06-24+* Add `TaxPercent` and `TaxPercentZero` to `CustomerParams`++## 15.4.0 - 2016-06-20+* Add `TokenizationMethod` to `Card` struct++## 15.3.0 - 2016-06-15+* Add `BalanceZero` to `CustomerParams` so that balance can be zeroed out++## 15.2.0 - 2016-06-03+* Add `ToValues` to `RequestValues` struct++## 15.1.0 - 2016-05-26+* Add `BusinessVatID` to customer creation parameters++## 15.0.0 - 2016-05-24+* Fix handling of nested objects in arrays in request parameters++## 14.4.0 - 2016-05-24+* Add granular error types in new `Err` field on `stripe.Error`++## 14.3.0 - 2016-05-20+* Allow Relay orders to be returned and add associated types++## 14.2.3 - 2016-05-20+* When creating a bank account token, only send routing number if it's been set++## 14.2.2 - 2016-05-17+* When creating a bank account, only send routing number if it's been set++## 14.2.1 - 2016-05-17+* Add missing SKU clinet to client API type++## 14.2.0 - 2016-05-11+* Add `Reversed` and `AmountReversed` fields to `Transfer`++## 14.1.0 - 2016-05-05+* Allow `default_for_currency` to be set when creating a card++## 14.0.0 - 2016-05-04+* Change the signature for `sub.Delete`. The customer ID is no longer required.++## 13.12.0 - 2016-04-28+* Add `Currency` to `Card`++## 13.11.1 - 2016-04-22+* Fix bug where new external accounts could not be marked default from token++## 13.11.0 - 2016-04-21+* Expose a number of list types that were previously internal (full list below)+* Expose `stripe.AccountList`+* Expose `stripe.TransactionList`+* Expose `stripe.BitcoinReceiverList`+* Expose `stripe.ChargeList`+* Expose `stripe.CountrySpecList`+* Expose `stripe.CouponList`+* Expose `stripe.CustomerList`+* Expose `stripe.DisputeList`+* Expose `stripe.EventList`+* Expose `stripe.FeeList`+* Expose `stripe.FileUploadList`+* Expose `stripe.InvoiceList`+* Expose `stripe.OrderList`+* Expose `stripe.ProductList`+* Expose `stripe.RecipientList`+* Expose `stripe.TransferList`+* Switch to use of `stripe.BitcoinTransactionList`+* Switch to use of `stripe.SKUList`++## 13.10.1 - 2016-04-20+* Add support for `TaxPercentZero` to invoice and subscription updates++## 13.10.0 - 2016-04-19+* Expose `stripe.PlanList` (previously an internal type)++## 13.9.0 - 2016-04-18+* Add `TaxPercentZero` struct to `InvoiceParams`+* Add `TaxPercentZero` to `SubParams`++## 13.8.0 - 2016-04-12+* Add `Outcome` struct to `Charge`++## 13.7.0 - 2016-04-06+* Add `Description`, `IIN`, and `Issuer` to `Card`++## 13.6.0 - 2016-04-05+* Add `SourceType` (and associated constants) to `Transfer`++## 13.5.0 - 2016-03-29+* Add `Meta` (metadata) to `BankAccount`++## 13.4.0 - 2016-03-29+* Add `Meta` (metadata) to `Card`++## 13.3.0 - 2016-03-29+* Add `DefaultCurrency` to `CountrySpec`++## 13.2.0 - 2016-03-18+* Add `SourceTransfer` to `Charge`+* Add `SourceTx` to `Transfer`++## 13.1.0 - 2016-03-15+* Add `Reject` on `Account` to support the new API feature++## 13.0.0 - 2016-03-15+* Upgrade API version to 2016-03-07+* Remove `Account.BankAccounts` in favor of `ExternalAccounts`+* Remove `Account.Currencies` in favor of `CountrySpec`++## 12.1.0 - 2016-02-04+* Add `ListParams.StripeAccount` for making list calls on behalf of connected accounts+* Add `Params.StripeAccount` for symmetry with `ListParams.StripeAccount`+* Deprecate `Params.Account` in favor of `Params.StripeAccount`++## 12.0.0 - 2016-02-02+* Add support for fetching events for managed accounts (`event.Get` now takes `Params`)++## 11.5.0 - 2016-02-26+* Allow a `PII.PersonalIDNumber` number to be used to create a token++## 11.4.0 - 2016-02-24+* Add missing subscription fields to `InvoiceParams` for use with `invoice.GetNext`++## 11.3.0 - 2016-02-19+* Add `AccountHolderName` and `AccountHolderType` to bank accounts++## 11.2.0 - 2016-02-11+* Add support for `CountrySpec`+* Add `SSNProvided`, `PersonalIDProvided` and `BusinessTaxIDProvided` to `LegalEntity`++## 11.1.2 - 2016-02-02+* Fix card update method to correctly take expiration date++## 11.1.1 - 2016-02-01+* Fix recipient update so that it can take a bank token (like create)++## 11.0.1 - 2016-01-11+* Add missing field `country` to shipping details of `Charge` and `Customer`++## 11.0.0 - 2016-01-07+* Add missing field `Default` to `BankAccount`+* Add `OrderParams` parameter to `Order` retrieval+* Fix parameter bug when creating a new `Order`+* Support special value of 'now' for trial end when updating subscriptions++## 10.3.0 - 2015-12-10+* Allow an account to be referenced when creating a card++## 10.2.0 - 2015-12-04+* Add `Update` function on `Coupon` client so that metadata can be set++## 10.1.0 - 2015-12-01+* Add a verification routine for external accounts++## 10.0.0 - 2015-11-30+* Return models along with `error` when deleting resources with `Del`+* Fix bug where country parameter wasn't included for some account creation++## 9.0.0 - 2015-11-13+* Return model (`Sub`) when cancelling a subscription (`sub.Cancel`)++## 8.0.0 - 2015-08-17+* Add ability to list and retrieve refunds without a Charge++## 7.0.0 - 2015-08-03+* Add ability to list and retrieve disputes++## 6.8.0 - 2015-07-29+* Add ability to delete an account++## 6.7.1 - 2015-07-17+* Bug fixes++## 6.7.0 - 2015-07-16+* Expand logging object+* Move proration date to subscription update+* Send country when creating/updating account++## 6.6.0 - 2015-07-06+* Add request ID to errors++## 6.5.0 - 2015-07-06+* Update bank account creation API+* Add destination, application fee, transfer to Charge struct+* Add missing fields to invoice line item+* Rename deprecated customer param value++## 6.4.2 - 2015-06-23+* Add BusinessUrl, BusinessUrl, BusinessPrimaryColor, SupportEmail, and+* SupportUrl to Account.++## 6.4.1 - 2015-06-16+* Change card.dynamic_last_four to card.dynamic_last4++## 6.4.0 - 2015-05-28+* Rename customer.default_card -> default_source++## 6.3.0 - 2015-05-19+* Add shipping address to charges+* Expose card.dynamic_last_four+* Expose account.tos_acceptance+* Bug fixes+* Bump API version to most recent one++## 6.2.0 - 2015-04-09+* Bug fixes+* Add Extra to parameters++## 6.1.0 - 2015-03-17+* Add TaxPercent for subscriptions+* Event bug fixes++## 6.0.0 - 2015-03-15+* Add more operations for /accounts endpoint+* Add /transfers/reversals endpoint+* Add /accounts/bank_accounts endpoint+* Add support for Stripe-Account header++## 5.1.0 - 2015-02-25+* Add new dispute status `warning_closed`+* Add SubParams.TrialEndNow to support `trial_end = "now"`++## 5.0.1 - 2015-02-25+* Fix URL for upcoming invoices++## 5.0.0 - 2015-02-19+* Bump to API version 2014-02-18+* Change Card, DefaultCard, Cards to Source, DefaultSource, Sources in Stripe response objects+* Add paymentsource package for manipulating Customer's sources+* Support Update action for Bitcoin Receivers++## 4.4.3 - 2015-02-08+* Modify NewIdempotencyKey() algorithm to increase likelihood of randomness++## 4.4.2 - 2015-01-24+* Add BankAccountParams.Token+* Add Token.ClientIP+* Add LogLevel++## 4.4.0 - 2015-01-20+* Add Bitcoin support++## 4.3.0 - 2015-01-13+* Added support for listing FileUploads+* Mime parameter on FileUpload has been changed to Type++## 4.2.1 - 2014-12-28+* Handle charges with customer card tokens++## 4.2.0 - 2014-12-18+* Add idempotency support++## 4.1.0 - 2014-12-17+* Bump to API version 2014-12-17.++## 4.0.0 - 2014-12-16+* Add FileUpload resource. This brings in a new endpoint (uploads.stripe.com) and thus makes changes to some of the existing interfaces.+* This also adds support for multipart content.++## 3.1.0 - 2014-12-16+* Add Charge.FraudDetails++## 3.0.1 - 2014-12-15+* Add timeout value to HTTP requests++## 3.0.0 - 2014-12-05+* Add Dispute.EvidenceDetails+* Remove Dispute.DueDate+* Change Dispute.Evidence from string to struct++## 2.0.0 - 2014-11-26+* Change List interface to .Next() and .Resource()+* Better error messages for Get() methods+* EventData.Raw contains the raw event message+* SubParams.QuantityZero can be used for free subscriptions++## 1.0.3 - 2014-10-22+* Add AddMeta method++## 1.0.2 - 2014-09-23+* Minor fixes++## 1.0.1 - 2014-09-23+* Linter-based updates++## 1.0.0 - 2014-09-22+* Initial versiondiff --git a/vendor/github.com/stripe/stripe-go/LICENSE b/vendor/github.com/stripe/stripe-go/LICENSEnew file mode 100644index 000000000..2754f88e4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/LICENSE@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2014- Stripe, Inc. (https://stripe.com)++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/vendor/github.com/stripe/stripe-go/Makefile b/vendor/github.com/stripe/stripe-go/Makefilenew file mode 100644index 000000000..c37283072--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/Makefile@@ -0,0 +1,27 @@+all: test bench vet lint check-gofmt++bench:+ go test -race -bench . -run "Benchmark" ./form++build:+ go build ./...++check-gofmt:+ scripts/check_gofmt.sh++lint:+ golint -set_exit_status ./...++test:+ go test -race ./...++vet:+ go vet ./...++coverage:+ # go currently cannot create coverage profiles when testing multiple packages, so we test each package+ # independently. This issue should be fixed in Go 1.10 (https://github.com/golang/go/issues/6909).+ go list ./... | xargs -n1 -I {} -P 4 go test -covermode=count -coverprofile=../../../{}/profile.coverprofile {}++clean:+ find . -name \*.coverprofile -deletediff --git a/vendor/github.com/stripe/stripe-go/README.md b/vendor/github.com/stripe/stripe-go/README.mdnew file mode 100644index 000000000..51154894b--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/README.md@@ -0,0 +1,327 @@+# Go Stripe++[](http://godoc.org/github.com/stripe/stripe-go)+[](https://travis-ci.org/stripe/stripe-go)+[](https://coveralls.io/github/stripe/stripe-go?branch=master)++## Summary++The official [Stripe][stripe] Go client library.++## Versioning++Each revision of the binding is tagged and the version is updated accordingly.++Given Go's lack of built-in versioning, it is highly recommended you use a+[package management tool][package-management] in order to ensure a newer+version of the binding does not affect backwards compatibility.++To see the list of past versions, run `git tag`. To manually get an older+version of the client, clone this repo, checkout the specific tag and build the+library:++```sh+git clone https://github.com/stripe/stripe-go.git+cd stripe-go+git checkout api_version_tag+make build+```++For more details on changes between versions, see the [binding+changelog](CHANGELOG.md) and [API changelog][api-changelog].++## Installation++```sh+go get github.com/stripe/stripe-go+```++## Documentation++For a comprehensive list of examples, check out the [API+documentation][api-docs].++For details on all the functionality in this library, see the [GoDoc][godoc]+documentation.++Below are a few simple examples:++### Customers++```go+params := &stripe.CustomerParams{+ Balance: stripe.Int64(-123),+ Description: stripe.String("Stripe Developer"),+ Email: stripe.String("[email protected]"),+}+params.SetSource("tok_1234")++customer, err := customer.New(params)+```++### Charges++```go+params := &stripe.ChargeListParams{Customer: stripe.String(customer.ID)}+params.Filters.AddFilter("include[]", "", "total_count")++// set this so you can easily retry your request in case of a timeout+params.Params.IdempotencyKey = stripe.NewIdempotencyKey()++i := charge.List(params)+for i.Next() {+ charge := i.Charge()+}++if err := i.Err(); err != nil {+ // handle+}+```++### Events++```go+i := event.List(nil)+for i.Next() {+ e := i.Event()++ // access event data via e.GetObjectValue("resource_name_based_on_type", "resource_property_name")+ // alternatively you can access values via e.Data.Object["resource_name_based_on_type"].(map[string]interface{})["resource_property_name"]++ // access previous attributes via e.GetPreviousValue("resource_name_based_on_type", "resource_property_name")+ // alternatively you can access values via e.Data.PrevPreviousAttributes["resource_name_based_on_type"].(map[string]interface{})["resource_property_name"]+}+```++Alternatively, you can use the `event.Data.Raw` property to unmarshal to the+appropriate struct.++### Authentication with Connect++There are two ways of authenticating requests when performing actions on behalf+of a connected account, one that uses the `Stripe-Account` header containing an+account's ID, and one that uses the account's keys. Usually the former is the+recommended approach. [See the documentation for more information][connect].++To use the `Stripe-Account` approach, use `SetStripeAccount()` on a `ListParams`+or `Params` class. For example:++```go+// For a list request+listParams := &stripe.ChargeListParams{}+listParams.SetStripeAccount("acct_123")+```++```go+// For any other kind of request+params := &stripe.CustomerParams{}+params.SetStripeAccount("acct_123")+```++To use a key, pass it to `API`'s `Init` function:++```go++import (+ "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/client"+)++stripe := &client.API{}+stripe.Init("access_token", nil)+```++### Google AppEngine++If you're running the client in a Google AppEngine environment, you'll need to+create a per-request Stripe client since the `http.DefaultClient` is not+available. Here's a sample handler:++```go+import (+ "fmt"+ "net/http"++ "google.golang.org/appengine"+ "google.golang.org/appengine/urlfetch"++ "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/client"+)++func handler(w http.ResponseWriter, r *http.Request) {+ c := appengine.NewContext(r)+ httpClient := urlfetch.Client(c)++ sc := stripeClient.New("sk_live_key", stripe.NewBackends(httpClient))++ chargeParams := &stripe.ChargeParams{+ Amount: stripe.Int64(2000),+ Currency: stripe.String(string(stripe.CurrencyUSD)),+ Description: stripe.String("Charge from Google App Engine"),+ }+ chargeParams.SetSource("tok_amex") // obtained with Stripe.js+ charge, err := sc.Charges.New(chargeParams)+ if err != nil {+ fmt.Fprintf(w, "Could not process payment: %v", err)+ }+ fmt.Fprintf(w, "Completed payment: %v", charge.ID)+}+```++## Usage++While some resources may contain more/less APIs, the following pattern is+applied throughout the library for a given `$resource$`:++### Without a Client++If you're only dealing with a single key, you can simply import the packages+required for the resources you're interacting with without the need to create a+client.++```go+import (+ "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/$resource$"+)++// Setup+stripe.Key = "sk_key"++stripe.SetBackend("api", backend) // optional, useful for mocking++// Create+$resource$, err := $resource$.New(stripe.$Resource$Params)++// Get+$resource$, err := $resource$.Get(id, stripe.$Resource$Params)++// Update+$resource$, err := $resource$.Update(stripe.$Resource$Params)++// Delete+resourceDeleted, err := $resource$.Del(id, stripe.$Resource$Params)++// List+i := $resource$.List(stripe.$Resource$ListParams)+for i.Next() {+ $resource$ := i.$Resource$()+}++if err := i.Err(); err != nil {+ // handle+}+```++### With a Client++If you're dealing with multiple keys, it is recommended you use `client.API`.+This allows you to create as many clients as needed, each with their own+individual key.++```go+import (+ "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/client"+)++// Setup+sc := &client.API{}+sc.Init("sk_key", nil) // the second parameter overrides the backends used if needed for mocking++// Create+$resource$, err := sc.$Resource$s.New(stripe.$Resource$Params)++// Get+$resource$, err := sc.$Resource$s.Get(id, stripe.$Resource$Params)++// Update+$resource$, err := sc.$Resource$s.Update(stripe.$Resource$Params)++// Delete+resourceDeleted, err := sc.$Resource$s.Del(id, stripe.$Resource$Params)++// List+i := sc.$Resource$s.List(stripe.$Resource$ListParams)+for i.Next() {+ resource := i.$Resource$()+}++if err := i.Err(); err != nil {+ // handle+}+```++### Writing a Plugin++If you're writing a plugin that uses the library, we'd appreciate it if you+identified using `stripe.SetAppInfo`:++```go+stripe.SetAppInfo(&stripe.AppInfo{+ Name: "MyAwesomePlugin",+ URL: "https://myawesomeplugin.info",+ Version: "1.2.34",+})+```++This information is passed along when the library makes calls to the Stripe+API. Note that while `Name` is always required, `URL` and `Version` are+optional.++## Development++Pull requests from the community are welcome. If you submit one, please keep+the following guidelines in mind:++1. Code must be `go fmt` compliant.+2. All types, structs and funcs should be documented.+3. Ensure that `make test` succeeds.++## Test++The test suite needs testify's `require` package to run:++ github.com/stretchr/testify/require++Before running the tests, make sure to grab all of the package's dependencies:++ go get -t -v++It also depends on [stripe-mock][stripe-mock], so make sure to fetch and run it from a+background terminal ([stripe-mock's README][stripe-mock-usage] also contains+instructions for installing via Homebrew and other methods):++ go get -u github.com/stripe/stripe-mock+ stripe-mock++Run all tests:++ go test ./...++Run tests for one package:++ go test ./invoice++Run a single test:++ go test ./invoice -run TestInvoiceGet++For any requests, bug or comments, please [open an issue][issues] or [submit a+pull request][pulls].++[api-docs]: https://stripe.com/docs/api/go+[api-changelog]: https://stripe.com/docs/upgrades+[connect]: https://stripe.com/docs/connect/authentication+[godoc]: http://godoc.org/github.com/stripe/stripe-go+[issues]: https://github.com/stripe/stripe-go/issues/new+[package-management]: https://code.google.com/p/go-wiki/wiki/PackageManagementTools+[pulls]: https://github.com/stripe/stripe-go/pulls+[stripe]: https://stripe.com+[stripe-mock]: https://github.com/stripe/stripe-mock+[stripe-mock-usage]: https://github.com/stripe/stripe-mock#usage++<!--+# vim: set tw=79:+-->diff --git a/vendor/github.com/stripe/stripe-go/VERSION b/vendor/github.com/stripe/stripe-go/VERSIONnew file mode 100644index 000000000..c1d4be125--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/VERSION@@ -0,0 +1 @@+55.3.0diff --git a/vendor/github.com/stripe/stripe-go/account.go b/vendor/github.com/stripe/stripe-go/account.gonew file mode 100644index 000000000..e7519b21d--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/account.go@@ -0,0 +1,475 @@+package stripe++import (+ "encoding/json"++ "github.com/stripe/stripe-go/form"+)++// AccountType is the type of an account.+type AccountType string++// List of values that AccountType can take.+const (+ AccountTypeCustom AccountType = "custom"+ AccountTypeExpress AccountType = "express"+ AccountTypeStandard AccountType = "standard"+)++// ExternalAccountType is the type of an external account.+type ExternalAccountType string++// List of values that ExternalAccountType can take.+const (+ ExternalAccountTypeBankAccount ExternalAccountType = "bank_account"+ ExternalAccountTypeCard ExternalAccountType = "card"+)++// LegalEntityType describes the types for a legal entity.+type LegalEntityType string++// List of values that LegalEntityType can take.+const (+ LegalEntityTypeCompany LegalEntityType = "company"+ LegalEntityTypeIndividual LegalEntityType = "individual"+)++// IdentityVerificationDetailsCode is a machine-readable code specifying the+// verification state of a legal entity+type IdentityVerificationDetailsCode string++// List of values that IdentityVerificationDetailsCode can take.+const (+ IdentityVerificationDetailsCodeFailedKeyedIdentity IdentityVerificationDetailsCode = "failed_keyed_identity"+ IdentityVerificationDetailsCodeFailedOther IdentityVerificationDetailsCode = "failed_other"+ IdentityVerificationDetailsCodeScanCorrupt IdentityVerificationDetailsCode = "scan_corrupt"+ IdentityVerificationDetailsCodeScanFailedGreyscale IdentityVerificationDetailsCode = "scan_failed_greyscale"+ IdentityVerificationDetailsCodeScanFailedOther IdentityVerificationDetailsCode = "scan_failed_other"+ IdentityVerificationDetailsCodeScanIDCountryNotSupported IdentityVerificationDetailsCode = "scan_id_country_not_supported"+ IdentityVerificationDetailsCodeScanIDTypeNotSupported IdentityVerificationDetailsCode = "scan_id_type_not_supported"+ IdentityVerificationDetailsCodeScanNameMismatch IdentityVerificationDetailsCode = "scan_name_mismatch"+ IdentityVerificationDetailsCodeScanNotReadable IdentityVerificationDetailsCode = "scan_not_readable"+ IdentityVerificationDetailsCodeScanNotUploaded IdentityVerificationDetailsCode = "scan_not_uploaded"+)++// IdentityVerificationDisabledReason describes the valid reason to disable account+type IdentityVerificationDisabledReason string++// List of values that IdentityVerificationDisabledReason can take.+const (+ IdentityVerificationDisabledReasonFieldsNeeded IdentityVerificationDisabledReason = "fields_needed"+ IdentityVerificationDisabledReasonListed IdentityVerificationDisabledReason = "listed"+ IdentityVerificationDisabledReasonOther IdentityVerificationDisabledReason = "other"+ IdentityVerificationDisabledReasonRejectedFraud IdentityVerificationDisabledReason = "rejected.fraud"+ IdentityVerificationDisabledReasonRejectedListed IdentityVerificationDisabledReason = "rejected.listed"+ IdentityVerificationDisabledReasonRejectedOther IdentityVerificationDisabledReason = "rejected.other"+ IdentityVerificationDisabledReasonRejectedTermsOfService IdentityVerificationDisabledReason = "rejected.terms_of_service"+ IdentityVerificationDisabledReasonUnderReview IdentityVerificationDisabledReason = "under_review"+)++// IdentityVerificationStatus describes the different statuses for identity verification.+type IdentityVerificationStatus string++// List of values that IdentityVerificationStatus can take.+const (+ IdentityVerificationStatusPending IdentityVerificationStatus = "pending"+ IdentityVerificationStatusUnverified IdentityVerificationStatus = "unverified"+ IdentityVerificationStatusVerified IdentityVerificationStatus = "verified"+)++// PayoutInterval describes the payout interval.+type PayoutInterval string++// List of values that PayoutInterval can take.+const (+ PayoutIntervalDaily PayoutInterval = "daily"+ PayoutIntervalManual PayoutInterval = "manual"+ PayoutIntervalMonthly PayoutInterval = "monthly"+ PayoutIntervalWeekly PayoutInterval = "weekly"+)++// AccountRejectReason describes the valid reason to reject an account+type AccountRejectReason string++// List of values that AccountRejectReason can take.+const (+ AccountRejectReasonFraud AccountRejectReason = "fraud"+ AccountRejectReasonOther AccountRejectReason = "other"+ AccountRejectReasonTermsOfService AccountRejectReason = "terms_of_service"+)++// AccountParams are the parameters allowed during account creation/updates.+type AccountParams struct {+ Params `form:"*"`+ AccountToken *string `form:"account_token"`+ BusinessName *string `form:"business_name"`+ BusinessPrimaryColor *string `form:"business_primary_color"`+ BusinessURL *string `form:"business_url"`+ Country *string `form:"country"`+ DeclineChargeOn *AccountDeclineSettingsParams `form:"decline_charge_on"`+ DebitNegativeBalances *bool `form:"debit_negative_balances"`+ DefaultCurrency *string `form:"default_currency"`+ Email *string `form:"email"`+ ExternalAccount *AccountExternalAccountParams `form:"external_account"`+ FromRecipient *string `form:"from_recipient"`+ LegalEntity *LegalEntityParams `form:"legal_entity"`+ PayoutSchedule *PayoutScheduleParams `form:"payout_schedule"`+ PayoutStatementDescriptor *string `form:"payout_statement_descriptor"`+ ProductDescription *string `form:"product_description"`+ StatementDescriptor *string `form:"statement_descriptor"`+ SupportEmail *string `form:"support_email"`+ SupportPhone *string `form:"support_phone"`+ SupportURL *string `form:"support_url"`+ TOSAcceptance *TOSAcceptanceParams `form:"tos_acceptance"`+ Type *string `form:"type"`+}++// LegalEntityParams represents a legal_entity during account creation/updates.+type LegalEntityParams struct {+ AdditionalOwners []*AdditionalOwnerParams `form:"additional_owners"`++ // AdditionalOwnersEmpty can be set to clear a legal entity's additional+ // owners.+ AdditionalOwnersEmpty bool `form:"additional_owners,empty"`++ Address *AccountAddressParams `form:"address"`+ AddressKana *AccountAddressParams `form:"address_kana"`+ AddressKanji *AccountAddressParams `form:"address_kanji"`+ BusinessName *string `form:"business_name"`+ BusinessNameKana *string `form:"business_name_kana"`+ BusinessNameKanji *string `form:"business_name_kanji"`+ BusinessTaxID *string `form:"business_tax_id"`+ BusinessVATID *string `form:"business_vat_id"`+ DOB *DOBParams `form:"dob"`+ FirstName *string `form:"first_name"`+ FirstNameKana *string `form:"first_name_kana"`+ FirstNameKanji *string `form:"first_name_kanji"`+ Gender *string `form:"gender"`+ LastName *string `form:"last_name"`+ LastNameKana *string `form:"last_name_kana"`+ LastNameKanji *string `form:"last_name_kanji"`+ MaidenName *string `form:"maiden_name"`+ PersonalAddress *AccountAddressParams `form:"personal_address"`+ PersonalAddressKana *AccountAddressParams `form:"personal_address_kana"`+ PersonalAddressKanji *AccountAddressParams `form:"personal_address_kanji"`+ PersonalIDNumber *string `form:"personal_id_number"`+ PhoneNumber *string `form:"phone_number"`+ SSNLast4 *string `form:"ssn_last_4"`+ Type *string `form:"type"`+ Verification *IdentityVerificationParams `form:"verification"`+}++// AccountAddressParams represents an address during account creation/updates.+type AccountAddressParams struct {+ City *string `form:"city"`+ Country *string `form:"country"`+ Line1 *string `form:"line1"`+ Line2 *string `form:"line2"`+ PostalCode *string `form:"postal_code"`+ State *string `form:"state"`++ // Town/cho-me. Note that this is only used for Kana/Kanji representations+ // of an address.+ Town *string `form:"town"`+}++// AccountDeclineSettingsParams represents the parameters allowed for configuring+// declines on connected accounts.+type AccountDeclineSettingsParams struct {+ AVSFailure *bool `form:"avs_failure"`+ CVCFailure *bool `form:"cvc_failure"`+}++// DOBParams represents a DOB during account creation/updates.+type DOBParams struct {+ Day *int64 `form:"day"`+ Month *int64 `form:"month"`+ Year *int64 `form:"year"`+}++// TOSAcceptanceParams represents tos_acceptance during account creation/updates.+type TOSAcceptanceParams struct {+ Date *int64 `form:"date"`+ IP *string `form:"ip"`+ UserAgent *string `form:"user_agent"`+}++// AdditionalOwnerParams represents an additional owner during account creation/updates.+type AdditionalOwnerParams struct {+ Address *AccountAddressParams `form:"address"`+ DOB *DOBParams `form:"dob"`+ FirstName *string `form:"first_name"`+ LastName *string `form:"last_name"`+ MaidenName *string `form:"maiden_name"`+ PersonalIDNumber *string `form:"personal_id_number"`+ Verification *IdentityVerificationParams `form:"verification"`+}++// IdentityVerificationParams represents a verification during account creation/updates.+type IdentityVerificationParams struct {+ Document *string `form:"document"`+ DocumentBack *string `form:"document_back"`+}++// AccountListParams are the parameters allowed during account listing.+type AccountListParams struct {+ ListParams `form:"*"`+}++// AccountExternalAccountParams are the parameters allowed to reference an+// external account when creating an account. It should either have Token set+// or everything else.+type AccountExternalAccountParams struct {+ Params `form:"*"`+ AccountNumber *string `form:"account_number"`+ AccountHolderName *string `form:"account_holder_name"`+ AccountHolderType *string `form:"account_holder_type"`+ Country *string `form:"country"`+ Currency *string `form:"currency"`+ RoutingNumber *string `form:"routing_number"`+ Token *string `form:"token"`+}++// AppendTo implements custom encoding logic for AccountExternalAccountParams+// so that we can send the special required `object` field up along with the+// other specified parameters or the token value.+func (p *AccountExternalAccountParams) AppendTo(body *form.Values, keyParts []string) {+ if p.Token != nil {+ body.Add(form.FormatKey(keyParts), StringValue(p.Token))+ } else {+ body.Add(form.FormatKey(append(keyParts, "object")), "bank_account")+ }+}++// PayoutScheduleParams are the parameters allowed for payout schedules.+type PayoutScheduleParams struct {+ DelayDays *int64 `form:"delay_days"`+ DelayDaysMinimum *bool `form:"-"` // See custom AppendTo+ Interval *string `form:"interval"`+ MonthlyAnchor *int64 `form:"monthly_anchor"`+ WeeklyAnchor *string `form:"weekly_anchor"`+}++// AppendTo implements custom encoding logic for PayoutScheduleParams+// so that we can send a special value for `delay_days` field if needed.+func (p *PayoutScheduleParams) AppendTo(body *form.Values, keyParts []string) {+ if BoolValue(p.DelayDaysMinimum) {+ body.Add(form.FormatKey(append(keyParts, "delay_days")), "minimum")+ }+}++// Account is the resource representing your Stripe account.+// For more details see https://stripe.com/docs/api/#account.+type Account struct {+ BusinessLogo string `json:"business_logo"`+ BusinessName string `json:"business_name"`+ BusinessPrimaryColor string `json:"business_primary_color"`+ BusinessURL string `json:"business_url"`+ ChargesEnabled bool `json:"charges_enabled"`+ Country string `json:"country"`+ Created int64 `json:"created"`+ DeclineChargeOn *AccountDeclineSettings `json:"decline_charge_on"`+ DebitNegativeBalances bool `json:"debit_negative_balances"`+ DefaultCurrency Currency `json:"default_currency"`+ Deleted bool `json:"deleted"`+ DetailsSubmitted bool `json:"details_submitted"`+ Email string `json:"email"`+ ExternalAccounts *ExternalAccountList `json:"external_accounts"`+ ID string `json:"id"`++ Keys *struct {+ Publishable string `json:"publishable"`+ Secret string `json:"secret"`+ } `json:"keys"`++ LegalEntity *LegalEntity `json:"legal_entity"`+ Metadata map[string]string `json:"metadata"`+ DisplayName string `json:"display_name"`+ PayoutSchedule *PayoutSchedule `json:"payout_schedule"`+ PayoutStatementDescriptor string `json:"payout_statement_descriptor"`+ PayoutsEnabled bool `json:"payouts_enabled"`+ ProductDescription string `json:"product_description"`+ StatementDescriptor string `json:"statement_descriptor"`+ SupportAddress *Address `json:"support_address"`+ SupportEmail string `json:"support_email"`+ SupportPhone string `json:"support_phone"`+ SupportURL string `json:"support_url"`+ Timezone string `json:"timezone"`++ TOSAcceptance *struct {+ Date int64 `json:"date"`+ IP string `json:"ip"`+ UserAgent string `json:"user_agent"`+ } `json:"tos_acceptance"`++ Type AccountType `json:"type"`++ Verification *struct {+ DisabledReason IdentityVerificationDisabledReason `json:"disabled_reason"`+ DueBy int64 `json:"due_by"`+ FieldsNeeded []string `json:"fields_needed"`+ } `json:"verification"`+}++// UnmarshalJSON handles deserialization of an account.+// This custom unmarshaling is needed because the resulting+// property may be an ID or the full struct if it was expanded.+func (a *Account) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ a.ID = id+ return nil+ }++ type account Account+ var v account+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *a = Account(v)+ return nil+}++// AccountList is a list of accounts as returned from a list endpoint.+type AccountList struct {+ ListMeta+ Data []*Account `json:"data"`+}++// ExternalAccountList is a list of external accounts that may be either bank+// accounts or cards.+type ExternalAccountList struct {+ ListMeta++ // Values contains any external accounts (bank accounts and/or cards)+ // currently attached to this account.+ Data []*ExternalAccount `json:"data"`+}++// ExternalAccount is an external account (a bank account or card) that's+// attached to an account. It contains fields that will be conditionally+// populated depending on its type.+type ExternalAccount struct {+ // BankAccount is a bank account attached to an account. Populated only if+ // the external account is a bank account.+ BankAccount *BankAccount++ // Card is a card attached to an account. Populated only if the external+ // account is a card.+ Card *Card++ ID string `json:"id"`+ Type ExternalAccountType `json:"object"`+}++// UnmarshalJSON implements Unmarshaler.UnmarshalJSON.+func (ea *ExternalAccount) UnmarshalJSON(data []byte) error {+ type externalAccount ExternalAccount+ var v externalAccount+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *ea = ExternalAccount(v)++ switch ea.Type {+ case ExternalAccountTypeBankAccount:+ err = json.Unmarshal(data, &ea.BankAccount)+ case ExternalAccountTypeCard:+ err = json.Unmarshal(data, &ea.Card)+ }++ return err+}++// LegalEntity is the structure for properties related to an account's legal state.+type LegalEntity struct {+ AdditionalOwners []*AdditionalOwner `json:"additional_owners"`+ Address *AccountAddress `json:"address"`+ AddressKana *AccountAddress `json:"address_kana"`+ AddressKanji *AccountAddress `json:"address_kanji"`+ BusinessName string `json:"business_name"`+ BusinessNameKana string `json:"business_name_kana"`+ BusinessNameKanji string `json:"business_name_kanji"`+ BusinessTaxIDProvided bool `json:"business_tax_id_provided"`+ BusinessVATIDProvided bool `json:"business_vat_id_provided"`+ DOB *DOB `json:"dob"`+ FirstName string `json:"first_name"`+ FirstNameKana string `json:"first_name_kana"`+ FirstNameKanji string `json:"first_name_kanji"`+ Gender string `json:"gender"`+ LastName string `json:"last_name"`+ LastNameKana string `json:"last_name_kana"`+ LastNameKanji string `json:"last_name_kanji"`+ MaidenName string `json:"maiden_name"`+ PersonalAddress *AccountAddress `json:"personal_address"`+ PersonalAddressKana *AccountAddress `json:"personal_address_kana"`+ PersonalAddressKanji *AccountAddress `json:"personal_address_kanji"`+ PersonalIDNumberProvided bool `json:"personal_id_number_provided"`+ PhoneNumber string `json:"phone_number"`+ SSNLast4Provided bool `json:"ssn_last_4_provided"`+ Type LegalEntityType `json:"type"`+ Verification *IdentityVerification `json:"verification"`+}++// AccountAddress is the structure for an account address.+type AccountAddress struct {+ City string `json:"city"`+ Country string `json:"country"`+ Line1 string `json:"line1"`+ Line2 string `json:"line2"`+ PostalCode string `json:"postal_code"`+ State string `json:"state"`++ // Town/cho-me. Note that this is only used for Kana/Kanji representations+ // of an address.+ Town string `json:"town"`+}++// AccountDeclineSettings is the structure for an account's decline settings.+type AccountDeclineSettings struct {+ AVSFailure bool `json:"avs_failure"`+ CVCFailure bool `json:"cvc_failure"`+}++// DOB is a structure for an account owner's date of birth.+type DOB struct {+ Day int64 `json:"day"`+ Month int64 `json:"month"`+ Year int64 `json:"year"`+}++// AdditionalOwner is the structure for an account owner.+type AdditionalOwner struct {+ Address *AccountAddress `json:"address"`+ DOB DOB `json:"dob"`+ FirstName string `json:"first_name"`+ LastName string `json:"last_name"`+ MaidenName string `json:"maiden_name"`+ PersonalIDNumberProvided bool `json:"personal_id_number_provided"`+ Verification IdentityVerification `json:"verification"`+}++// IdentityVerification is the structure for an account's verification.+type IdentityVerification struct {+ Details string `json:"details"`+ DetailsCode IdentityVerificationDetailsCode `json:"details_code"`+ Document *File `json:"document"`+ DocumentBack *File `json:"document_back"`+ Status IdentityVerificationStatus `json:"status"`+}++// PayoutSchedule is the structure for an account's payout schedule.+type PayoutSchedule struct {+ DelayDays int64 `json:"delay_days"`+ Interval PayoutInterval `json:"interval"`+ MonthlyAnchor int64 `json:"monthly_anchor"`+ WeeklyAnchor string `json:"weekly_anchor"`+}++// AccountRejectParams is the structure for the Reject function.+type AccountRejectParams struct {+ Params `form:"*"`+ Reason *string `form:"reason"`+}diff --git a/vendor/github.com/stripe/stripe-go/account/client.go b/vendor/github.com/stripe/stripe-go/account/client.gonew file mode 100644index 000000000..1d23cbbc7--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/account/client.go@@ -0,0 +1,127 @@+// Package account provides API functions related to accounts.+//+// For more details, see: https://stripe.com/docs/api/go#accounts.+package account++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke APIs related to accounts.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new account.+func New(params *stripe.AccountParams) (*stripe.Account, error) {+ return getC().New(params)+}++// New creates a new account.+func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {+ acct := &stripe.Account{}+ err := c.B.Call(http.MethodPost, "/v1/accounts", c.Key, params, acct)+ return acct, err+}++// Get retrieves the authenticating account.+func Get() (*stripe.Account, error) {+ return getC().Get()+}++// Get retrieves the authenticating account.+func (c Client) Get() (*stripe.Account, error) {+ account := &stripe.Account{}+ err := c.B.Call(http.MethodGet, "/v1/account", c.Key, nil, account)+ return account, err+}++// GetByID retrieves an account.+func GetByID(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ return getC().GetByID(id, params)+}++// GetByID retrieves an account.+func (c Client) GetByID(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ path := stripe.FormatURLPath("/v1/accounts/%s", id)+ account := &stripe.Account{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, account)+ return account, err+}++// Update updates an account.+func Update(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ return getC().Update(id, params)+}++// Update updates an account.+func (c Client) Update(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ path := stripe.FormatURLPath("/v1/accounts/%s", id)+ acct := &stripe.Account{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, acct)+ return acct, err+}++// Del deletes an account.+func Del(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ return getC().Del(id, params)+}++// Del deletes an account.+func (c Client) Del(id string, params *stripe.AccountParams) (*stripe.Account, error) {+ path := stripe.FormatURLPath("/v1/accounts/%s", id)+ acct := &stripe.Account{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, acct)+ return acct, err+}++// Reject rejects an account.+func Reject(id string, params *stripe.AccountRejectParams) (*stripe.Account, error) {+ return getC().Reject(id, params)+}++// Reject rejects an account.+func (c Client) Reject(id string, params *stripe.AccountRejectParams) (*stripe.Account, error) {+ path := stripe.FormatURLPath("/v1/accounts/%s/reject", id)+ acct := &stripe.Account{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, acct)+ return acct, err+}++// List returns an iterator that iterates all accounts.+func List(params *stripe.AccountListParams) *Iter {+ return getC().List(params)+}++// List returns an iterator that iterates all accounts.+func (c Client) List(listParams *stripe.AccountListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.AccountList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/accounts", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for accounts.+type Iter struct {+ *stripe.Iter+}++// Account returns the account which the iterator is currently pointing to.+func (i *Iter) Account() *stripe.Account {+ return i.Current().(*stripe.Account)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/address.go b/vendor/github.com/stripe/stripe-go/address.gonew file mode 100644index 000000000..50db8ef6a--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/address.go@@ -0,0 +1,21 @@+package stripe++// AddressParams describes the common parameters for an Address.+type AddressParams struct {+ City *string `form:"city"`+ Country *string `form:"country"`+ Line1 *string `form:"line1"`+ Line2 *string `form:"line2"`+ PostalCode *string `form:"postal_code"`+ State *string `form:"state"`+}++// Address describes common properties for an Address hash.+type Address struct {+ City string `json:"city"`+ Country string `json:"country"`+ Line1 string `json:"line1"`+ Line2 string `json:"line2"`+ PostalCode string `json:"postal_code"`+ State string `json:"state"`+}diff --git a/vendor/github.com/stripe/stripe-go/applepaydomain.go b/vendor/github.com/stripe/stripe-go/applepaydomain.gonew file mode 100644index 000000000..3ec6e06d7--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/applepaydomain.go@@ -0,0 +1,27 @@+package stripe++// ApplePayDomainParams is the set of parameters that can be used when creating an ApplePayDomain object.+type ApplePayDomainParams struct {+ Params `form:"*"`+ DomainName *string `form:"domain_name"`+}++// ApplePayDomain is the resource representing a Stripe ApplePayDomain object+type ApplePayDomain struct {+ Created int64 `json:"created"`+ Deleted bool `json:"deleted"`+ DomainName string `json:"domain_name"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+}++// ApplePayDomainListParams are the parameters allowed during ApplePayDomain listing.+type ApplePayDomainListParams struct {+ ListParams `form:"*"`+}++// ApplePayDomainList is a list of ApplePayDomains as returned from a list endpoint.+type ApplePayDomainList struct {+ ListMeta+ Data []*ApplePayDomain `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/applepaydomain/client.go b/vendor/github.com/stripe/stripe-go/applepaydomain/client.gonew file mode 100644index 000000000..48c7bb6fe--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/applepaydomain/client.go@@ -0,0 +1,87 @@+// Package applepaydomain provides the /apple_pay/domains APIs+package applepaydomain++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /apple_pay/domains and Apple Pay domain-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new Apple Pay domain.+func New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ return getC().New(params)+}++// New creates a new Apple Pay domain.+func (c Client) New(params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ domain := &stripe.ApplePayDomain{}+ err := c.B.Call(http.MethodPost, "/v1/apple_pay/domains", c.Key, params, domain)+ return domain, err+}++// Get retrieves an Apple Pay domain.+func Get(id string, params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ return getC().Get(id, params)+}++// Get retrieves an Apple Pay domain.+func (c Client) Get(id string, params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ path := stripe.FormatURLPath("/v1/apple_pay/domains/%s", id)+ domain := &stripe.ApplePayDomain{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, domain)+ return domain, err+}++// Del removes an Apple Pay domain.+func Del(id string, params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ return getC().Del(id, params)+}++// Del removes an Apple Pay domain.+func (c Client) Del(id string, params *stripe.ApplePayDomainParams) (*stripe.ApplePayDomain, error) {+ path := stripe.FormatURLPath("/v1/apple_pay/domains/%s", id)+ domain := &stripe.ApplePayDomain{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, domain)+ return domain, err+}++// List lists available Apple Pay domains.+func List(params *stripe.ApplePayDomainListParams) *Iter {+ return getC().List(params)+}++// List lists available Apple Pay domains.+func (c Client) List(listParams *stripe.ApplePayDomainListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ApplePayDomainList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/apple_pay/domains", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for Apple Pay domains.+type Iter struct {+ *stripe.Iter+}++// ApplePayDomain returns the Apple Pay domain which the iterator is currently pointing to.+func (i *Iter) ApplePayDomain() *stripe.ApplePayDomain {+ return i.Current().(*stripe.ApplePayDomain)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/application.go b/vendor/github.com/stripe/stripe-go/application.gonew file mode 100644index 000000000..79136e61e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/application.go@@ -0,0 +1,28 @@+package stripe++import "encoding/json"++// Application describes the properties for an Application.+type Application struct {+ ID string `json:"id"`+ Name string `json:"name"`+}++// UnmarshalJSON handles deserialization of an Application.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (a *Application) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ a.ID = id+ return nil+ }++ type application Application+ var v application+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *a = Application(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/balance.go b/vendor/github.com/stripe/stripe-go/balance.gonew file mode 100644index 000000000..168b6af05--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/balance.go@@ -0,0 +1,216 @@+package stripe++import "encoding/json"++// BalanceTransactionStatus is the list of allowed values for the balance transaction's status.+type BalanceTransactionStatus string++// List of values that BalanceTransactionStatus can take.+const (+ BalanceTransactionStatusAvailable BalanceTransactionStatus = "available"+ BalanceTransactionStatusPending BalanceTransactionStatus = "pending"+)++// BalanceTransactionType is the list of allowed values for the balance transaction's type.+type BalanceTransactionType string++// List of values that BalanceTransactionType can take.+const (+ BalanceTransactionTypeAdjustment BalanceTransactionType = "adjustment"+ BalanceTransactionTypeApplicationFee BalanceTransactionType = "application_fee"+ BalanceTransactionTypeApplicationFeeRefund BalanceTransactionType = "application_fee_refund"+ BalanceTransactionTypeCharge BalanceTransactionType = "charge"+ BalanceTransactionTypeIssuingAuthorizationHold BalanceTransactionType = "issuing_authorization_hold"+ BalanceTransactionTypeIssuingAuthorizationRelease BalanceTransactionType = "issuing_authorization_release"+ BalanceTransactionTypeIssuingAuthorizationTransaction BalanceTransactionType = "issuing_transaction"+ BalanceTransactionTypePayment BalanceTransactionType = "payment"+ BalanceTransactionTypePaymentFailureRefund BalanceTransactionType = "payment_failure_refund"+ BalanceTransactionTypePaymentRefund BalanceTransactionType = "payment_refund"+ BalanceTransactionTypePayout BalanceTransactionType = "payout"+ BalanceTransactionTypePayoutCancel BalanceTransactionType = "payout_cancel"+ BalanceTransactionTypePayoutFailure BalanceTransactionType = "payout_failure"+ BalanceTransactionTypeRecipientTransfer BalanceTransactionType = "recipient_transfer"+ BalanceTransactionTypeRecipientTransferCancel BalanceTransactionType = "recipient_transfer_cancel"+ BalanceTransactionTypeRecipientTransferFailure BalanceTransactionType = "recipient_transfer_failure"+ BalanceTransactionTypeRefund BalanceTransactionType = "refund"+ BalanceTransactionTypeStripeFee BalanceTransactionType = "stripe_fee"+ BalanceTransactionTypeTransfer BalanceTransactionType = "transfer"+ BalanceTransactionTypeTransferRefund BalanceTransactionType = "transfer_refund"+)++// BalanceTransactionSourceType consts represent valid balance transaction sources.+type BalanceTransactionSourceType string++// List of values that BalanceTransactionSourceType can take.+const (+ BalanceTransactionSourceTypeApplicationFee BalanceTransactionSourceType = "application_fee"+ BalanceTransactionSourceTypeCharge BalanceTransactionSourceType = "charge"+ BalanceTransactionSourceTypeDispute BalanceTransactionSourceType = "dispute"+ BalanceTransactionSourceTypeIssuingAuthorization BalanceTransactionSourceType = "issuing.authorization"+ BalanceTransactionSourceTypeIssuingTransaction BalanceTransactionSourceType = "issuing.transaction"+ BalanceTransactionSourceTypePayout BalanceTransactionSourceType = "payout"+ BalanceTransactionSourceTypeRecipientTransfer BalanceTransactionSourceType = "recipient_transfer"+ BalanceTransactionSourceTypeRefund BalanceTransactionSourceType = "refund"+ BalanceTransactionSourceTypeReversal BalanceTransactionSourceType = "reversal"+ BalanceTransactionSourceTypeTransfer BalanceTransactionSourceType = "transfer"+)++// BalanceTransactionSource describes the source of a balance Transaction.+// The Type should indicate which object is fleshed out.+// For more details see https://stripe.com/docs/api#retrieve_balance_transaction+type BalanceTransactionSource struct {+ ApplicationFee *ApplicationFee `json:"-"`+ Charge *Charge `json:"-"`+ Dispute *Dispute `json:"-"`+ ID string `json:"id"`+ IssuingAuthorization *IssuingAuthorization `json:"-"`+ IssuingTransaction *IssuingAuthorization `json:"-"`+ Payout *Payout `json:"-"`+ RecipientTransfer *RecipientTransfer `json:"-"`+ Refund *Refund `json:"-"`+ Reversal *Reversal `json:"-"`+ Transfer *Transfer `json:"-"`+ Type BalanceTransactionSourceType `json:"object"`+}++// BalanceParams is the set of parameters that can be used when retrieving a balance.+// For more details see https://stripe.com/docs/api#balance.+type BalanceParams struct {+ Params `form:"*"`+}++// BalanceTransactionParams is the set of parameters that can be used when retrieving a transaction.+// For more details see https://stripe.com/docs/api#retrieve_balance_transaction.+type BalanceTransactionParams struct {+ Params `form:"*"`+}++// BalanceTransactionListParams is the set of parameters that can be used when listing balance transactions.+// For more details see https://stripe.com/docs/api/#balance_history.+type BalanceTransactionListParams struct {+ ListParams `form:"*"`+ AvailableOn *int64 `form:"available_on"`+ AvailableOnRange *RangeQueryParams `form:"available_on"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Currency *string `form:"currency"`+ Payout *string `form:"payout"`+ Source *string `form:"source"`+ Type *string `form:"type"`+}++// Balance is the resource representing your Stripe balance.+// For more details see https://stripe.com/docs/api/#balance.+type Balance struct {+ Available []*Amount `json:"available"`+ Livemode bool `json:"livemode"`+ Pending []*Amount `json:"pending"`+}++// BalanceTransaction is the resource representing the balance transaction.+// For more details see https://stripe.com/docs/api/#balance.+type BalanceTransaction struct {+ Amount int64 `json:"amount"`+ AvailableOn int64 `json:"available_on"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ ExchangeRate float64 `json:"exchange_rate"`+ ID string `json:"id"`+ Fee int64 `json:"fee"`+ FeeDetails []*BalanceTransactionFee `json:"fee_details"`+ Net int64 `json:"net"`+ Recipient string `json:"recipient"`+ Source *BalanceTransactionSource `json:"source"`+ Status BalanceTransactionStatus `json:"status"`+ Type BalanceTransactionType `json:"type"`+}++// BalanceTransactionList is a list of transactions as returned from a list endpoint.+type BalanceTransactionList struct {+ ListMeta+ Data []*BalanceTransaction `json:"data"`+}++// Amount is a structure wrapping an amount value and its currency.+type Amount struct {+ Value int64 `json:"amount"`+ Currency Currency `json:"currency"`+}++// BalanceTransactionFee is a structure that breaks down the fees in a transaction.+type BalanceTransactionFee struct {+ Amount int64 `json:"amount"`+ Application string `json:"application"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ Type string `json:"type"`+}++// UnmarshalJSON handles deserialization of a Transaction.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (t *BalanceTransaction) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ t.ID = id+ return nil+ }++ type balanceTransaction BalanceTransaction+ var v balanceTransaction+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *t = BalanceTransaction(v)+ return nil+}++// UnmarshalJSON handles deserialization of a BalanceTransactionSource.+// This custom unmarshaling is needed because the specific+// type of transaction source it refers to is specified in the JSON+func (s *BalanceTransactionSource) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ s.ID = id+ return nil+ }++ type balanceTransactionSource BalanceTransactionSource+ var v balanceTransactionSource+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *s = BalanceTransactionSource(v)++ switch s.Type {+ case BalanceTransactionSourceTypeApplicationFee:+ err = json.Unmarshal(data, &s.ApplicationFee)+ case BalanceTransactionSourceTypeCharge:+ err = json.Unmarshal(data, &s.Charge)+ case BalanceTransactionSourceTypeDispute:+ err = json.Unmarshal(data, &s.Dispute)+ case BalanceTransactionSourceTypeIssuingAuthorization:+ err = json.Unmarshal(data, &s.IssuingAuthorization)+ case BalanceTransactionSourceTypeIssuingTransaction:+ err = json.Unmarshal(data, &s.IssuingTransaction)+ case BalanceTransactionSourceTypePayout:+ err = json.Unmarshal(data, &s.Payout)+ case BalanceTransactionSourceTypeRecipientTransfer:+ err = json.Unmarshal(data, &s.RecipientTransfer)+ case BalanceTransactionSourceTypeRefund:+ err = json.Unmarshal(data, &s.Refund)+ case BalanceTransactionSourceTypeReversal:+ err = json.Unmarshal(data, &s.Reversal)+ case BalanceTransactionSourceTypeTransfer:+ err = json.Unmarshal(data, &s.Transfer)+ }++ return err+}++// MarshalJSON handles serialization of a BalanceTransactionSource.+func (s *BalanceTransactionSource) MarshalJSON() ([]byte, error) {+ return json.Marshal(s.ID)+}diff --git a/vendor/github.com/stripe/stripe-go/balance/client.go b/vendor/github.com/stripe/stripe-go/balance/client.gonew file mode 100644index 000000000..4d67314e3--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/balance/client.go@@ -0,0 +1,74 @@+// Package balance provides the /balance APIs+package balance++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /balance and transaction-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get retrieves an account's balance+func Get(params *stripe.BalanceParams) (*stripe.Balance, error) {+ return getC().Get(params)+}++// Get retrieves an account's balance+func (c Client) Get(params *stripe.BalanceParams) (*stripe.Balance, error) {+ balance := &stripe.Balance{}+ err := c.B.Call(http.MethodGet, "/v1/balance", c.Key, params, balance)+ return balance, err+}++// GetBalanceTransaction retrieves a balance transaction+func GetBalanceTransaction(id string, params *stripe.BalanceTransactionParams) (*stripe.BalanceTransaction, error) {+ return getC().GetBalanceTransaction(id, params)+}++// GetBalanceTransaction retrieves a balance transaction+func (c Client) GetBalanceTransaction(id string, params *stripe.BalanceTransactionParams) (*stripe.BalanceTransaction, error) {+ path := stripe.FormatURLPath("/v1/balance/history/%s", id)+ balance := &stripe.BalanceTransaction{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, balance)+ return balance, err+}++// List returns a list of balance transactions.+func List(params *stripe.BalanceTransactionListParams) *Iter {+ return getC().List(params)+}++// List returns a list of balance transactions.+func (c Client) List(listParams *stripe.BalanceTransactionListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.BalanceTransactionList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/balance/history", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for balance transactions.+type Iter struct {+ *stripe.Iter+}++// BalanceTransaction returns the balance transaction which the iterator is currently pointing to.+func (i *Iter) BalanceTransaction() *stripe.BalanceTransaction {+ return i.Current().(*stripe.BalanceTransaction)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/bankaccount.go b/vendor/github.com/stripe/stripe-go/bankaccount.gonew file mode 100644index 000000000..5d966ef93--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bankaccount.go@@ -0,0 +1,183 @@+package stripe++import (+ "encoding/json"+ "strconv"++ "github.com/stripe/stripe-go/form"+)++// BankAccountStatus is the list of allowed values for the bank account's status.+type BankAccountStatus string++// List of values that BankAccountStatus can take.+const (+ BankAccountStatusErrored BankAccountStatus = "errored"+ BankAccountStatusNew BankAccountStatus = "new"+ BankAccountStatusValidated BankAccountStatus = "validated"+ BankAccountStatusVerificationFailed BankAccountStatus = "verification_failed"+ BankAccountStatusVerified BankAccountStatus = "verified"+)++// BankAccountAccountHolderType is the list of allowed values for the bank account holder type.+type BankAccountAccountHolderType string++// List of values that BankAccountAccountHolderType can take.+const (+ BankAccountAccountHolderTypeCompany BankAccountAccountHolderType = "company"+ BankAccountAccountHolderTypeIndividual BankAccountAccountHolderType = "individual"+)++// BankAccountParams is the set of parameters that can be used when updating a+// bank account.+//+// Note that while form annotations are used for updates, bank accounts have+// some unusual logic on creates that necessitates manual handling of all+// parameters. See AppendToAsSourceOrExternalAccount.+type BankAccountParams struct {+ Params `form:"*"`++ // Account is the identifier of the parent account under which bank+ // accounts are nested.+ Account *string `form:"-"`++ AccountHolderName *string `form:"account_holder_name"`+ AccountHolderType *string `form:"account_holder_type"`+ AccountNumber *string `form:"account_number"`+ Country *string `form:"country"`+ Currency *string `form:"currency"`+ Customer *string `form:"-"`+ DefaultForCurrency *bool `form:"default_for_currency"`+ RoutingNumber *string `form:"routing_number"`++ // Token is a token referencing an external account like one returned from+ // Stripe.js.+ Token *string `form:"-"`++ // ID is used when tokenizing a bank account for shared customers+ ID *string `form:"*"`+}++// AppendToAsSourceOrExternalAccount appends the given BankAccountParams as+// either a source or external account.+//+// It may look like an AppendTo from the form package, but it's not, and is+// only used in the special case where we use `bankaccount.New`. It's needed+// because we have some weird encoding logic here that can't be handled by the+// form package (and it's special enough that it wouldn't be desirable to have+// it do so).+//+// This is not a pattern that we want to push forward, and this largely exists+// because the bank accounts endpoint is a little unusual. There is one other+// resource like it, which is cards.+func (a *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) {+ // Rather than being called in addition to `AppendTo`, this function+ // *replaces* `AppendTo`, so we must also make sure to handle the encoding+ // of `Params` so metadata and the like is included in the encoded payload.+ form.AppendTo(body, a.Params)++ isCustomer := a.Customer != nil++ var sourceType string+ if isCustomer {+ sourceType = "source"+ } else {+ sourceType = "external_account"+ }++ // Use token (if exists) or a dictionary containing a user’s bank account details.+ if a.Token != nil {+ body.Add(sourceType, StringValue(a.Token))++ if a.DefaultForCurrency != nil {+ body.Add("default_for_currency", strconv.FormatBool(BoolValue(a.DefaultForCurrency)))+ }+ } else {+ body.Add(sourceType+"[object]", "bank_account")+ body.Add(sourceType+"[country]", StringValue(a.Country))+ body.Add(sourceType+"[account_number]", StringValue(a.AccountNumber))+ body.Add(sourceType+"[currency]", StringValue(a.Currency))++ // These are optional and the API will fail if we try to send empty+ // values in for them, so make sure to check that they're actually set+ // before encoding them.+ if a.AccountHolderName != nil {+ body.Add(sourceType+"[account_holder_name]", StringValue(a.AccountHolderName))+ }++ if a.AccountHolderType != nil {+ body.Add(sourceType+"[account_holder_type]", StringValue(a.AccountHolderType))+ }++ if a.RoutingNumber != nil {+ body.Add(sourceType+"[routing_number]", StringValue(a.RoutingNumber))+ }++ if a.DefaultForCurrency != nil {+ body.Add(sourceType+"[default_for_currency]", strconv.FormatBool(BoolValue(a.DefaultForCurrency)))+ }+ }+}++// BankAccountListParams is the set of parameters that can be used when listing bank accounts.+type BankAccountListParams struct {+ ListParams `form:"*"`++ // The identifier of the parent account under which the bank accounts are+ // nested. Either Account or Customer should be populated.+ Account *string `form:"-"`++ // The identifier of the parent customer under which the bank accounts are+ // nested. Either Account or Customer should be populated.+ Customer *string `form:"-"`+}++// AppendTo implements custom encoding logic for BankAccountListParams+// so that we can send the special required `object` field up along with the+// other specified parameters.+func (p *BankAccountListParams) AppendTo(body *form.Values, keyParts []string) {+ body.Add(form.FormatKey(append(keyParts, "object")), "bank_account")+}++// BankAccount represents a Stripe bank account.+type BankAccount struct {+ AccountHolderName string `json:"account_holder_name"`+ AccountHolderType BankAccountAccountHolderType `json:"account_holder_type"`+ BankName string `json:"bank_name"`+ Country string `json:"country"`+ Currency Currency `json:"currency"`+ Customer *Customer `json:"customer"`+ DefaultForCurrency bool `json:"default_for_currency"`+ Deleted bool `json:"deleted"`+ Fingerprint string `json:"fingerprint"`+ ID string `json:"id"`+ Last4 string `json:"last4"`+ Metadata map[string]string `json:"metadata"`+ RoutingNumber string `json:"routing_number"`+ Status BankAccountStatus `json:"status"`+}++// BankAccountList is a list object for bank accounts.+type BankAccountList struct {+ ListMeta+ Data []*BankAccount `json:"data"`+}++// UnmarshalJSON handles deserialization of a BankAccount.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (b *BankAccount) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ b.ID = id+ return nil+ }++ type bankAccount BankAccount+ var v bankAccount+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *b = BankAccount(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/bankaccount/client.go b/vendor/github.com/stripe/stripe-go/bankaccount/client.gonew file mode 100644index 000000000..cbbff0930--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bankaccount/client.go@@ -0,0 +1,184 @@+// Package bankaccount provides the /bank_accounts APIs+package bankaccount++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /bank_accounts APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new bank account.+func New(params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ return getC().New(params)+}++// New creates a new bank account.+func (c Client) New(params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources", stripe.StringValue(params.Customer))+ } else if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts", stripe.StringValue(params.Account))+ } else {+ return nil, errors.New("Invalid bank account params: either Customer or Account need to be set")+ }++ body := &form.Values{}++ // Note that we call this special append method instead of the standard one+ // from the form package. We should not use form's because doing so will+ // include some parameters that are undesirable here.+ params.AppendToAsSourceOrExternalAccount(body)++ // Because bank account creation uses the custom append above, we have to+ // make an explicit call using a form and CallRaw instead of the standard+ // Call (which takes a set of parameters).+ ba := &stripe.BankAccount{}+ err := c.B.CallRaw(http.MethodPost, path, c.Key, body, ¶ms.Params, ba)+ return ba, err+}++// Get returns the details of a bank account.+func Get(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ return getC().Get(id, params)+}++// Get returns the details of a bank account.+func (c Client) Get(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params != nil && params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ } else if params != nil && params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id)+ } else {+ return nil, errors.New("Invalid bank account params: either Customer or Account need to be set")+ }++ ba := &stripe.BankAccount{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, ba)+ return ba, err+}++// Update updates a bank account.+func Update(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ return getC().Update(id, params)+}++// Update updates a bank account.+func (c Client) Update(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ } else if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id)+ } else {+ return nil, errors.New("Invalid bank account params: either Customer or Account need to be set")+ }++ ba := &stripe.BankAccount{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, ba)+ return ba, err+}++// Del removes a bank account.+func Del(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ return getC().Del(id, params)+}++// Del removes a bank account.+func (c Client) Del(id string, params *stripe.BankAccountParams) (*stripe.BankAccount, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ } else if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id)+ } else {+ return nil, errors.New("Invalid bank account params: either Customer or Account need to be set")+ }++ ba := &stripe.BankAccount{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, ba)+ return ba, err+}++// List returns a list of bank accounts.+func List(params *stripe.BankAccountListParams) *Iter {+ return getC().List(params)+}++// List returns a list of bank accounts.+func (c Client) List(listParams *stripe.BankAccountListParams) *Iter {+ var path string+ var outerErr error++ // There's no bank accounts list URL, so we use one sources or external+ // accounts. An override on BankAccountListParam's `AppendTo` will add the+ // filter `object=bank_account` to make sure that only bank accounts come+ // back with the response.+ if listParams == nil {+ outerErr = errors.New("params should not be nil")+ } else if listParams.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources",+ stripe.StringValue(listParams.Customer))+ } else if listParams.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts",+ stripe.StringValue(listParams.Account))+ } else {+ outerErr = errors.New("Invalid bank account params: either Customer or Account need to be set")+ }++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.BankAccountList{}++ if outerErr != nil {+ return nil, list.ListMeta, outerErr+ }++ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for bank accounts.+type Iter struct {+ *stripe.Iter+}++// BankAccount returns the bank account which the iterator is currently pointing to.+func (i *Iter) BankAccount() *stripe.BankAccount {+ return i.Current().(*stripe.BankAccount)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/bitcoinreceiver.go b/vendor/github.com/stripe/stripe-go/bitcoinreceiver.gonew file mode 100644index 000000000..7acf81e47--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bitcoinreceiver.go@@ -0,0 +1,63 @@+package stripe++import (+ "encoding/json"+)++// BitcoinReceiverListParams is the set of parameters that can be used when listing BitcoinReceivers.+// For more details see https://stripe.com/docs/api/#list_bitcoin_receivers.+type BitcoinReceiverListParams struct {+ ListParams `form:"*"`+ Active *bool `form:"active"`+ Filled *bool `form:"filled"`+ UncapturedFunds *bool `form:"uncaptured_funds"`+}++// BitcoinReceiver is the resource representing a Stripe bitcoin receiver.+// For more details see https://stripe.com/docs/api/#bitcoin_receivers+type BitcoinReceiver struct {+ Active bool `json:"active"`+ Amount int64 `json:"amount"`+ AmountReceived int64 `json:"amount_received"`+ BitcoinAmount int64 `json:"bitcoin_amount"`+ BitcoinAmountReceived int64 `json:"bitcoin_amount_received"`+ BitcoinURI string `json:"bitcoin_uri"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Customer string `json:"customer"`+ Description string `json:"description"`+ Email string `json:"email"`+ Filled bool `json:"filled"`+ ID string `json:"id"`+ InboundAddress string `json:"inbound_address"`+ Metadata map[string]string `json:"metadata"`+ Payment string `json:"payment"`+ RefundAddress string `json:"refund_address"`+ RejectTransactions bool `json:"reject_transactions"`+ Transactions *BitcoinTransactionList `json:"transactions"`+}++// BitcoinReceiverList is a list of bitcoin receivers as retrieved from a list endpoint.+type BitcoinReceiverList struct {+ ListMeta+ Data []*BitcoinReceiver `json:"data"`+}++// UnmarshalJSON handles deserialization of a BitcoinReceiver.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *BitcoinReceiver) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type bitcoinReceiver BitcoinReceiver+ var v bitcoinReceiver+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = BitcoinReceiver(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/bitcoinreceiver/client.go b/vendor/github.com/stripe/stripe-go/bitcoinreceiver/client.gonew file mode 100644index 000000000..1dbf274a3--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bitcoinreceiver/client.go@@ -0,0 +1,65 @@+// Package bitcoinreceiver provides the /bitcoin/receivers APIs.+//+// Note that this entire package is deprecated. Please use the new sources API+// instead.+package bitcoinreceiver++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /bitcoin/receivers APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of a bitcoin receiver.+func Get(id string) (*stripe.BitcoinReceiver, error) {+ return getC().Get(id)+}++// Get returns the details of a bitcoin receiver.+func (c Client) Get(id string) (*stripe.BitcoinReceiver, error) {+ path := stripe.FormatURLPath("/v1/bitcoin/receivers/%s", id)+ bitcoinReceiver := &stripe.BitcoinReceiver{}+ err := c.B.Call(http.MethodGet, path, c.Key, nil, bitcoinReceiver)+ return bitcoinReceiver, err+}++// List returns a list of bitcoin receivers.+func List(params *stripe.BitcoinReceiverListParams) *Iter {+ return getC().List(params)+}++// List returns a list of bitcoin receivers.+func (c Client) List(listParams *stripe.BitcoinReceiverListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.BitcoinReceiverList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/bitcoin/receivers", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for bitcoin receivers.+type Iter struct {+ *stripe.Iter+}++// BitcoinReceiver returns the bitcoin receiver which the iterator is currently pointing to.+func (i *Iter) BitcoinReceiver() *stripe.BitcoinReceiver {+ return i.Current().(*stripe.BitcoinReceiver)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/bitcointransaction.go b/vendor/github.com/stripe/stripe-go/bitcointransaction.gonew file mode 100644index 000000000..6a2ac5518--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bitcointransaction.go@@ -0,0 +1,49 @@+package stripe++import "encoding/json"++// BitcoinTransactionListParams is the set of parameters that can be used when listing BitcoinTransactions.+type BitcoinTransactionListParams struct {+ ListParams `form:"*"`+ Customer *string `form:"customer"`+ Receiver *string `form:"-"` // Sent in with the URL+}++// BitcoinTransactionList is a list object for BitcoinTransactions.+// It is a child object of BitcoinRecievers+// For more details see https://stripe.com/docs/api/#retrieve_bitcoin_receiver+type BitcoinTransactionList struct {+ ListMeta+ Data []*BitcoinTransaction `json:"data"`+}++// BitcoinTransaction is the resource representing a Stripe bitcoin transaction.+// For more details see https://stripe.com/docs/api/#bitcoin_receivers+type BitcoinTransaction struct {+ Amount int64 `json:"amount"`+ BitcoinAmount int64 `json:"bitcoin_amount"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Customer string `json:"customer"`+ ID string `json:"id"`+ Receiver string `json:"receiver"`+}++// UnmarshalJSON handles deserialization of a BitcoinTransaction.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (bt *BitcoinTransaction) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ bt.ID = id+ return nil+ }++ type bitcoinTransaction BitcoinTransaction+ var v bitcoinTransaction+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *bt = BitcoinTransaction(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/bitcointransaction/client.go b/vendor/github.com/stripe/stripe-go/bitcointransaction/client.gonew file mode 100644index 000000000..7950dbb7e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/bitcointransaction/client.go@@ -0,0 +1,51 @@+// Package bitcointransaction provides the /bitcoin/transactions APIs.+package bitcointransaction++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /bitcoin/receivers/:receiver_id/transactions APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// List returns a list of bitcoin transactions.+func List(params *stripe.BitcoinTransactionListParams) *Iter {+ return getC().List(params)+}++// List returns a list of bitcoin transactions.+func (c Client) List(listParams *stripe.BitcoinTransactionListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ path := stripe.FormatURLPath("/v1/bitcoin/receivers/%s/transactions",+ stripe.StringValue(listParams.Receiver))+ list := &stripe.BitcoinTransactionList{}+ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for bitcoin transactions.+type Iter struct {+ *stripe.Iter+}++// BitcoinTransaction returns the bitcoin transaction which the iterator is currently pointing to.+func (i *Iter) BitcoinTransaction() *stripe.BitcoinTransaction {+ return i.Current().(*stripe.BitcoinTransaction)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/card.go b/vendor/github.com/stripe/stripe-go/card.gonew file mode 100644index 000000000..053f50b71--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/card.go@@ -0,0 +1,272 @@+package stripe++import (+ "encoding/json"+ "strconv"++ "github.com/stripe/stripe-go/form"+)++// CardAvailablePayoutMethod is a set of available payout methods for the card.+type CardAvailablePayoutMethod string++// List of values that CardAvailablePayoutMethod can take.+const (+ CardAvailablePayoutMethodInstant CardAvailablePayoutMethod = "Instant"+ CardAvailablePayoutMethodStandard CardAvailablePayoutMethod = "Standard"+)++// CardBrand is the list of allowed values for the card's brand.+type CardBrand string++// List of values that CardBrand can take.+const (+ CardBrandAmex CardBrand = "American Express"+ CardBrandDiscover CardBrand = "Discover"+ CardBrandDinersClub CardBrand = "Diners Club"+ CardBrandJCB CardBrand = "JCB"+ CardBrandMasterCard CardBrand = "MasterCard"+ CardBrandUnknown CardBrand = "Unknown"+ CardBrandUnionPay CardBrand = "UnionPay"+ CardBrandVisa CardBrand = "Visa"+)++// CardFunding is the list of allowed values for the card's funding.+type CardFunding string++// List of values that CardFunding can take.+const (+ CardFundingCredit CardFunding = "credit"+ CardFundingDebit CardFunding = "debit"+ CardFundingPrepaid CardFunding = "prepaid"+ CardFundingUnknown CardFunding = "unknown"+)++// CardTokenizationMethod is the list of allowed values for the card's tokenization method.+type CardTokenizationMethod string++// List of values that CardTokenizationMethod can take.+const (+ TokenizationMethodAndroidPay CardTokenizationMethod = "android_pay"+ TokenizationMethodApplePay CardTokenizationMethod = "apple_pay"+)++// CardVerification is the list of allowed verification responses.+type CardVerification string++// List of values that CardVerification can take.+const (+ CardVerificationFail CardVerification = "fail"+ CardVerificationPass CardVerification = "pass"+ CardVerificationUnchecked CardVerification = "unchecked"+)++// cardSource is a string that's used to build card form parameters. It's a+// constant just to make mistakes less likely.+const cardSource = "source"++// CardParams is the set of parameters that can be used when creating or updating a card.+// For more details see https://stripe.com/docs/api#create_card and https://stripe.com/docs/api#update_card.+//+// Note that while form annotations are used for tokenization and updates,+// cards have some unusual logic on creates that necessitates manual handling+// of all parameters. See AppendToAsCardSourceOrExternalAccount.+type CardParams struct {+ Params `form:"*"`+ Account *string `form:"-"`+ AddressCity *string `form:"address_city"`+ AddressCountry *string `form:"address_country"`+ AddressLine1 *string `form:"address_line1"`+ AddressLine2 *string `form:"address_line2"`+ AddressState *string `form:"address_state"`+ AddressZip *string `form:"address_zip"`+ CVC *string `form:"cvc"`+ Currency *string `form:"currency"`+ Customer *string `form:"-"`+ DefaultForCurrency *bool `form:"default_for_currency"`+ ExpMonth *string `form:"exp_month"`+ ExpYear *string `form:"exp_year"`+ Name *string `form:"name"`+ Number *string `form:"number"`+ Recipient *string `form:"-"`+ Token *string `form:"-"`++ // ID is used when tokenizing a card for shared customers+ ID string `form:"*"`+}++// AppendToAsCardSourceOrExternalAccount appends the given CardParams as either a+// card or external account.+//+// It may look like an AppendTo from the form package, but it's not, and is+// only used in the special case where we use `card.New`. It's needed because+// we have some weird encoding logic here that can't be handled by the form+// package (and it's special enough that it wouldn't be desirable to have it do+// so).+//+// This is not a pattern that we want to push forward, and this largely exists+// because the cards endpoint is a little unusual. There is one other resource+// like it, which is bank account.+func (c *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, keyParts []string) {+ // Rather than being called in addition to `AppendTo`, this function+ // *replaces* `AppendTo`, so we must also make sure to handle the encoding+ // of `Params` so metadata and the like is included in the encoded payload.+ form.AppendToPrefixed(body, c.Params, keyParts)++ if c.DefaultForCurrency != nil {+ body.Add(form.FormatKey(append(keyParts, "default_for_currency")), strconv.FormatBool(BoolValue(c.DefaultForCurrency)))+ }++ if c.Token != nil {+ if c.Account != nil {+ body.Add(form.FormatKey(append(keyParts, "external_account")), StringValue(c.Token))+ } else {+ body.Add(form.FormatKey(append(keyParts, cardSource)), StringValue(c.Token))+ }+ }++ if c.Number != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "object")), "card")+ body.Add(form.FormatKey(append(keyParts, cardSource, "number")), StringValue(c.Number))+ }++ if c.CVC != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "cvc")), StringValue(c.CVC))+ }++ if c.Currency != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "currency")), StringValue(c.Currency))+ }++ if c.ExpMonth != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "exp_month")), StringValue(c.ExpMonth))+ }++ if c.ExpYear != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "exp_year")), StringValue(c.ExpYear))+ }++ if c.Name != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "name")), StringValue(c.Name))+ }++ if c.AddressCity != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_city")), StringValue(c.AddressCity))+ }++ if c.AddressCountry != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_country")), StringValue(c.AddressCountry))+ }++ if c.AddressLine1 != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_line1")), StringValue(c.AddressLine1))+ }++ if c.AddressLine2 != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_line2")), StringValue(c.AddressLine2))+ }++ if c.AddressState != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_state")), StringValue(c.AddressState))+ }++ if c.AddressZip != nil {+ body.Add(form.FormatKey(append(keyParts, cardSource, "address_zip")), StringValue(c.AddressZip))+ }+}++// CardListParams is the set of parameters that can be used when listing cards.+// For more details see https://stripe.com/docs/api#list_cards.+type CardListParams struct {+ ListParams `form:"*"`+ Account *string `form:"-"`+ Customer *string `form:"-"`+ Recipient *string `form:"-"`+}++// AppendTo implements custom encoding logic for CardListParams+// so that we can send the special required `object` field up along with the+// other specified parameters.+func (p *CardListParams) AppendTo(body *form.Values, keyParts []string) {+ if p.Account != nil || p.Customer != nil {+ body.Add(form.FormatKey(append(keyParts, "object")), "card")+ }+}++// Card is the resource representing a Stripe credit/debit card.+// For more details see https://stripe.com/docs/api#cards.+type Card struct {+ AddressCity string `json:"address_city"`+ AddressCountry string `json:"address_country"`+ AddressLine1 string `json:"address_line1"`+ AddressLine1Check CardVerification `json:"address_line1_check"`+ AddressLine2 string `json:"address_line2"`+ AddressState string `json:"address_state"`+ AddressZip string `json:"address_zip"`+ AddressZipCheck CardVerification `json:"address_zip_check"`+ AvailablePayoutMethods []CardAvailablePayoutMethod `json:"available_payout_methods"`+ Brand CardBrand `json:"brand"`+ CVCCheck CardVerification `json:"cvc_check"`+ Country string `json:"country"`+ Currency Currency `json:"currency"`+ Customer *Customer `json:"customer"`+ DefaultForCurrency bool `json:"default_for_currency"`+ Deleted bool `json:"deleted"`++ // Description is a succinct summary of the card's information.+ //+ // Please note that this field is for internal use only and is not returned+ // as part of standard API requests.+ Description string `json:"description"`++ DynamicLast4 string `json:"dynamic_last4"`+ ExpMonth uint8 `json:"exp_month"`+ ExpYear uint16 `json:"exp_year"`+ Fingerprint string `json:"fingerprint"`+ Funding CardFunding `json:"funding"`+ ID string `json:"id"`++ // IIN is the card's "Issuer Identification Number".+ //+ // Please note that this field is for internal use only and is not returned+ // as part of standard API requests.+ IIN string `json:"iin"`++ // Issuer is a bank or financial institution that provides the card.+ //+ // Please note that this field is for internal use only and is not returned+ // as part of standard API requests.+ Issuer string `json:"issuer"`++ Last4 string `json:"last4"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ Recipient *Recipient `json:"recipient"`+ ThreeDSecure *ThreeDSecure `json:"three_d_secure"`+ TokenizationMethod CardTokenizationMethod `json:"tokenization_method"`+}++// CardList is a list object for cards.+type CardList struct {+ ListMeta+ Data []*Card `json:"data"`+}++// UnmarshalJSON handles deserialization of a Card.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *Card) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type card Card+ var v card+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = Card(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/card/client.go b/vendor/github.com/stripe/stripe-go/card/client.gonew file mode 100644index 000000000..2fe4cb12c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/card/client.go@@ -0,0 +1,202 @@+// Package card provides the /cards APIs+package card++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /cards APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new card.+func New(params *stripe.CardParams) (*stripe.Card, error) {+ return getC().New(params)+}++// New creates a new card.+func (c Client) New(params *stripe.CardParams) (*stripe.Card, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts",+ stripe.StringValue(params.Account))+ } else if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources",+ stripe.StringValue(params.Customer))+ } else if params.Recipient != nil {+ path = stripe.FormatURLPath("/v1/recipients/%s/cards",+ stripe.StringValue(params.Recipient))+ } else {+ return nil, errors.New("Invalid card params: either account, customer or recipient need to be set")+ }++ body := &form.Values{}++ // Note that we call this special append method instead of the standard one+ // from the form package. We should not use form's because doing so will+ // include some parameters that are undesirable here.+ params.AppendToAsCardSourceOrExternalAccount(body, nil)++ // Because card creation uses the custom append above, we have to make an+ // explicit call using a form and CallRaw instead of the standard Call+ // (which takes a set of parameters).+ card := &stripe.Card{}+ err := c.B.CallRaw(http.MethodPost, path, c.Key, body, ¶ms.Params, card)+ return card, err+}++// Get returns the details of a card.+func Get(id string, params *stripe.CardParams) (*stripe.Card, error) {+ return getC().Get(id, params)+}++// Get returns the details of a card.+func (c Client) Get(id string, params *stripe.CardParams) (*stripe.Card, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s",+ stripe.StringValue(params.Account), id)+ } else if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s",+ stripe.StringValue(params.Customer), id)+ } else if params.Recipient != nil {+ path = stripe.FormatURLPath("/v1/recipients/%s/cards/%s",+ stripe.StringValue(params.Recipient), id)+ } else {+ return nil, errors.New("Invalid card params: either account, customer or recipient need to be set")+ }++ card := &stripe.Card{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, card)+ return card, err+}++// Update updates a card's properties.+func Update(id string, params *stripe.CardParams) (*stripe.Card, error) {+ return getC().Update(id, params)+}++// Update updates a card's properties.+func (c Client) Update(id string, params *stripe.CardParams) (*stripe.Card, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s",+ stripe.StringValue(params.Account), id)+ } else if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s",+ stripe.StringValue(params.Customer), id)+ } else if params.Recipient != nil {+ path = stripe.FormatURLPath("/v1/recipients/%s/cards/%s",+ stripe.StringValue(params.Recipient), id)+ } else {+ return nil, errors.New("Invalid card params: either account, customer or recipient need to be set")+ }++ card := &stripe.Card{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, card)+ return card, err+}++// Del removes a card.+func Del(id string, params *stripe.CardParams) (*stripe.Card, error) {+ return getC().Del(id, params)+}++// Del removes a card.+func (c Client) Del(id string, params *stripe.CardParams) (*stripe.Card, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id)+ } else if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ } else if params.Recipient != nil {+ path = stripe.FormatURLPath("/v1/recipients/%s/cards/%s", stripe.StringValue(params.Recipient), id)+ } else {+ return nil, errors.New("Invalid card params: either account, customer or recipient need to be set")+ }++ card := &stripe.Card{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, card)+ return card, err+}++// List returns a list of cards.+func List(params *stripe.CardListParams) *Iter {+ return getC().List(params)+}++// List returns a list of cards.+func (c Client) List(listParams *stripe.CardListParams) *Iter {+ var path string+ var outerErr error++ // Because the external accounts and sources endpoints can return non-card+ // objects, CardListParam's `AppendTo` will add the filter `object=card` to+ // make sure that only cards come back with the response.+ if listParams == nil {+ outerErr = errors.New("params should not be nil")+ } else if listParams.Account != nil {+ path = stripe.FormatURLPath("/v1/accounts/%s/external_accounts",+ stripe.StringValue(listParams.Account))+ } else if listParams.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources",+ stripe.StringValue(listParams.Customer))+ } else if listParams.Recipient != nil {+ path = stripe.FormatURLPath("/v1/recipients/%s/cards", stripe.StringValue(listParams.Recipient))+ } else {+ outerErr = errors.New("Invalid card params: either account, customer or recipient need to be set")+ }++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.CardList{}++ if outerErr != nil {+ return nil, list.ListMeta, outerErr+ }++ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for cards.+type Iter struct {+ *stripe.Iter+}++// Card returns the card which the iterator is currently pointing to.+func (i *Iter) Card() *stripe.Card {+ return i.Current().(*stripe.Card)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/charge.go b/vendor/github.com/stripe/stripe-go/charge.gonew file mode 100644index 000000000..1aea44b67--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/charge.go@@ -0,0 +1,253 @@+package stripe++import (+ "encoding/json"+)++// ChargeFraudUserReport is the list of allowed values for reporting fraud.+type ChargeFraudUserReport string++// List of values that ChargeFraudUserReport can take.+const (+ ChargeFraudUserReportFraudulent ChargeFraudUserReport = "fraudulent"+ ChargeFraudUserReportSafe ChargeFraudUserReport = "safe"+)++// ChargeFraudStripeReport is the list of allowed values for reporting fraud.+type ChargeFraudStripeReport string++// List of values that ChargeFraudStripeReport can take.+const (+ ChargeFraudStripeReportFraudulent ChargeFraudStripeReport = "fraudulent"+)++// ChargeLevel3LineItemsParams is the set of parameters that represent a line item on level III data.+type ChargeLevel3LineItemsParams struct {+ DiscountAmount *int64 `form:"discount_amount"`+ ProductCode *string `form:"product_code"`+ ProductDescription *string `form:"product_description"`+ Quantity *int64 `form:"quantity"`+ TaxAmount *int64 `form:"tax_amount"`+ UnitCost *int64 `form:"unit_cost"`+}++// ChargeLevel3Params is the set of parameters that can be used for the Level III data.+type ChargeLevel3Params struct {+ CustomerReference *string `form:"customer_reference"`+ LineItems []*ChargeLevel3LineItemsParams `form:"line_items"`+ MerchantReference *string `form:"merchant_reference"`+ ShippingAddressZip *string `form:"shipping_address_zip"`+ ShippingFromZip *string `form:"shipping_from_zip"`+ ShippingAmount *int64 `form:"shipping_amount"`+}++// ChargeParams is the set of parameters that can be used when creating or updating a charge.+type ChargeParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ ApplicationFee *int64 `form:"application_fee"`+ Capture *bool `form:"capture"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ Description *string `form:"description"`+ Destination *DestinationParams `form:"destination"`+ ExchangeRate *float64 `form:"exchange_rate"`+ FraudDetails *FraudDetailsParams `form:"fraud_details"`+ Level3 *ChargeLevel3Params `form:"level3"`+ OnBehalfOf *string `form:"on_behalf_of"`+ ReceiptEmail *string `form:"receipt_email"`+ Shipping *ShippingDetailsParams `form:"shipping"`+ Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"+ StatementDescriptor *string `form:"statement_descriptor"`+ TransferGroup *string `form:"transfer_group"`+}++// ShippingDetailsParams is the structure containing shipping information as parameters+type ShippingDetailsParams struct {+ Address *AddressParams `form:"address"`+ Carrier *string `form:"carrier"`+ Name *string `form:"name"`+ Phone *string `form:"phone"`+ TrackingNumber *string `form:"tracking_number"`+}++// SetSource adds valid sources to a ChargeParams object,+// returning an error for unsupported sources.+func (p *ChargeParams) SetSource(sp interface{}) error {+ source, err := SourceParamsFor(sp)+ p.Source = source+ return err+}++// DestinationParams describes the parameters available for the destination hash when creating a charge.+type DestinationParams struct {+ Account *string `form:"account"`+ Amount *int64 `form:"amount"`+}++// FraudDetailsParams provides information on the fraud details for a charge.+type FraudDetailsParams struct {+ UserReport *string `form:"user_report"`+}++// ChargeListParams is the set of parameters that can be used when listing charges.+type ChargeListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Customer *string `form:"customer"`+ TransferGroup *string `form:"transfer_group"`+}++// CaptureParams is the set of parameters that can be used when capturing a charge.+type CaptureParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ ApplicationFee *int64 `form:"application_fee"`+ ExchangeRate *float64 `form:"exchange_rate"`+ ReceiptEmail *string `form:"receipt_email"`+ StatementDescriptor *string `form:"statement_descriptor"`+}++// ChargeLevel3LineItem represents a line item on level III data.+// This is in private beta and would be empty for most integrations+type ChargeLevel3LineItem struct {+ DiscountAmount int64 `json:"discount_amount"`+ ProductCode string `json:"product_code"`+ ProductDescription string `json:"product_description"`+ Quantity int64 `json:"quantity"`+ TaxAmount int64 `json:"tax_amount"`+ UnitCost int64 `json:"unit_cost"`+}++// ChargeLevel3 represents the Level III data.+// This is in private beta and would be empty for most integrations+type ChargeLevel3 struct {+ CustomerReference string `json:"customer_reference"`+ LineItems []*ChargeLevel3LineItem `json:"line_items"`+ MerchantReference string `json:"merchant_reference"`+ ShippingAddressZip string `json:"shipping_address_zip"`+ ShippingFromZip string `json:"shipping_from_zip"`+ ShippingAmount int64 `json:"shipping_amount"`+}++// Charge is the resource representing a Stripe charge.+// For more details see https://stripe.com/docs/api#charges.+type Charge struct {+ Amount int64 `json:"amount"`+ AmountRefunded int64 `json:"amount_refunded"`+ Application *Application `json:"application"`+ ApplicationFee *ApplicationFee `json:"application_fee"`+ AuthorizationCode string `json:"authorization_code"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Captured bool `json:"captured"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Customer *Customer `json:"customer"`+ Description string `json:"description"`+ Destination *Account `json:"destination"`+ Dispute *Dispute `json:"dispute"`+ FailureCode string `json:"failure_code"`+ FailureMessage string `json:"failure_message"`+ FraudDetails *FraudDetails `json:"fraud_details"`+ ID string `json:"id"`+ Invoice *Invoice `json:"invoice"`+ Level3 ChargeLevel3 `json:"level3"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ OnBehalfOf *Account `json:"on_behalf_of"`+ Outcome *ChargeOutcome `json:"outcome"`+ Paid bool `json:"paid"`+ ReceiptEmail string `json:"receipt_email"`+ ReceiptNumber string `json:"receipt_number"`+ Refunded bool `json:"refunded"`+ Refunds *RefundList `json:"refunds"`+ Review *Review `json:"review"`+ Shipping *ShippingDetails `json:"shipping"`+ Source *PaymentSource `json:"source"`+ SourceTransfer *Transfer `json:"source_transfer"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status string `json:"status"`+ Transfer *Transfer `json:"transfer"`+ TransferGroup string `json:"transfer_group"`+}++// UnmarshalJSON handles deserialization of a charge.+// This custom unmarshaling is needed because the resulting+// property may be an ID or the full struct if it was expanded.+func (c *Charge) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type charge Charge+ var v charge+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = Charge(v)+ return nil+}++// ChargeList is a list of charges as retrieved from a list endpoint.+type ChargeList struct {+ ListMeta+ Data []*Charge `json:"data"`+}++// FraudDetails is the structure detailing fraud status.+type FraudDetails struct {+ UserReport ChargeFraudUserReport `json:"user_report"`+ StripeReport ChargeFraudStripeReport `json:"stripe_report"`+}++// ChargeOutcomeRule tells you the Radar rule that blocked the charge, if any.+type ChargeOutcomeRule struct {+ Action string `json:"action"`+ ID string `json:"id"`+ Predicate string `json:"predicate"`+}++// ChargeOutcome is the charge's outcome that details whether a payment+// was accepted and why.+type ChargeOutcome struct {+ NetworkStatus string `json:"network_status"`+ Reason string `json:"reason"`+ RiskLevel string `json:"risk_level"`+ RiskScore int64 `json:"risk_score"`+ Rule *ChargeOutcomeRule `json:"rule"`+ SellerMessage string `json:"seller_message"`+ Type string `json:"type"`+}++// ShippingDetails is the structure containing shipping information.+type ShippingDetails struct {+ Address *Address `json:"address"`+ Carrier string `json:"carrier"`+ Name string `json:"name"`+ Phone string `json:"phone"`+ TrackingNumber string `json:"tracking_number"`+}++var depth = -1++// UnmarshalJSON handles deserialization of a ChargeOutcomeRule.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *ChargeOutcomeRule) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type chargeOutcomeRule ChargeOutcomeRule+ var v chargeOutcomeRule+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = ChargeOutcomeRule(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/charge/client.go b/vendor/github.com/stripe/stripe-go/charge/client.gonew file mode 100644index 000000000..a5f17ae97--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/charge/client.go@@ -0,0 +1,102 @@+// Package charge provides API functions related to charges.+//+// For more details, see: https://stripe.com/docs/api/go#charges.+package charge++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke APIs related to charges.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new charge.+func New(params *stripe.ChargeParams) (*stripe.Charge, error) {+ return getC().New(params)+}++// New creates a new charge.+func (c Client) New(params *stripe.ChargeParams) (*stripe.Charge, error) {+ charge := &stripe.Charge{}+ err := c.B.Call(http.MethodPost, "/v1/charges", c.Key, params, charge)+ return charge, err+}++// Get retrieves a charge.+func Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {+ return getC().Get(id, params)+}++// Get retrieves a charge.+func (c Client) Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {+ path := stripe.FormatURLPath("/v1/charges/%s", id)+ charge := &stripe.Charge{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, charge)+ return charge, err+}++// Update updates a charge.+func Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {+ return getC().Update(id, params)+}++// Update updates a charge.+func (c Client) Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {+ path := stripe.FormatURLPath("/v1/charges/%s", id)+ charge := &stripe.Charge{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, charge)+ return charge, err+}++// Capture captures a charge that's not yet captured.+func Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) {+ return getC().Capture(id, params)+}++// Capture captures a charge that's not yet captured.+func (c Client) Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) {+ path := stripe.FormatURLPath("/v1/charges/%s/capture", id)+ charge := &stripe.Charge{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, charge)+ return charge, err+}++// List returns an iterator that iterates all charges.+func List(params *stripe.ChargeListParams) *Iter {+ return getC().List(params)+}++// List returns an iterator that iterates all charges.+func (c Client) List(listParams *stripe.ChargeListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ChargeList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/charges", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for charges.+type Iter struct {+ *stripe.Iter+}++// Charge returns the charge which the iterator is currently pointing to.+func (i *Iter) Charge() *stripe.Charge {+ return i.Current().(*stripe.Charge)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/client/api.go b/vendor/github.com/stripe/stripe-go/client/api.gonew file mode 100644index 000000000..18c8fb939--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/client/api.go@@ -0,0 +1,258 @@+// Package client provides a Stripe client for invoking APIs across all resources+package client++import (+ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/account"+ "github.com/stripe/stripe-go/applepaydomain"+ "github.com/stripe/stripe-go/balance"+ "github.com/stripe/stripe-go/bankaccount"+ "github.com/stripe/stripe-go/bitcoinreceiver"+ "github.com/stripe/stripe-go/bitcointransaction"+ "github.com/stripe/stripe-go/card"+ "github.com/stripe/stripe-go/charge"+ "github.com/stripe/stripe-go/countryspec"+ "github.com/stripe/stripe-go/coupon"+ "github.com/stripe/stripe-go/customer"+ "github.com/stripe/stripe-go/discount"+ "github.com/stripe/stripe-go/dispute"+ "github.com/stripe/stripe-go/ephemeralkey"+ "github.com/stripe/stripe-go/event"+ "github.com/stripe/stripe-go/exchangerate"+ "github.com/stripe/stripe-go/fee"+ "github.com/stripe/stripe-go/feerefund"+ "github.com/stripe/stripe-go/file"+ "github.com/stripe/stripe-go/filelink"+ "github.com/stripe/stripe-go/invoice"+ "github.com/stripe/stripe-go/invoiceitem"+ "github.com/stripe/stripe-go/issuerfraudrecord"+ "github.com/stripe/stripe-go/issuing/authorization"+ issuingcard "github.com/stripe/stripe-go/issuing/card"+ "github.com/stripe/stripe-go/issuing/cardholder"+ issuingdispute "github.com/stripe/stripe-go/issuing/dispute"+ "github.com/stripe/stripe-go/issuing/transaction"+ "github.com/stripe/stripe-go/loginlink"+ "github.com/stripe/stripe-go/order"+ "github.com/stripe/stripe-go/orderreturn"+ "github.com/stripe/stripe-go/paymentintent"+ "github.com/stripe/stripe-go/paymentsource"+ "github.com/stripe/stripe-go/payout"+ "github.com/stripe/stripe-go/plan"+ "github.com/stripe/stripe-go/product"+ "github.com/stripe/stripe-go/radar/valuelist"+ "github.com/stripe/stripe-go/radar/valuelistitem"+ "github.com/stripe/stripe-go/recipient"+ "github.com/stripe/stripe-go/refund"+ "github.com/stripe/stripe-go/reporting/reportrun"+ "github.com/stripe/stripe-go/reporting/reporttype"+ "github.com/stripe/stripe-go/reversal"+ "github.com/stripe/stripe-go/sigma/scheduledqueryrun"+ "github.com/stripe/stripe-go/sku"+ "github.com/stripe/stripe-go/source"+ "github.com/stripe/stripe-go/sourcetransaction"+ "github.com/stripe/stripe-go/sub"+ "github.com/stripe/stripe-go/subitem"+ terminalconnectiontoken "github.com/stripe/stripe-go/terminal/connectiontoken"+ terminallocation "github.com/stripe/stripe-go/terminal/location"+ terminalreader "github.com/stripe/stripe-go/terminal/reader"+ "github.com/stripe/stripe-go/token"+ "github.com/stripe/stripe-go/topup"+ "github.com/stripe/stripe-go/transfer"+ "github.com/stripe/stripe-go/usagerecord"+ "github.com/stripe/stripe-go/webhookendpoint"+)++// API is the Stripe client. It contains all the different resources available.+type API struct {+ // Account is the client used to invoke /accounts APIs.+ Account *account.Client+ // ApplePayDomains is the client used to invoke /apple_pay/domains APIs.+ ApplePayDomains *applepaydomain.Client+ // Balance is the client used to invoke /balance and transaction-related APIs.+ Balance *balance.Client+ // BankAccounts is the client used to invoke bank account related APIs.+ BankAccounts *bankaccount.Client+ // BitcoinReceivers is the client used to invoke /bitcoin/receivers APIs.+ BitcoinReceivers *bitcoinreceiver.Client+ // BitcoinTransactions is the client used to invoke /bitcoin/transactions APIs.+ BitcoinTransactions *bitcointransaction.Client+ // Cards is the client used to invoke card related APIs.+ Cards *card.Client+ // Charges is the client used to invoke /charges APIs.+ Charges *charge.Client+ // CountrySpec is the client used to invoke /country_specs APIs.+ CountrySpec *countryspec.Client+ // Coupons is the client used to invoke /coupons APIs.+ Coupons *coupon.Client+ // Customers is the client used to invoke /customers APIs.+ Customers *customer.Client+ // Discounts is the client used to invoke discount related APIs.+ Discounts *discount.Client+ // Disputes is the client used to invoke /disputes APIs.+ Disputes *dispute.Client+ // EphemeralKeys is the client used to invoke /ephemeral_keys APIs.+ EphemeralKeys *ephemeralkey.Client+ // Events is the client used to invoke /events APIs.+ Events *event.Client+ // ExchangeRates is the client used to invoke /exchange_rates APIs.+ ExchangeRates *exchangerate.Client+ // Fees is the client used to invoke /application_fees APIs.+ Fees *fee.Client+ // FeeRefunds is the client used to invoke /application_fees/refunds APIs.+ FeeRefunds *feerefund.Client+ // Files is the client used to invoke the /files APIs.+ Files *file.Client+ // FileLinks is the client used to invoke the /file_links APIs.+ FileLinks *filelink.Client+ // Invoices is the client used to invoke /invoices APIs.+ Invoices *invoice.Client+ // InvoiceItems is the client used to invoke /invoiceitems APIs.+ InvoiceItems *invoiceitem.Client+ // IssuerFraudRecords is the client used to invoke /issuer_fraud_records APIs.+ IssuerFraudRecords *issuerfraudrecord.Client+ // IssuingAuthorizations is the client used to invoke /issuing/authorizations APIs.+ IssuingAuthorizations *authorization.Client+ // IssuingCardholders is the client used to invoke /issuing/cardholders APIs.+ IssuingCardholders *cardholder.Client+ // IssuingCards is the client used to invoke /issuing/cards APIs.+ IssuingCards *issuingcard.Client+ // IssuingDisputes is the client used to invoke /issuing/disputes APIs.+ IssuingDisputes *issuingdispute.Client+ // IssuingTransactions is the client used to invoke /issuing/transactions APIs.+ IssuingTransactions *transaction.Client+ // LoginLinks is the client used to invoke login link related APIs.+ LoginLinks *loginlink.Client+ // Orders is the client used to invoke /orders APIs.+ Orders *order.Client+ // OrderReturns is the client used to invoke /order_returns APIs.+ OrderReturns *orderreturn.Client+ // PaymentIntents is the client used to invoke /payment_intents APIs.+ PaymentIntents *paymentintent.Client+ // PaymentSource is used to invoke customer sources related APIs.+ PaymentSource *paymentsource.Client+ // Payouts is the client used to invoke /payouts APIs.+ Payouts *payout.Client+ // Plans is the client used to invoke /plans APIs.+ Plans *plan.Client+ // Products is the client used to invoke /products APIs.+ Products *product.Client+ // RadarValueLists is the client used to invoke /radar/value_lists APIs.+ RadarValueLists *valuelist.Client+ // RadarValueListItems is the client used to invoke /radar/value_list_items APIs.+ RadarValueListItems *valuelistitem.Client+ // Recipients is the client used to invoke /recipients APIs.+ Recipients *recipient.Client+ // Refunds is the client used to invoke /refunds APIs.+ Refunds *refund.Client+ // ReportRuns is the client used to invoke /reporting/report_runs APIs.+ ReportRuns *reportrun.Client+ // ReportTypes is the client used to invoke /reporting/report_types APIs.+ ReportTypes *reporttype.Client+ // Reversals is the client used to invoke /transfers/reversals APIs.+ Reversals *reversal.Client+ // SigmaScheduledQueryRuns is the client used to invoke /sigma/scheduled_query_runs APIs.+ SigmaScheduledQueryRuns *scheduledqueryrun.Client+ // Skus is the client used to invoke /skus APIs.+ Skus *sku.Client+ // Sources is the client used to invoke /sources APIs.+ Sources *source.Client+ // SourceTransactions is the client used to invoke source transaction related APIs.+ SourceTransactions *sourcetransaction.Client+ // Subscriptions is the client used to invoke /subscriptions APIs.+ Subscriptions *sub.Client+ // SubscriptionItems is the client used to invoke subscription's items related APIs.+ SubscriptionItems *subitem.Client+ // TerminalConnectionTokens is the client used to invoke /terminal/connectiontokens related APIs.+ TerminalConnectionTokens *terminalconnectiontoken.Client+ // TerminalLocations is the client used to invoke /terminal/locations related APIs.+ TerminalLocations *terminallocation.Client+ // TerminalReaders is the client used to invoke /terminal/readers related APIs.+ TerminalReaders *terminalreader.Client+ // Tokens is the client used to invoke /tokens APIs.+ Tokens *token.Client+ // Topups is the client used to invoke /tokens APIs.+ Topups *topup.Client+ // Transfers is the client used to invoke /transfers APIs.+ Transfers *transfer.Client+ // UsageRecords is the client used to invoke usage record related APIs.+ UsageRecords *usagerecord.Client+ // WebhookEndpoints is the client used to invoke usage record related APIs.+ WebhookEndpoints *webhookendpoint.Client+}++// Init initializes the Stripe client with the appropriate secret key+// as well as providing the ability to override the backend as needed.+func (a *API) Init(key string, backends *stripe.Backends) {+ if backends == nil {+ backends = &stripe.Backends{+ API: stripe.GetBackend(stripe.APIBackend),+ Uploads: stripe.GetBackend(stripe.UploadsBackend),+ }+ }++ a.Account = &account.Client{B: backends.API, Key: key}+ a.ApplePayDomains = &applepaydomain.Client{B: backends.API, Key: key}+ a.Balance = &balance.Client{B: backends.API, Key: key}+ a.BankAccounts = &bankaccount.Client{B: backends.API, Key: key}+ a.BitcoinReceivers = &bitcoinreceiver.Client{B: backends.API, Key: key}+ a.BitcoinTransactions = &bitcointransaction.Client{B: backends.API, Key: key}+ a.Cards = &card.Client{B: backends.API, Key: key}+ a.Charges = &charge.Client{B: backends.API, Key: key}+ a.CountrySpec = &countryspec.Client{B: backends.API, Key: key}+ a.Coupons = &coupon.Client{B: backends.API, Key: key}+ a.Customers = &customer.Client{B: backends.API, Key: key}+ a.Discounts = &discount.Client{B: backends.API, Key: key}+ a.Disputes = &dispute.Client{B: backends.API, Key: key}+ a.EphemeralKeys = &ephemeralkey.Client{B: backends.API, Key: key}+ a.ExchangeRates = &exchangerate.Client{B: backends.API, Key: key}+ a.Events = &event.Client{B: backends.API, Key: key}+ a.Fees = &fee.Client{B: backends.API, Key: key}+ a.FeeRefunds = &feerefund.Client{B: backends.API, Key: key}+ a.Files = &file.Client{B: backends.Uploads, Key: key}+ a.FileLinks = &filelink.Client{B: backends.API, Key: key}+ a.Invoices = &invoice.Client{B: backends.API, Key: key}+ a.InvoiceItems = &invoiceitem.Client{B: backends.API, Key: key}+ a.IssuerFraudRecords = &issuerfraudrecord.Client{B: backends.API, Key: key}+ a.IssuingAuthorizations = &authorization.Client{B: backends.API, Key: key}+ a.IssuingCardholders = &cardholder.Client{B: backends.API, Key: key}+ a.IssuingCards = &issuingcard.Client{B: backends.API, Key: key}+ a.IssuingDisputes = &issuingdispute.Client{B: backends.API, Key: key}+ a.IssuingTransactions = &transaction.Client{B: backends.API, Key: key}+ a.LoginLinks = &loginlink.Client{B: backends.API, Key: key}+ a.Orders = &order.Client{B: backends.API, Key: key}+ a.OrderReturns = &orderreturn.Client{B: backends.API, Key: key}+ a.PaymentIntents = &paymentintent.Client{B: backends.API, Key: key}+ a.PaymentSource = &paymentsource.Client{B: backends.API, Key: key}+ a.Payouts = &payout.Client{B: backends.API, Key: key}+ a.Plans = &plan.Client{B: backends.API, Key: key}+ a.Products = &product.Client{B: backends.API, Key: key}+ a.RadarValueLists = &valuelist.Client{B: backends.API, Key: key}+ a.RadarValueListItems = &valuelistitem.Client{B: backends.API, Key: key}+ a.Recipients = &recipient.Client{B: backends.API, Key: key}+ a.Refunds = &refund.Client{B: backends.API, Key: key}+ a.ReportRuns = &reportrun.Client{B: backends.API, Key: key}+ a.ReportTypes = &reporttype.Client{B: backends.API, Key: key}+ a.Reversals = &reversal.Client{B: backends.API, Key: key}+ a.SigmaScheduledQueryRuns = &scheduledqueryrun.Client{B: backends.API, Key: key}+ a.Skus = &sku.Client{B: backends.API, Key: key}+ a.Sources = &source.Client{B: backends.API, Key: key}+ a.SourceTransactions = &sourcetransaction.Client{B: backends.API, Key: key}+ a.Subscriptions = &sub.Client{B: backends.API, Key: key}+ a.SubscriptionItems = &subitem.Client{B: backends.API, Key: key}+ a.TerminalConnectionTokens = &terminalconnectiontoken.Client{B: backends.API, Key: key}+ a.TerminalLocations = &terminallocation.Client{B: backends.API, Key: key}+ a.TerminalReaders = &terminalreader.Client{B: backends.API, Key: key}+ a.Tokens = &token.Client{B: backends.API, Key: key}+ a.Topups = &topup.Client{B: backends.API, Key: key}+ a.Transfers = &transfer.Client{B: backends.API, Key: key}+ a.UsageRecords = &usagerecord.Client{B: backends.API, Key: key}+ a.WebhookEndpoints = &webhookendpoint.Client{B: backends.API, Key: key}+}++// New creates a new Stripe client with the appropriate secret key+// as well as providing the ability to override the backends as needed.+func New(key string, backends *stripe.Backends) *API {+ api := API{}+ api.Init(key, backends)+ return &api+}diff --git a/vendor/github.com/stripe/stripe-go/countryspec.go b/vendor/github.com/stripe/stripe-go/countryspec.gonew file mode 100644index 000000000..2596d872b--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/countryspec.go@@ -0,0 +1,39 @@+package stripe++// Country is the list of supported countries+type Country string++// VerificationFieldsList lists the fields needed for an account verification.+// For more details see https://stripe.com/docs/api#country_spec_object-verification_fields.+type VerificationFieldsList struct {+ AdditionalFields []string `json:"additional"`+ Minimum []string `json:"minimum"`+}++// CountrySpec is the resource representing the rules required for a Stripe account.+// For more details see https://stripe.com/docs/api/#country_specs.+type CountrySpec struct {+ DefaultCurrency Currency `json:"default_currency"`+ ID string `json:"id"`+ SupportedBankAccountCurrencies map[Currency][]Country `json:"supported_bank_account_currencies"`+ SupportedPaymentCurrencies []Currency `json:"supported_payment_currencies"`+ SupportedPaymentMethods []string `json:"supported_payment_methods"`+ SupportedTransferCountries []string `json:"supported_transfer_countries"`+ VerificationFields map[LegalEntityType]*VerificationFieldsList `json:"verification_fields"`+}++// CountrySpecParams are the parameters allowed during CountrySpec retrieval.+type CountrySpecParams struct {+ Params `form:"*"`+}++// CountrySpecList is a list of country specs as retrieved from a list endpoint.+type CountrySpecList struct {+ ListMeta+ Data []*CountrySpec `json:"data"`+}++// CountrySpecListParams are the parameters allowed during CountrySpec listing.+type CountrySpecListParams struct {+ ListParams `form:"*"`+}diff --git a/vendor/github.com/stripe/stripe-go/countryspec/client.go b/vendor/github.com/stripe/stripe-go/countryspec/client.gonew file mode 100644index 000000000..3c80fe840--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/countryspec/client.go@@ -0,0 +1,62 @@+// Package countryspec provides the /country_specs APIs+package countryspec++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /country_specs and countryspec-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns a Country Spec for a given country code.+func Get(country string, params *stripe.CountrySpecParams) (*stripe.CountrySpec, error) {+ return getC().Get(country, params)+}++// Get returns a Country Spec for a given country code.+func (c Client) Get(country string, params *stripe.CountrySpecParams) (*stripe.CountrySpec, error) {+ path := stripe.FormatURLPath("/v1/country_specs/%s", country)+ countrySpec := &stripe.CountrySpec{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, countrySpec)+ return countrySpec, err+}++// List lists available Country Specs.+func List(params *stripe.CountrySpecListParams) *Iter {+ return getC().List(params)+}++// List lists available Country Specs.+func (c Client) List(listParams *stripe.CountrySpecListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.CountrySpecList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/country_specs", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for Country Specs.+type Iter struct {+ *stripe.Iter+}++// CountrySpec returns the Country Spec which the iterator is currently pointing to.+func (i *Iter) CountrySpec() *stripe.CountrySpec {+ return i.Current().(*stripe.CountrySpec)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/coupon.go b/vendor/github.com/stripe/stripe-go/coupon.gonew file mode 100644index 000000000..d6aaf6fb0--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/coupon.go@@ -0,0 +1,81 @@+package stripe++import "encoding/json"++// CouponDuration is the list of allowed values for the coupon's duration.+type CouponDuration string++// List of values that CouponDuration can take.+const (+ CouponDurationForever CouponDuration = "forever"+ CouponDurationOnce CouponDuration = "once"+ CouponDurationRepeating CouponDuration = "repeating"+)++// CouponParams is the set of parameters that can be used when creating a coupon.+// For more details see https://stripe.com/docs/api#create_coupon.+type CouponParams struct {+ Params `form:"*"`+ AmountOff *int64 `form:"amount_off"`+ Currency *string `form:"currency"`+ Duration *string `form:"duration"`+ DurationInMonths *int64 `form:"duration_in_months"`+ ID *string `form:"id"`+ MaxRedemptions *int64 `form:"max_redemptions"`+ Name *string `form:"name"`+ PercentOff *float64 `form:"percent_off"`+ RedeemBy *int64 `form:"redeem_by"`+}++// CouponListParams is the set of parameters that can be used when listing coupons.+// For more detail see https://stripe.com/docs/api#list_coupons.+type CouponListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// Coupon is the resource representing a Stripe coupon.+// For more details see https://stripe.com/docs/api#coupons.+type Coupon struct {+ AmountOff int64 `json:"amount_off"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Deleted bool `json:"deleted"`+ Duration CouponDuration `json:"duration"`+ DurationInMonths int64 `json:"duration_in_months"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ MaxRedemptions int64 `json:"max_redemptions"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ PercentOff float64 `json:"percent_off"`+ RedeemBy int64 `json:"redeem_by"`+ TimesRedeemed int64 `json:"times_redeemed"`+ Valid bool `json:"valid"`+}++// CouponList is a list of coupons as retrieved from a list endpoint.+type CouponList struct {+ ListMeta+ Data []*Coupon `json:"data"`+}++// UnmarshalJSON handles deserialization of a Coupon.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *Coupon) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type coupon Coupon+ var v coupon+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = Coupon(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/coupon/client.go b/vendor/github.com/stripe/stripe-go/coupon/client.gonew file mode 100644index 000000000..da17e9eeb--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/coupon/client.go@@ -0,0 +1,100 @@+// Package coupon provides the /coupons APIs+package coupon++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /coupons APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new coupon.+func New(params *stripe.CouponParams) (*stripe.Coupon, error) {+ return getC().New(params)+}++// New creates a new coupon.+func (c Client) New(params *stripe.CouponParams) (*stripe.Coupon, error) {+ coupon := &stripe.Coupon{}+ err := c.B.Call(http.MethodPost, "/v1/coupons", c.Key, params, coupon)+ return coupon, err+}++// Get returns the details of a coupon.+func Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ return getC().Get(id, params)+}++// Get returns the details of a coupon.+func (c Client) Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ path := stripe.FormatURLPath("/v1/coupons/%s", id)+ coupon := &stripe.Coupon{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, coupon)+ return coupon, err+}++// Update updates a coupon's properties.+func Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ return getC().Update(id, params)+}++// Update updates a coupon's properties.+func (c Client) Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ path := stripe.FormatURLPath("/v1/coupons/%s", id)+ coupon := &stripe.Coupon{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, coupon)+ return coupon, err+}++// Del removes a coupon.+func Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ return getC().Del(id, params)+}++// Del removes a coupon.+func (c Client) Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {+ path := stripe.FormatURLPath("/v1/coupons/%s", id)+ coupon := &stripe.Coupon{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, coupon)+ return coupon, err+}++// List returns a list of coupons.+func List(params *stripe.CouponListParams) *Iter {+ return getC().List(params)+}++// List returns a list of coupons.+func (c Client) List(listParams *stripe.CouponListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.CouponList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/coupons", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for coupons.+type Iter struct {+ *stripe.Iter+}++// Coupon returns the coupon which the iterator is currently pointing to.+func (i *Iter) Coupon() *stripe.Coupon {+ return i.Current().(*stripe.Coupon)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/currency.go b/vendor/github.com/stripe/stripe-go/currency.gonew file mode 100644index 000000000..2de674941--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/currency.go@@ -0,0 +1,148 @@+package stripe++// Currency is the list of supported currencies.+// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support.+type Currency string++// List of values that Currency can take.+const (+ CurrencyAED Currency = "aed" // United Arab Emirates Dirham+ CurrencyAFN Currency = "afn" // Afghan Afghani+ CurrencyALL Currency = "all" // Albanian Lek+ CurrencyAMD Currency = "amd" // Armenian Dram+ CurrencyANG Currency = "ang" // Netherlands Antillean Gulden+ CurrencyAOA Currency = "aoa" // Angolan Kwanza+ CurrencyARS Currency = "ars" // Argentine Peso+ CurrencyAUD Currency = "aud" // Australian Dollar+ CurrencyAWG Currency = "awg" // Aruban Florin+ CurrencyAZN Currency = "azn" // Azerbaijani Manat+ CurrencyBAM Currency = "bam" // Bosnia & Herzegovina Convertible Mark+ CurrencyBBD Currency = "bbd" // Barbadian Dollar+ CurrencyBDT Currency = "bdt" // Bangladeshi Taka+ CurrencyBGN Currency = "bgn" // Bulgarian Lev+ CurrencyBIF Currency = "bif" // Burundian Franc+ CurrencyBMD Currency = "bmd" // Bermudian Dollar+ CurrencyBND Currency = "bnd" // Brunei Dollar+ CurrencyBOB Currency = "bob" // Bolivian Boliviano+ CurrencyBRL Currency = "brl" // Brazilian Real+ CurrencyBSD Currency = "bsd" // Bahamian Dollar+ CurrencyBWP Currency = "bwp" // Botswana Pula+ CurrencyBZD Currency = "bzd" // Belize Dollar+ CurrencyCAD Currency = "cad" // Canadian Dollar+ CurrencyCDF Currency = "cdf" // Congolese Franc+ CurrencyCHF Currency = "chf" // Swiss Franc+ CurrencyCLP Currency = "clp" // Chilean Peso+ CurrencyCNY Currency = "cny" // Chinese Renminbi Yuan+ CurrencyCOP Currency = "cop" // Colombian Peso+ CurrencyCRC Currency = "crc" // Costa Rican Colón+ CurrencyCVE Currency = "cve" // Cape Verdean Escudo+ CurrencyCZK Currency = "czk" // Czech Koruna+ CurrencyDJF Currency = "djf" // Djiboutian Franc+ CurrencyDKK Currency = "dkk" // Danish Krone+ CurrencyDOP Currency = "dop" // Dominican Peso+ CurrencyDZD Currency = "dzd" // Algerian Dinar+ CurrencyEEK Currency = "eek" // Estonian Kroon+ CurrencyEGP Currency = "egp" // Egyptian Pound+ CurrencyETB Currency = "etb" // Ethiopian Birr+ CurrencyEUR Currency = "eur" // Euro+ CurrencyFJD Currency = "fjd" // Fijian Dollar+ CurrencyFKP Currency = "fkp" // Falkland Islands Pound+ CurrencyGBP Currency = "gbp" // British Pound+ CurrencyGEL Currency = "gel" // Georgian Lari+ CurrencyGIP Currency = "gip" // Gibraltar Pound+ CurrencyGMD Currency = "gmd" // Gambian Dalasi+ CurrencyGNF Currency = "gnf" // Guinean Franc+ CurrencyGTQ Currency = "gtq" // Guatemalan Quetzal+ CurrencyGYD Currency = "gyd" // Guyanese Dollar+ CurrencyHKD Currency = "hkd" // Hong Kong Dollar+ CurrencyHNL Currency = "hnl" // Honduran Lempira+ CurrencyHRK Currency = "hrk" // Croatian Kuna+ CurrencyHTG Currency = "htg" // Haitian Gourde+ CurrencyHUF Currency = "huf" // Hungarian Forint+ CurrencyIDR Currency = "idr" // Indonesian Rupiah+ CurrencyILS Currency = "ils" // Israeli New Sheqel+ CurrencyINR Currency = "inr" // Indian Rupee+ CurrencyISK Currency = "isk" // Icelandic Króna+ CurrencyJMD Currency = "jmd" // Jamaican Dollar+ CurrencyJPY Currency = "jpy" // Japanese Yen+ CurrencyKES Currency = "kes" // Kenyan Shilling+ CurrencyKGS Currency = "kgs" // Kyrgyzstani Som+ CurrencyKHR Currency = "khr" // Cambodian Riel+ CurrencyKMF Currency = "kmf" // Comorian Franc+ CurrencyKRW Currency = "krw" // South Korean Won+ CurrencyKYD Currency = "kyd" // Cayman Islands Dollar+ CurrencyKZT Currency = "kzt" // Kazakhstani Tenge+ CurrencyLAK Currency = "lak" // Lao Kip+ CurrencyLBP Currency = "lbp" // Lebanese Pound+ CurrencyLKR Currency = "lkr" // Sri Lankan Rupee+ CurrencyLRD Currency = "lrd" // Liberian Dollar+ CurrencyLSL Currency = "lsl" // Lesotho Loti+ CurrencyLTL Currency = "ltl" // Lithuanian Litas+ CurrencyLVL Currency = "lvl" // Latvian Lats+ CurrencyMAD Currency = "mad" // Moroccan Dirham+ CurrencyMDL Currency = "mdl" // Moldovan Leu+ CurrencyMGA Currency = "mga" // Malagasy Ariary+ CurrencyMKD Currency = "mkd" // Macedonian Denar+ CurrencyMNT Currency = "mnt" // Mongolian Tögrög+ CurrencyMOP Currency = "mop" // Macanese Pataca+ CurrencyMRO Currency = "mro" // Mauritanian Ouguiya+ CurrencyMUR Currency = "mur" // Mauritian Rupee+ CurrencyMVR Currency = "mvr" // Maldivian Rufiyaa+ CurrencyMWK Currency = "mwk" // Malawian Kwacha+ CurrencyMXN Currency = "mxn" // Mexican Peso+ CurrencyMYR Currency = "myr" // Malaysian Ringgit+ CurrencyMZN Currency = "mzn" // Mozambican Metical+ CurrencyNAD Currency = "nad" // Namibian Dollar+ CurrencyNGN Currency = "ngn" // Nigerian Naira+ CurrencyNIO Currency = "nio" // Nicaraguan Córdoba+ CurrencyNOK Currency = "nok" // Norwegian Krone+ CurrencyNPR Currency = "npr" // Nepalese Rupee+ CurrencyNZD Currency = "nzd" // New Zealand Dollar+ CurrencyPAB Currency = "pab" // Panamanian Balboa+ CurrencyPEN Currency = "pen" // Peruvian Nuevo Sol+ CurrencyPGK Currency = "pgk" // Papua New Guinean Kina+ CurrencyPHP Currency = "php" // Philippine Peso+ CurrencyPKR Currency = "pkr" // Pakistani Rupee+ CurrencyPLN Currency = "pln" // Polish Złoty+ CurrencyPYG Currency = "pyg" // Paraguayan Guaraní+ CurrencyQAR Currency = "qar" // Qatari Riyal+ CurrencyRON Currency = "ron" // Romanian Leu+ CurrencyRSD Currency = "rsd" // Serbian Dinar+ CurrencyRUB Currency = "rub" // Russian Ruble+ CurrencyRWF Currency = "rwf" // Rwandan Franc+ CurrencySAR Currency = "sar" // Saudi Riyal+ CurrencySBD Currency = "sbd" // Solomon Islands Dollar+ CurrencySCR Currency = "scr" // Seychellois Rupee+ CurrencySEK Currency = "sek" // Swedish Krona+ CurrencySGD Currency = "sgd" // Singapore Dollar+ CurrencySHP Currency = "shp" // Saint Helenian Pound+ CurrencySLL Currency = "sll" // Sierra Leonean Leone+ CurrencySOS Currency = "sos" // Somali Shilling+ CurrencySRD Currency = "srd" // Surinamese Dollar+ CurrencySTD Currency = "std" // São Tomé and Príncipe Dobra+ CurrencySVC Currency = "svc" // Salvadoran Colón+ CurrencySZL Currency = "szl" // Swazi Lilangeni+ CurrencyTHB Currency = "thb" // Thai Baht+ CurrencyTJS Currency = "tjs" // Tajikistani Somoni+ CurrencyTOP Currency = "top" // Tongan Paʻanga+ CurrencyTRY Currency = "try" // Turkish Lira+ CurrencyTTD Currency = "ttd" // Trinidad and Tobago Dollar+ CurrencyTWD Currency = "twd" // New Taiwan Dollar+ CurrencyTZS Currency = "tzs" // Tanzanian Shilling+ CurrencyUAH Currency = "uah" // Ukrainian Hryvnia+ CurrencyUGX Currency = "ugx" // Ugandan Shilling+ CurrencyUSD Currency = "usd" // United States Dollar+ CurrencyUYU Currency = "uyu" // Uruguayan Peso+ CurrencyUZS Currency = "uzs" // Uzbekistani Som+ CurrencyVEF Currency = "vef" // Venezuelan Bolívar+ CurrencyVND Currency = "vnd" // Vietnamese Đồng+ CurrencyVUV Currency = "vuv" // Vanuatu Vatu+ CurrencyWST Currency = "wst" // Samoan Tala+ CurrencyXAF Currency = "xaf" // Central African Cfa Franc+ CurrencyXCD Currency = "xcd" // East Caribbean Dollar+ CurrencyXOF Currency = "xof" // West African Cfa Franc+ CurrencyXPF Currency = "xpf" // Cfp Franc+ CurrencyYER Currency = "yer" // Yemeni Rial+ CurrencyZAR Currency = "zar" // South African Rand+ CurrencyZMW Currency = "zmw" // Zambian Kwacha+)diff --git a/vendor/github.com/stripe/stripe-go/customer.go b/vendor/github.com/stripe/stripe-go/customer.gonew file mode 100644index 000000000..ef14a9844--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/customer.go@@ -0,0 +1,139 @@+package stripe++import (+ "encoding/json"+)++// CustomerTaxInfoType is the type of tax info associated with a customer.+type CustomerTaxInfoType string++// List of values that CustomerTaxInfoType can take.+const (+ CustomerTaxInfoTypeVAT CustomerTaxInfoType = "vat"+)++// CustomerTaxInfoVerificationStatus is the type of tax info associated with a customer.+type CustomerTaxInfoVerificationStatus string++// List of values that CustomerTaxInfoType can take.+const (+ CustomerTaxInfoVerificationStatusPending CustomerTaxInfoVerificationStatus = "pending"+ CustomerTaxInfoVerificationStatusUnverified CustomerTaxInfoVerificationStatus = "unverified"+ CustomerTaxInfoVerificationStatusVerified CustomerTaxInfoVerificationStatus = "verified"+)++// CustomerParams is the set of parameters that can be used when creating or updating a customer.+// For more details see https://stripe.com/docs/api#create_customer and https://stripe.com/docs/api#update_customer.+type CustomerParams struct {+ Params `form:"*"`+ AccountBalance *int64 `form:"account_balance"`+ Coupon *string `form:"coupon"`+ DefaultSource *string `form:"default_source"`+ Description *string `form:"description"`+ Email *string `form:"email"`+ InvoicePrefix *string `form:"invoice_prefix"`+ Plan *string `form:"plan"`+ Quantity *int64 `form:"quantity"`+ Shipping *CustomerShippingDetailsParams `form:"shipping"`+ Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"+ TaxInfo *CustomerTaxInfoParams `form:"tax_info"`+ TaxPercent *float64 `form:"tax_percent"`+ Token *string `form:"-"` // This doesn't seem to be used?+ TrialEnd *int64 `form:"trial_end"`+}++// CustomerShippingDetailsParams is the structure containing shipping information.+type CustomerShippingDetailsParams struct {+ Address *AddressParams `form:"address"`+ Name *string `form:"name"`+ Phone *string `form:"phone"`+}++// CustomerTaxInfoParams is the structure containing tax information for the customer.+type CustomerTaxInfoParams struct {+ TaxID *string `form:"tax_id"`+ Type *string `form:"type"`+}++// SetSource adds valid sources to a CustomerParams object,+// returning an error for unsupported sources.+func (cp *CustomerParams) SetSource(sp interface{}) error {+ source, err := SourceParamsFor(sp)+ cp.Source = source+ return err+}++// CustomerListParams is the set of parameters that can be used when listing customers.+// For more details see https://stripe.com/docs/api#list_customers.+type CustomerListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// Customer is the resource representing a Stripe customer.+// For more details see https://stripe.com/docs/api#customers.+type Customer struct {+ AccountBalance int64 `json:"account_balance"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ DefaultSource *PaymentSource `json:"default_source"`+ Deleted bool `json:"deleted"`+ Delinquent bool `json:"delinquent"`+ Description string `json:"description"`+ Discount *Discount `json:"discount"`+ Email string `json:"email"`+ ID string `json:"id"`+ InvoicePrefix string `json:"invoice_prefix"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Shipping *CustomerShippingDetails `json:"shipping"`+ Sources *SourceList `json:"sources"`+ Subscriptions *SubscriptionList `json:"subscriptions"`+ TaxInfo *CustomerTaxInfo `json:"tax_info"`+ TaxInfoVerification *CustomerTaxInfoVerification `json:"tax_info_verification"`+}++// CustomerList is a list of customers as retrieved from a list endpoint.+type CustomerList struct {+ ListMeta+ Data []*Customer `json:"data"`+}++// CustomerShippingDetails is the structure containing shipping information.+type CustomerShippingDetails struct {+ Address Address `json:"address"`+ Name string `json:"name"`+ Phone string `json:"phone"`+}++// CustomerTaxInfo is the structure containing tax information for the customer.+type CustomerTaxInfo struct {+ TaxID string `json:"tax_id"`+ Type CustomerTaxInfoType `json:"type"`+}++// CustomerTaxInfoVerification is the structure containing tax verification for the customer.+type CustomerTaxInfoVerification struct {+ Status CustomerTaxInfoVerificationStatus `json:"status"`+ VerifiedName string `json:"verified_name"`+}++// UnmarshalJSON handles deserialization of a Customer.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *Customer) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type customer Customer+ var v customer+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = Customer(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/customer/client.go b/vendor/github.com/stripe/stripe-go/customer/client.gonew file mode 100644index 000000000..d7cacd510--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/customer/client.go@@ -0,0 +1,100 @@+// Package customer provides the /customers APIs+package customer++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /customers APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new customer.+func New(params *stripe.CustomerParams) (*stripe.Customer, error) {+ return getC().New(params)+}++// New creates a new customer.+func (c Client) New(params *stripe.CustomerParams) (*stripe.Customer, error) {+ cust := &stripe.Customer{}+ err := c.B.Call(http.MethodPost, "/v1/customers", c.Key, params, cust)+ return cust, err+}++// Get returns the details of a customer.+func Get(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ return getC().Get(id, params)+}++// Get returns the details of a customer.+func (c Client) Get(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ path := stripe.FormatURLPath("/v1/customers/%s", id)+ cust := &stripe.Customer{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, cust)+ return cust, err+}++// Update updates a customer's properties.+func Update(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ return getC().Update(id, params)+}++// Update updates a customer's properties.+func (c Client) Update(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ path := stripe.FormatURLPath("/v1/customers/%s", id)+ cust := &stripe.Customer{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, cust)+ return cust, err+}++// Del removes a customer.+func Del(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ return getC().Del(id, params)+}++// Del removes a customer.+func (c Client) Del(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {+ path := stripe.FormatURLPath("/v1/customers/%s", id)+ cust := &stripe.Customer{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, cust)+ return cust, err+}++// List returns a list of customers.+func List(params *stripe.CustomerListParams) *Iter {+ return getC().List(params)+}++// List returns a list of customers.+func (c Client) List(listParams *stripe.CustomerListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.CustomerList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/customers", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for customers.+type Iter struct {+ *stripe.Iter+}++// Customer returns the customer which the iterator is currently pointing to.+func (i *Iter) Customer() *stripe.Customer {+ return i.Current().(*stripe.Customer)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/discount.go b/vendor/github.com/stripe/stripe-go/discount.gonew file mode 100644index 000000000..d86a4e60e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/discount.go@@ -0,0 +1,17 @@+package stripe++// DiscountParams is the set of parameters that can be used when deleting a discount.+type DiscountParams struct {+ Params `form:"*"`+}++// Discount is the resource representing a Stripe discount.+// For more details see https://stripe.com/docs/api#discounts.+type Discount struct {+ Coupon *Coupon `json:"coupon"`+ Customer string `json:"customer"`+ Deleted bool `json:"deleted"`+ End int64 `json:"end"`+ Start int64 `json:"start"`+ Subscription string `json:"subscription"`+}diff --git a/vendor/github.com/stripe/stripe-go/discount/client.go b/vendor/github.com/stripe/stripe-go/discount/client.gonew file mode 100644index 000000000..c001277cd--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/discount/client.go@@ -0,0 +1,45 @@+// Package discount provides the discount-related APIs+package discount++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke discount-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Del removes a discount from a customer.+func Del(customerID string, params *stripe.DiscountParams) (*stripe.Discount, error) {+ return getC().Del(customerID, params)+}++// Del removes a discount from a customer.+func (c Client) Del(customerID string, params *stripe.DiscountParams) (*stripe.Discount, error) {+ path := stripe.FormatURLPath("/v1/customers/%s/discount", customerID)+ discount := &stripe.Discount{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, discount)+ return discount, err+}++// DelSubscription removes a discount from a customer's subscription.+func DelSubscription(subscriptionID string, params *stripe.DiscountParams) (*stripe.Discount, error) {+ return getC().DelSub(subscriptionID, params)+}++// DelSub removes a discount from a customer's subscription.+func (c Client) DelSub(subscriptionID string, params *stripe.DiscountParams) (*stripe.Discount, error) {+ path := stripe.FormatURLPath("/v1/subscriptions/%s/discount", subscriptionID)+ discount := &stripe.Discount{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, discount)++ return discount, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/dispute.go b/vendor/github.com/stripe/stripe-go/dispute.gonew file mode 100644index 000000000..182dfb2db--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/dispute.go@@ -0,0 +1,169 @@+package stripe++import (+ "encoding/json"+)++// DisputeReason is the list of allowed values for a discount's reason.+type DisputeReason string++// List of values that DisputeReason can take.+const (+ DisputeReasonCreditNotProcessed DisputeReason = "credit_not_processed"+ DisputeReasonDuplicate DisputeReason = "duplicate"+ DisputeReasonFraudulent DisputeReason = "fraudulent"+ DisputeReasonGeneral DisputeReason = "general"+ DisputeReasonProductNotReceived DisputeReason = "product_not_received"+ DisputeReasonProductUnacceptable DisputeReason = "product_unacceptable"+ DisputeReasonSubscriptionCanceled DisputeReason = "subscription_canceled"+ DisputeReasonUnrecognized DisputeReason = "unrecognized"+)++// DisputeStatus is the list of allowed values for a discount's status.+type DisputeStatus string++// List of values that DisputeStatus can take.+const (+ DisputeStatusChargeRefunded DisputeStatus = "charge_refunded"+ DisputeStatusLost DisputeStatus = "lost"+ DisputeStatusNeedsResponse DisputeStatus = "needs_response"+ DisputeStatusUnderReview DisputeStatus = "under_review"+ DisputeStatusWarningClosed DisputeStatus = "warning_closed"+ DisputeStatusWarningNeedsResponse DisputeStatus = "warning_needs_response"+ DisputeStatusWarningUnderReview DisputeStatus = "warning_under_review"+ DisputeStatusWon DisputeStatus = "won"+)++// DisputeParams is the set of parameters that can be used when updating a dispute.+// For more details see https://stripe.com/docs/api#update_dispute.+type DisputeParams struct {+ Params `form:"*"`+ Evidence *DisputeEvidenceParams `form:"evidence"`+ Submit *bool `form:"submit"`+}++// DisputeEvidenceParams is the set of parameters that can be used when submitting+// evidence for disputes.+type DisputeEvidenceParams struct {+ AccessActivityLog *string `form:"access_activity_log"`+ BillingAddress *string `form:"billing_address"`+ CancellationPolicy *string `form:"cancellation_policy"`+ CancellationPolicyDisclosure *string `form:"cancellation_policy_disclosure"`+ CancellationRebuttal *string `form:"cancellation_rebuttal"`+ CustomerCommunication *string `form:"customer_communication"`+ CustomerEmailAddress *string `form:"customer_email_address"`+ CustomerName *string `form:"customer_name"`+ CustomerPurchaseIP *string `form:"customer_purchase_ip"`+ CustomerSignature *string `form:"customer_signature"`+ DuplicateChargeDocumentation *string `form:"duplicate_charge_documentation"`+ DuplicateChargeExplanation *string `form:"duplicate_charge_explanation"`+ DuplicateChargeID *string `form:"duplicate_charge_id"`+ ProductDescription *string `form:"product_description"`+ Receipt *string `form:"receipt"`+ RefundPolicy *string `form:"refund_policy"`+ RefundPolicyDisclosure *string `form:"refund_policy_disclosure"`+ RefundRefusalExplanation *string `form:"refund_refusal_explanation"`+ ServiceDate *string `form:"service_date"`+ ServiceDocumentation *string `form:"service_documentation"`+ ShippingAddress *string `form:"shipping_address"`+ ShippingCarrier *string `form:"shipping_carrier"`+ ShippingDate *string `form:"shipping_date"`+ ShippingDocumentation *string `form:"shipping_documentation"`+ ShippingTrackingNumber *string `form:"shipping_tracking_number"`+ UncategorizedFile *string `form:"uncategorized_file"`+ UncategorizedText *string `form:"uncategorized_text"`+}++// DisputeListParams is the set of parameters that can be used when listing disputes.+// For more details see https://stripe.com/docs/api#list_disputes.+type DisputeListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// Dispute is the resource representing a Stripe dispute.+// For more details see https://stripe.com/docs/api#disputes.+type Dispute struct {+ Amount int64 `json:"amount"`+ BalanceTransactions []*BalanceTransaction `json:"balance_transactions"`+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Evidence *DisputeEvidence `json:"evidence"`+ EvidenceDetails *EvidenceDetails `json:"evidence_details"`+ ID string `json:"id"`+ IsChargeRefundable bool `json:"is_charge_refundable"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Reason DisputeReason `json:"reason"`+ Status DisputeStatus `json:"status"`+}++// DisputeList is a list of disputes as retrieved from a list endpoint.+type DisputeList struct {+ ListMeta+ Data []*Dispute `json:"data"`+}++// EvidenceDetails is the structure representing more details about+// the dispute.+type EvidenceDetails struct {+ DueBy int64 `json:"due_by"`+ HasEvidence bool `json:"has_evidence"`+ PastDue bool `json:"past_due"`+ SubmissionCount int64 `json:"submission_count"`+}++// DisputeEvidence is the structure that contains various details about+// the evidence submitted for the dispute.+// Almost all fields are strings since there structures (i.e. address)+// do not typically get parsed by anyone and are thus presented as-received.+type DisputeEvidence struct {+ AccessActivityLog string `json:"access_activity_log"`+ BillingAddress string `json:"billing_address"`+ CancellationPolicy *File `json:"cancellation_policy"`+ CancellationPolicyDisclosure string `json:"cancellation_policy_disclosure"`+ CancellationRebuttal string `json:"cancellation_rebuttal"`+ CustomerCommunication *File `json:"customer_communication"`+ CustomerEmailAddress string `json:"customer_email_address"`+ CustomerName string `json:"customer_name"`+ CustomerPurchaseIP string `json:"customer_purchase_ip"`+ CustomerSignature *File `json:"customer_signature"`+ DuplicateChargeDocumentation *File `json:"duplicate_charge_documentation"`+ DuplicateChargeExplanation string `json:"duplicate_charge_explanation"`+ DuplicateChargeID string `json:"duplicate_charge_id"`+ ProductDescription string `json:"product_description"`+ Receipt *File `json:"receipt"`+ RefundPolicy *File `json:"refund_policy"`+ RefundPolicyDisclosure string `json:"refund_policy_disclosure"`+ RefundRefusalExplanation string `json:"refund_refusal_explanation"`+ ServiceDate string `json:"service_date"`+ ServiceDocumentation *File `json:"service_documentation"`+ ShippingAddress string `json:"shipping_address"`+ ShippingCarrier string `json:"shipping_carrier"`+ ShippingDate string `json:"shipping_date"`+ ShippingDocumentation *File `json:"shipping_documentation"`+ ShippingTrackingNumber string `json:"shipping_tracking_number"`+ UncategorizedFile *File `json:"uncategorized_file"`+ UncategorizedText string `json:"uncategorized_text"`+}++// UnmarshalJSON handles deserialization of a Dispute.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (d *Dispute) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ d.ID = id+ return nil+ }++ type dispute Dispute+ var v dispute+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *d = Dispute(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/dispute/client.go b/vendor/github.com/stripe/stripe-go/dispute/client.gonew file mode 100644index 000000000..d577b7e5c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/dispute/client.go@@ -0,0 +1,87 @@+package dispute++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke dispute-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of a dispute.+func Get(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ return getC().Get(id, params)+}++// Get returns the details of a dispute.+func (c Client) Get(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ path := stripe.FormatURLPath("/v1/disputes/%s", id)+ dispute := &stripe.Dispute{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, dispute)+ return dispute, err+}++// List returns a list of disputes.+func List(params *stripe.DisputeListParams) *Iter {+ return getC().List(params)+}++// List returns a list of disputes.+func (c Client) List(listParams *stripe.DisputeListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.DisputeList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/disputes", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Update updates a dispute.+func Update(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ return getC().Update(id, params)+}++// Update updates a dispute.+func (c Client) Update(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ path := stripe.FormatURLPath("/v1/disputes/%s", id)+ dispute := &stripe.Dispute{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, dispute)+ return dispute, err+}++// Close dismisses a dispute in the customer's favor.+func Close(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ return getC().Close(id, params)+}++// Close dismisses a dispute in the customer's favor.+func (c Client) Close(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {+ path := stripe.FormatURLPath("/v1/disputes/%s/close", id)+ dispute := &stripe.Dispute{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, dispute)+ return dispute, err+}++// Iter is an iterator for disputes.+type Iter struct {+ *stripe.Iter+}++// Dispute returns the dispute which the iterator is currently pointing to.+func (i *Iter) Dispute() *stripe.Dispute {+ return i.Current().(*stripe.Dispute)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/ephemeralkey.go b/vendor/github.com/stripe/stripe-go/ephemeralkey.gonew file mode 100644index 000000000..355acc736--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/ephemeralkey.go@@ -0,0 +1,51 @@+package stripe++import "encoding/json"++// EphemeralKeyParams is the set of parameters that can be used when creating+// an ephemeral key.+// For more details see https://stripe.com/docs/api#ephemeral_keys.+type EphemeralKeyParams struct {+ Params `form:"*"`+ Customer *string `form:"customer"`+ IssuingCard *string `form:"issuing_card"`+ StripeVersion *string `form:"-"` // This goes in the `Stripe-Version` header+}++// EphemeralKey is the resource representing a Stripe ephemeral key.+// For more details see https://stripe.com/docs/api#ephemeral_keys.+type EphemeralKey struct {+ AssociatedObjects []struct {+ ID string `json:"id"`+ Type string `json:"type"`+ } `json:"associated_objects"`++ Created int64 `json:"created"`+ Expires int64 `json:"expires"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`++ // RawJSON is provided so that it may be passed back to the frontend+ // unchanged. Ephemeral keys are issued on behalf of another client which+ // may be running a different version of the bindings and thus expect a+ // different JSON structure. This ensures that if the structure differs+ // from the version of these bindings, we can still pass back a compatible+ // key.+ RawJSON []byte `json:"-"`+}++// UnmarshalJSON handles deserialization of an EphemeralKey.+// This custom unmarshaling is needed because we need to store the+// raw JSON on the object so it may be passed back to the frontend.+func (e *EphemeralKey) UnmarshalJSON(data []byte) error {+ type ephemeralKey EphemeralKey+ var ee ephemeralKey+ err := json.Unmarshal(data, &ee)+ if err == nil {+ *e = EphemeralKey(ee)+ }++ e.RawJSON = data++ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/ephemeralkey/client.go b/vendor/github.com/stripe/stripe-go/ephemeralkey/client.gonew file mode 100644index 000000000..c727c7c95--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/ephemeralkey/client.go@@ -0,0 +1,53 @@+// Package ephemeralkey provides the /ephemeral_keys APIs+package ephemeralkey++import (+ "fmt"+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke /ephemeral_keys APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New create a new ephemeral key.+func New(params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, error) {+ return getC().New(params)+}++// New create a new ephemeral key.+func (c Client) New(params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, error) {+ if params.StripeVersion == nil || len(stripe.StringValue(params.StripeVersion)) == 0 {+ return nil, fmt.Errorf("params.StripeVersion must be specified")+ }++ if params.Headers == nil {+ params.Headers = make(http.Header)+ }+ params.Headers.Add("Stripe-Version", stripe.StringValue(params.StripeVersion))++ ephemeralKey := &stripe.EphemeralKey{}+ err := c.B.Call(http.MethodPost, "/v1/ephemeral_keys", c.Key, params, ephemeralKey)+ return ephemeralKey, err+}++// Del removes an ephemeral key.+func Del(id string, params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, error) {+ return getC().Del(id, params)+}++// Del removes an ephemeral key.+func (c Client) Del(id string, params *stripe.EphemeralKeyParams) (*stripe.EphemeralKey, error) {+ path := stripe.FormatURLPath("/v1/ephemeral_keys/%s", id)+ ephemeralKey := &stripe.EphemeralKey{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, ephemeralKey)+ return ephemeralKey, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/error.go b/vendor/github.com/stripe/stripe-go/error.gonew file mode 100644index 000000000..2efaa70be--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/error.go@@ -0,0 +1,154 @@+package stripe++import "encoding/json"++// ErrorType is the list of allowed values for the error's type.+type ErrorType string++// List of values that ErrorType can take.+const (+ ErrorTypeAPI ErrorType = "api_error"+ ErrorTypeAPIConnection ErrorType = "api_connection_error"+ ErrorTypeAuthentication ErrorType = "authentication_error"+ ErrorTypeCard ErrorType = "card_error"+ ErrorTypeInvalidRequest ErrorType = "invalid_request_error"+ ErrorTypePermission ErrorType = "more_permissions_required"+ ErrorTypeRateLimit ErrorType = "rate_limit_error"+)++// ErrorCode is the list of allowed values for the error's code.+type ErrorCode string++// List of values that ErrorCode can take.+const (+ ErrorCodeCardDeclined ErrorCode = "card_declined"+ ErrorCodeExpiredCard ErrorCode = "expired_card"+ ErrorCodeIncorrectCVC ErrorCode = "incorrect_cvc"+ ErrorCodeIncorrectZip ErrorCode = "incorrect_zip"+ ErrorCodeIncorrectNumber ErrorCode = "incorrect_number"+ ErrorCodeInvalidCVC ErrorCode = "invalid_cvc"+ ErrorCodeInvalidExpiryMonth ErrorCode = "invalid_expiry_month"+ ErrorCodeInvalidExpiryYear ErrorCode = "invalid_expiry_year"+ ErrorCodeInvalidNumber ErrorCode = "invalid_number"+ ErrorCodeInvalidSwipeData ErrorCode = "invalid_swipe_data"+ ErrorCodeMissing ErrorCode = "missing"+ ErrorCodeProcessingError ErrorCode = "processing_error"+ ErrorCodeRateLimit ErrorCode = "rate_limit"+ ErrorCodeResourceMissing ErrorCode = "resource_missing"+)++// Error is the response returned when a call is unsuccessful.+// For more details see https://stripe.com/docs/api#errors.+type Error struct {+ ChargeID string `json:"charge,omitempty"`+ Code ErrorCode `json:"code,omitempty"`++ // Err contains an internal error with an additional level of granularity+ // that can be used in some cases to get more detailed information about+ // what went wrong. For example, Err may hold a CardError that indicates+ // exactly what went wrong during charging a card.+ Err error `json:"-"`++ HTTPStatusCode int `json:"status,omitempty"`+ Msg string `json:"message"`+ Param string `json:"param,omitempty"`+ RequestID string `json:"request_id,omitempty"`+ Type ErrorType `json:"type"`+}++// Error serializes the error object to JSON and returns it as a string.+func (e *Error) Error() string {+ ret, _ := json.Marshal(e)+ return string(ret)+}++// APIConnectionError is a failure to connect to the Stripe API.+type APIConnectionError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *APIConnectionError) Error() string {+ return e.stripeErr.Error()+}++// APIError is a catch all for any errors not covered by other types (and+// should be extremely uncommon).+type APIError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *APIError) Error() string {+ return e.stripeErr.Error()+}++// AuthenticationError is a failure to properly authenticate during a request.+type AuthenticationError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *AuthenticationError) Error() string {+ return e.stripeErr.Error()+}++// PermissionError results when you attempt to make an API request+// for which your API key doesn't have the right permissions.+type PermissionError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *PermissionError) Error() string {+ return e.stripeErr.Error()+}++// CardError are the most common type of error you should expect to handle.+// They result when the user enters a card that can't be charged for some+// reason.+type CardError struct {+ stripeErr *Error+ DeclineCode string `json:"decline_code,omitempty"`+}++// Error serializes the error object to JSON and returns it as a string.+func (e *CardError) Error() string {+ return e.stripeErr.Error()+}++// InvalidRequestError is an error that occurs when a request contains invalid+// parameters.+type InvalidRequestError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *InvalidRequestError) Error() string {+ return e.stripeErr.Error()+}++// RateLimitError occurs when the Stripe API is hit to with too many requests+// too quickly and indicates that the current request has been rate limited.+type RateLimitError struct {+ stripeErr *Error+}++// Error serializes the error object to JSON and returns it as a string.+func (e *RateLimitError) Error() string {+ return e.stripeErr.Error()+}++// rawError deserializes the outer JSON object returned in an error response+// from the API.+type rawError struct {+ E *rawErrorInternal `json:"error,omitempty"`+}++// rawErrorInternal embeds Error to deserialize all the standard error fields,+// but also adds other fields that may or may not be present depending on error+// type to help with deserialization. (e.g. Declinecode).+type rawErrorInternal struct {+ *Error+ DeclineCode *string `json:"decline_code,omitempty"`+}diff --git a/vendor/github.com/stripe/stripe-go/event.go b/vendor/github.com/stripe/stripe-go/event.gonew file mode 100644index 000000000..b8a90e174--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/event.go@@ -0,0 +1,122 @@+package stripe++import (+ "encoding/json"+ "fmt"+ "strconv"+)++// Event is the resource representing a Stripe event.+// For more details see https://stripe.com/docs/api#events.+type Event struct {+ Account string `json:"account"`+ Created int64 `json:"created"`+ Data *EventData `json:"data"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ PendingWebhooks int64 `json:"pending_webhooks"`+ Request *EventRequest `json:"request"`+ Type string `json:"type"`+}++// EventRequest contains information on a request that created an event.+type EventRequest struct {+ // ID is the request ID of the request that created an event, if the event+ // was created by a request.+ ID string `json:"id"`++ // IdempotencyKey is the idempotency key of the request that created an+ // event, if the event was created by a request and if an idempotency key+ // was specified for that request.+ IdempotencyKey string `json:"idempotency_key"`+}++// EventData is the unmarshalled object as a map.+type EventData struct {+ Object map[string]interface{}+ PreviousAttributes map[string]interface{} `json:"previous_attributes"`+ Raw json.RawMessage `json:"object"`+}++// EventParams is the set of parameters that can be used when retrieving events.+// For more details see https://stripe.com/docs/api#retrieve_events.+type EventParams struct {+ Params `form:"*"`+}++// EventList is a list of events as retrieved from a list endpoint.+type EventList struct {+ ListMeta+ Data []*Event `json:"data"`+}++// EventListParams is the set of parameters that can be used when listing events.+// For more details see https://stripe.com/docs/api#list_events.+type EventListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ DeliverySuccess *bool `form:"delivery_success"`+ Type *string `form:"type"`+ Types []*string `form:"types"`+}++// GetObjectValue returns the value from the e.Data.Object bag based on the keys hierarchy.+func (e *Event) GetObjectValue(keys ...string) string {+ return getValue(e.Data.Object, keys)+}++// GetPreviousValue returns the value from the e.Data.Prev bag based on the keys hierarchy.+func (e *Event) GetPreviousValue(keys ...string) string {+ return getValue(e.Data.PreviousAttributes, keys)+}++// UnmarshalJSON handles deserialization of the EventData.+// This custom unmarshaling exists so that we can keep both the map and raw data.+func (e *EventData) UnmarshalJSON(data []byte) error {+ type eventdata EventData+ var ee eventdata+ err := json.Unmarshal(data, &ee)+ if err != nil {+ return err+ }++ *e = EventData(ee)+ return json.Unmarshal(e.Raw, &e.Object)+}++// getValue returns the value from the m map based on the keys.+func getValue(m map[string]interface{}, keys []string) string {+ node := m[keys[0]]++ for i := 1; i < len(keys); i++ {+ key := keys[i]++ sliceNode, ok := node.([]interface{})+ if ok {+ intKey, err := strconv.Atoi(key)+ if err != nil {+ panic(fmt.Sprintf(+ "Cannot access nested slice element with non-integer key: %s",+ key))+ }+ node = sliceNode[intKey]+ continue+ }++ mapNode, ok := node.(map[string]interface{})+ if ok {+ node = mapNode[key]+ continue+ }++ panic(fmt.Sprintf(+ "Cannot descend into non-map non-slice object with key: %s", key))+ }++ if node == nil {+ return ""+ }++ return fmt.Sprintf("%v", node)+}diff --git a/vendor/github.com/stripe/stripe-go/event/client.go b/vendor/github.com/stripe/stripe-go/event/client.gonew file mode 100644index 000000000..69209bcde--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/event/client.go@@ -0,0 +1,62 @@+// Package event provides the /events APIs+package event++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /events APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of an event.+func Get(id string, params *stripe.EventParams) (*stripe.Event, error) {+ return getC().Get(id, params)+}++// Get returns the details of an event.+func (c Client) Get(id string, params *stripe.EventParams) (*stripe.Event, error) {+ path := stripe.FormatURLPath("/v1/events/%s", id)+ event := &stripe.Event{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, event)+ return event, err+}++// List returns a list of events.+func List(params *stripe.EventListParams) *Iter {+ return getC().List(params)+}++// List returns a list of events.+func (c Client) List(listParams *stripe.EventListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.EventList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/events", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for events.+type Iter struct {+ *stripe.Iter+}++// Event returns the event which the iterator is currently pointing to.+func (i *Iter) Event() *stripe.Event {+ return i.Current().(*stripe.Event)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/exchangerate.go b/vendor/github.com/stripe/stripe-go/exchangerate.gonew file mode 100644index 000000000..f21f66ce5--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/exchangerate.go@@ -0,0 +1,25 @@+package stripe++// ExchangeRate is the resource representing the currency exchange rates at+// a given time.+type ExchangeRate struct {+ ID string `json:"id"`+ Rates map[Currency]float64 `json:"rates"`+}++// ExchangeRateParams is the set of parameters that can be used when retrieving+// exchange rates.+type ExchangeRateParams struct {+ Params `form:"*"`+}++// ExchangeRateList is a list of exchange rates as retrieved from a list endpoint.+type ExchangeRateList struct {+ ListMeta+ Data []*ExchangeRate `json:"data"`+}++// ExchangeRateListParams are the parameters allowed during ExchangeRate listing.+type ExchangeRateListParams struct {+ ListParams `form:"*"`+}diff --git a/vendor/github.com/stripe/stripe-go/exchangerate/client.go b/vendor/github.com/stripe/stripe-go/exchangerate/client.gonew file mode 100644index 000000000..8930c1250--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/exchangerate/client.go@@ -0,0 +1,63 @@+// Package exchangerate provides the /exchange_rates APIs+package exchangerate++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /exchange_rates and exchangerates-related APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the exchante rate for a given currency.+func Get(currency string, params *stripe.ExchangeRateParams) (*stripe.ExchangeRate, error) {+ return getC().Get(currency, params)+}++// Get returns the exchante rate for a given currency.+func (c Client) Get(currency string, params *stripe.ExchangeRateParams) (*stripe.ExchangeRate, error) {+ path := stripe.FormatURLPath("/v1/exchange_rates/%s", currency)+ exchangeRate := &stripe.ExchangeRate{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, exchangeRate)++ return exchangeRate, err+}++// List lists available exchange rates.+func List(params *stripe.ExchangeRateListParams) *Iter {+ return getC().List(params)+}++// List lists available exchange rates.+func (c Client) List(listParams *stripe.ExchangeRateListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ExchangeRateList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/exchange_rates", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for exchange rates.+type Iter struct {+ *stripe.Iter+}++// ExchangeRate returns the exchange rate which the iterator is currently pointing to.+func (i *Iter) ExchangeRate() *stripe.ExchangeRate {+ return i.Current().(*stripe.ExchangeRate)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/fee.go b/vendor/github.com/stripe/stripe-go/fee.gonew file mode 100644index 000000000..bc986f770--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/fee.go@@ -0,0 +1,61 @@+package stripe++import "encoding/json"++// ApplicationFeeParams is the set of parameters that can be used when refunding an application fee.+// For more details see https://stripe.com/docs/api#refund_application_fee.+type ApplicationFeeParams struct {+ Params `form:"*"`+}++// ApplicationFeeListParams is the set of parameters that can be used when listing application fees.+// For more details see https://stripe.com/docs/api#list_application_fees.+type ApplicationFeeListParams struct {+ ListParams `form:"*"`+ Charge *string `form:"charge"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// ApplicationFee is the resource representing a Stripe application fee.+// For more details see https://stripe.com/docs/api#application_fees.+type ApplicationFee struct {+ Account *Account `json:"account"`+ Amount int64 `json:"amount"`+ AmountRefunded int64 `json:"amount_refunded"`+ Application string `json:"application"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ OriginatingTransaction *Charge `json:"originating_transaction"`+ Refunded bool `json:"refunded"`+ Refunds *FeeRefundList `json:"refunds"`+}++//ApplicationFeeList is a list of application fees as retrieved from a list endpoint.+type ApplicationFeeList struct {+ ListMeta+ Data []*ApplicationFee `json:"data"`+}++// UnmarshalJSON handles deserialization of an ApplicationFee.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (f *ApplicationFee) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ f.ID = id+ return nil+ }++ type applicationFee ApplicationFee+ var v applicationFee+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *f = ApplicationFee(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/fee/client.go b/vendor/github.com/stripe/stripe-go/fee/client.gonew file mode 100644index 000000000..0d47d5d18--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/fee/client.go@@ -0,0 +1,62 @@+// Package fee provides the /application_fees APIs+package fee++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke application_fees APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of an application fee.+func Get(id string, params *stripe.ApplicationFeeParams) (*stripe.ApplicationFee, error) {+ return getC().Get(id, params)+}++// Get returns the details of an application fee.+func (c Client) Get(id string, params *stripe.ApplicationFeeParams) (*stripe.ApplicationFee, error) {+ path := stripe.FormatURLPath("/v1/application_fees/%s", id)+ fee := &stripe.ApplicationFee{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, fee)+ return fee, err+}++// List returns a list of application fees.+func List(params *stripe.ApplicationFeeListParams) *Iter {+ return getC().List(params)+}++// List returns a list of application fees.+func (c Client) List(listParams *stripe.ApplicationFeeListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ApplicationFeeList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/application_fees", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for application fees.+type Iter struct {+ *stripe.Iter+}++// ApplicationFee returns the application fee which the iterator is currently pointing to.+func (i *Iter) ApplicationFee() *stripe.ApplicationFee {+ return i.Current().(*stripe.ApplicationFee)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/feerefund.go b/vendor/github.com/stripe/stripe-go/feerefund.gonew file mode 100644index 000000000..9d1ffa546--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/feerefund.go@@ -0,0 +1,57 @@+package stripe++import (+ "encoding/json"+)++// FeeRefundParams is the set of parameters that can be used when refunding an application fee.+// For more details see https://stripe.com/docs/api#fee_refund.+type FeeRefundParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ ApplicationFee *string `form:"-"` // Included in the URL+}++// FeeRefundListParams is the set of parameters that can be used when listing application fee refunds.+// For more details see https://stripe.com/docs/api#list_fee_refunds.+type FeeRefundListParams struct {+ ListParams `form:"*"`+ ApplicationFee *string `form:"-"` // Included in the URL+}++// FeeRefund is the resource representing a Stripe application fee refund.+// For more details see https://stripe.com/docs/api#fee_refunds.+type FeeRefund struct {+ Amount int64 `json:"amount"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Fee *ApplicationFee `json:"fee"`+ ID string `json:"id"`+ Metadata map[string]string `json:"metadata"`+}++// FeeRefundList is a list object for application fee refunds.+type FeeRefundList struct {+ ListMeta+ Data []*FeeRefund `json:"data"`+}++// UnmarshalJSON handles deserialization of a FeeRefund.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *FeeRefund) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type feeRefund FeeRefund+ var v feeRefund+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = FeeRefund(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/feerefund/client.go b/vendor/github.com/stripe/stripe-go/feerefund/client.gonew file mode 100644index 000000000..f9a422768--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/feerefund/client.go@@ -0,0 +1,117 @@+// Package feerefund provides the /application_fees/refunds APIs+package feerefund++import (+ "fmt"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /application_fees/refunds APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates an application fee refund.+func New(params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ return getC().New(params)+}++// New creates an application fee refund.+func (c Client) New(params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ if params == nil {+ return nil, fmt.Errorf("params cannot be nil")+ }+ if params.ApplicationFee == nil {+ return nil, fmt.Errorf("params.ApplicationFee must be set")+ }++ path := stripe.FormatURLPath("/v1/application_fees/%s/refunds",+ stripe.StringValue(params.ApplicationFee))+ refund := &stripe.FeeRefund{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, refund)+ return refund, err+}++// Get returns the details of an application fee refund.+func Get(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ return getC().Get(id, params)+}++// Get returns the details of an application fee refund.+func (c Client) Get(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ if params == nil {+ return nil, fmt.Errorf("params cannot be nil")+ }+ if params.ApplicationFee == nil {+ return nil, fmt.Errorf("params.ApplicationFee must be set")+ }++ path := stripe.FormatURLPath("/v1/application_fees/%s/refunds/%s",+ stripe.StringValue(params.ApplicationFee), id)+ refund := &stripe.FeeRefund{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, refund)+ return refund, err+}++// Update updates an application fee refund.+func Update(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ return getC().Update(id, params)+}++// Update updates an application fee refund.+func (c Client) Update(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {+ if params == nil {+ return nil, fmt.Errorf("params cannot be nil")+ }+ if params.ApplicationFee == nil {+ return nil, fmt.Errorf("params.ApplicationFee must be set")+ }++ path := stripe.FormatURLPath("/v1/application_fees/%s/refunds/%s",+ stripe.StringValue(params.ApplicationFee), id)+ refund := &stripe.FeeRefund{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, refund)++ return refund, err+}++// List returns a list of application fee refunds.+func List(params *stripe.FeeRefundListParams) *Iter {+ return getC().List(params)+}++// List returns a list of application fee refunds.+func (c Client) List(listParams *stripe.FeeRefundListParams) *Iter {+ path := stripe.FormatURLPath("/v1/application_fees/%s/refunds",+ stripe.StringValue(listParams.ApplicationFee))++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.FeeRefundList{}+ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for application fee refunds.+type Iter struct {+ *stripe.Iter+}++// FeeRefund returns the application fee refund which the iterator is currently pointing to.+func (i *Iter) FeeRefund() *stripe.FeeRefund {+ return i.Current().(*stripe.FeeRefund)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/file.go b/vendor/github.com/stripe/stripe-go/file.gonew file mode 100644index 000000000..253a0baa5--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/file.go@@ -0,0 +1,119 @@+package stripe++import (+ "bytes"+ "encoding/json"+ "io"+ "mime/multipart"+ "path/filepath"+)++// FilePurpose is the purpose of a particular file.+type FilePurpose string++// List of values that FilePurpose can take.+const (+ FilePurposeBusinessLogo FilePurpose = "business_logo"+ FilePurposeCustomerSignature FilePurpose = "customer_signature"+ FilePurposeDisputeEvidence FilePurpose = "dispute_evidence"+ FilePurposeFinanceReportRun FilePurpose = "finance_report_run"+ FilePurposeFoundersStockDocument FilePurpose = "founders_stock_document"+ FilePurposeIdentityDocument FilePurpose = "identity_document"+ FilePurposePCIDocument FilePurpose = "pci_document"+ FilePurposeSigmaScheduledQuery FilePurpose = "sigma_scheduled_query"+ FilePurposeTaxDocumentUserUpload FilePurpose = "tax_document_user_upload"+)++// FileParams is the set of parameters that can be used when creating a file.+// For more details see https://stripe.com/docs/api#create_file.+type FileParams struct {+ Params `form:"*"`++ // FileReader is a reader with the contents of the file that should be uploaded.+ FileReader io.Reader++ // Filename is just the name of the file without path information.+ Filename *string++ Purpose *string+}++// FileListParams is the set of parameters that can be used when listing+// files. For more details see https://stripe.com/docs/api#list_files.+type FileListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Purpose *string `form:"purpose"`+}++// File is the resource representing a Stripe file.+// For more details see https://stripe.com/docs/api#file_object.+type File struct {+ Created int64 `json:"created"`+ ID string `json:"id"`+ Filename string `json:"filename"`+ Links *FileLinkList `json:"links"`+ Purpose FilePurpose `json:"purpose"`+ Size int64 `json:"size"`+ Type string `json:"type"`+ URL string `json:"url"`+}++// FileList is a list of files as retrieved from a list endpoint.+type FileList struct {+ ListMeta+ Data []*File `json:"data"`+}++// GetBody gets an appropriate multipart form payload to use in a request body+// to create a new file.+func (f *FileParams) GetBody() (*bytes.Buffer, string, error) {+ body := &bytes.Buffer{}+ writer := multipart.NewWriter(body)++ if f.Purpose != nil {+ err := writer.WriteField("purpose", StringValue(f.Purpose))+ if err != nil {+ return nil, "", err+ }+ }++ if f.FileReader != nil && f.Filename != nil {+ part, err := writer.CreateFormFile("file", filepath.Base(StringValue(f.Filename)))+ if err != nil {+ return nil, "", err+ }++ _, err = io.Copy(part, f.FileReader)+ if err != nil {+ return nil, "", err+ }+ }++ err := writer.Close()+ if err != nil {+ return nil, "", err+ }++ return body, writer.Boundary(), nil+}++// UnmarshalJSON handles deserialization of a File.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (f *File) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ f.ID = id+ return nil+ }++ type file File+ var v file+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *f = File(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/file/client.go b/vendor/github.com/stripe/stripe-go/file/client.gonew file mode 100644index 000000000..11f23d741--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/file/client.go@@ -0,0 +1,86 @@+// Package file provides the file related APIs+package file++import (+ "fmt"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke file APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new file.+func New(params *stripe.FileParams) (*stripe.File, error) {+ return getC().New(params)+}++// New creates a new file.+func (c Client) New(params *stripe.FileParams) (*stripe.File, error) {+ if params == nil {+ return nil, fmt.Errorf("params cannot be nil, and params.Purpose and params.File must be set")+ }++ bodyBuffer, boundary, err := params.GetBody()+ if err != nil {+ return nil, err+ }++ file := &stripe.File{}+ err = c.B.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, ¶ms.Params, file)++ return file, err+}++// Get returns the details of a file.+func Get(id string, params *stripe.FileParams) (*stripe.File, error) {+ return getC().Get(id, params)++}++// Get returns the details of a file.+func (c Client) Get(id string, params *stripe.FileParams) (*stripe.File, error) {+ path := stripe.FormatURLPath("/v1/files/%s", id)+ file := &stripe.File{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, file)+ return file, err+}++// List returns a list of files.+func List(params *stripe.FileListParams) *Iter {+ return getC().List(params)+}++// List returns a list of files.+func (c Client) List(listParams *stripe.FileListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.FileList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/files", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for files.+type Iter struct {+ *stripe.Iter+}++// File returns the file which the iterator is currently pointing to.+func (i *Iter) File() *stripe.File {+ return i.Current().(*stripe.File)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.UploadsBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/file/test_data.pdf b/vendor/github.com/stripe/stripe-go/file/test_data.pdfnew file mode 100644index 000000000..9715218fa--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/file/test_data.pdf@@ -0,0 +1,58 @@+%PDF-1.1+%¥±ë++1 0 obj+ << /Type /Catalog+ /Pages 2 0 R+ >>+endobj++2 0 obj+ << /Type /Pages+ /Kids [3 0 R]+ /Count 1+ /MediaBox [0 0 300 144]+ >>+endobj++3 0 obj+ << /Type /Page+ /Parent 2 0 R+ /Resources+ << /Font+ << /F1+ << /Type /Font+ /Subtype /Type1+ /BaseFont /Times-Roman+ >>+ >>+ >>+ /Contents 4 0 R+ >>+endobj++4 0 obj+ << /Length 55 >>+stream+ BT+ /F1 18 Tf+ 0 0 Td+ (Hello World) Tj+ ET+endstream+endobj++xref+0 5+0000000000 65535 f+0000000018 00000 n+0000000077 00000 n+0000000178 00000 n+0000000457 00000 n+trailer+ << /Root 1 0 R+ /Size 5+ >>+startxref+565+%%EOFdiff --git a/vendor/github.com/stripe/stripe-go/filelink.go b/vendor/github.com/stripe/stripe-go/filelink.gonew file mode 100644index 000000000..19615ff36--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/filelink.go@@ -0,0 +1,60 @@+package stripe++import (+ "encoding/json"+)++// FileLinkParams is the set of parameters that can be used when creating or updating a file link.+type FileLinkParams struct {+ Params `form:"*"`+ ExpiresAt *int64 `form:"expires_at"`+ File *string `form:"file"`+}++// FileLinkListParams is the set of parameters that can be used when listing file links.+type FileLinkListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Expired *bool `form:"expired"`+ File *string `form:"file"`+}++// FileLink is the resource representing a Stripe file link.+// For more details see https://stripe.com/docs/api#file_links.+type FileLink struct {+ Created int64 `json:"created"`+ Expired bool `json:"expired"`+ ExpiresAt int64 `json:"expires_at"`+ File *File `json:"file"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ URL string `json:"url"`+}++// UnmarshalJSON handles deserialization of a file link.+// This custom unmarshaling is needed because the resulting+// property may be an ID or the full struct if it was expanded.+func (c *FileLink) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type fileLink FileLink+ var v fileLink+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = FileLink(v)+ return nil+}++// FileLinkList is a list of file links as retrieved from a list endpoint.+type FileLinkList struct {+ ListMeta+ Data []*FileLink `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/filelink/client.go b/vendor/github.com/stripe/stripe-go/filelink/client.gonew file mode 100644index 000000000..d130a681b--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/filelink/client.go@@ -0,0 +1,89 @@+// Package filelink provides API functions related to file links.+//+// For more details, see: https://stripe.com/docs/api/go#file_links.+package filelink++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke APIs related to file links.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new file link.+func New(params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ return getC().New(params)+}++// New creates a new file link.+func (c Client) New(params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ fileLink := &stripe.FileLink{}+ err := c.B.Call(http.MethodPost, "/v1/file_links", c.Key, params, fileLink)+ return fileLink, err+}++// Get retrieves a file link.+func Get(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ return getC().Get(id, params)+}++// Get retrieves a file link.+func (c Client) Get(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ path := stripe.FormatURLPath("/v1/file_links/%s", id)+ fileLink := &stripe.FileLink{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, fileLink)+ return fileLink, err+}++// Update updates a file link.+func Update(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ return getC().Update(id, params)+}++// Update updates a file link.+func (c Client) Update(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {+ path := stripe.FormatURLPath("/v1/file_links/%s", id)+ fileLink := &stripe.FileLink{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, fileLink)+ return fileLink, err+}++// List returns an iterator that iterates all file links.+func List(params *stripe.FileLinkListParams) *Iter {+ return getC().List(params)+}++// List returns an iterator that iterates all file links.+func (c Client) List(listParams *stripe.FileLinkListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.FileLinkList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/file_links", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for file links.+type Iter struct {+ *stripe.Iter+}++// FileLink returns the file link which the iterator is currently pointing to.+func (i *Iter) FileLink() *stripe.FileLink {+ return i.Current().(*stripe.FileLink)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/form/form.go b/vendor/github.com/stripe/stripe-go/form/form.gonew file mode 100644index 000000000..80e31124c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/form/form.go@@ -0,0 +1,541 @@+package form++import (+ "bytes"+ "fmt"+ "net/url"+ "reflect"+ "strconv"+ "strings"+ "sync"+)++const tagName = "form"++// Appender is the interface implemented by types that can append themselves to+// a collection of form values.+//+// This is usually something that shouldn't be used, but is needed in a few+// places where authors deviated from norms while implementing various+// parameters.+type Appender interface {+ // AppendTo is invoked by the form package on any types found to implement+ // Appender so that they have a chance to encode themselves. Note that+ // AppendTo is called in addition to normal encoding, so other form tags on+ // the struct are still fair game.+ AppendTo(values *Values, keyParts []string)+}++// encoderFunc is used to encode any type from a request.+//+// A note about encodeZero: Since some types in the Stripe API are defaulted to+// non-zero values, and Go defaults types to their zero values, any type that+// has a Stripe API default of a non-zero value is defined as a Go pointer,+// meaning nil defaults to the Stripe API non-zero value. To override this, a+// check is made to see if the value is the zero-value for that type. If it is+// and encodeZero is true, it's encoded. This is ignored as a parameter when+// dealing with types like structs, where the decision cannot be made+// preemptively.+type encoderFunc func(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions)++// field represents a single field found in a struct. It caches information+// about that field so that we can make encoding faster.+type field struct {+ formName string+ index int+ isAppender bool+ isPtr bool+ options *formOptions+}++type formOptions struct {+ // Empty indicates that a field's value should be emptied in that its value+ // should be an empty string. It's used to workaround the fact that an+ // empty string is a string's zero value and wouldn't normally be encoded.+ Empty bool+}++type structEncoder struct {+ fields []*field+ fieldEncs []encoderFunc+}++func (se *structEncoder) encode(values *Values, v reflect.Value, keyParts []string, _ bool, _ *formOptions) {+ for i, f := range se.fields {+ var fieldKeyParts []string+ fieldV := v.Field(f.index)++ // The wildcard on a form tag is a "special" value: it indicates a+ // struct field that we should recurse into, but for which no part+ // should be added to the key parts, meaning that its own subfields+ // will be named at the same level as with the fields of the+ // current structure.+ if f.formName == "*" {+ fieldKeyParts = keyParts+ } else {+ fieldKeyParts = append(keyParts, f.formName)+ }++ se.fieldEncs[i](values, fieldV, fieldKeyParts, f.isPtr, f.options)+ if f.isAppender && (!f.isPtr || !fieldV.IsNil()) {+ fieldV.Interface().(Appender).AppendTo(values, fieldKeyParts)+ }+ }+}++// ---++// Strict enables strict mode wherein the package will panic on an AppendTo+// function if it finds that a tag string was malformed.+var Strict = false++var encoderCache struct {+ m map[reflect.Type]encoderFunc+ mu sync.RWMutex // for coordinating concurrent operations on m+}++var structCache struct {+ m map[reflect.Type]*structEncoder+ mu sync.RWMutex // for coordinating concurrent operations on m+}++// AppendTo uses reflection to form encode into the given values collection+// based off the form tags that it defines.+func AppendTo(values *Values, i interface{}) {+ reflectValue(values, reflect.ValueOf(i), false, nil)+}++// AppendToPrefixed is the same as AppendTo, but it allows a slice of key parts+// to be specified to prefix the form values.+//+// I was hoping not to have to expose this function, but I ended up needing it+// for recipients. Recipients is going away, and when it does, we can probably+// remove it again.+func AppendToPrefixed(values *Values, i interface{}, keyParts []string) {+ reflectValue(values, reflect.ValueOf(i), false, keyParts)+}++// FormatKey takes a series of key parts that may be parameter keyParts, map keys,+// or array indices and unifies them into a single key suitable for Stripe's+// style of form encoding.+func FormatKey(parts []string) string {+ if len(parts) < 1 {+ panic("Not allowed 0-length parts slice")+ }++ key := parts[0]+ for i := 1; i < len(parts); i++ {+ key += "[" + parts[i] + "]"+ }+ return key+}++// ---++func boolEncoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.Bool()+ if !val && !encodeZero {+ return+ }++ if options != nil {+ switch {+ case options.Empty:+ values.Add(FormatKey(keyParts), "")+ }+ } else {+ values.Add(FormatKey(keyParts), strconv.FormatBool(val))+ }+}++func buildArrayOrSliceEncoder(t reflect.Type) encoderFunc {+ // Gets an encoder for the type that the array or slice will hold+ elemF := getCachedOrBuildTypeEncoder(t.Elem())++ return func(values *Values, v reflect.Value, keyParts []string, _ bool, options *formOptions) {+ var arrNames []string++ for i := 0; i < v.Len(); i++ {+ arrNames = append(keyParts, strconv.Itoa(i))++ indexV := v.Index(i)+ elemF(values, indexV, arrNames, indexV.Kind() == reflect.Ptr, nil)++ if isAppender(indexV.Type()) && !indexV.IsNil() {+ indexV.Interface().(Appender).AppendTo(values, arrNames)+ }+ }+ }+}++func buildPtrEncoder(t reflect.Type) encoderFunc {+ // Gets an encoder for the type that the pointer wraps+ elemF := getCachedOrBuildTypeEncoder(t.Elem())++ return func(values *Values, v reflect.Value, keyParts []string, _ bool, options *formOptions) {+ if v.IsNil() {+ return+ }+ elemF(values, v.Elem(), keyParts, true, options)+ }+}++func buildStructEncoder(t reflect.Type) encoderFunc {+ se := getCachedOrBuildStructEncoder(t)+ return se.encode+}++func float32Encoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.Float()+ if val == 0.0 && !encodeZero {+ return+ }+ values.Add(FormatKey(keyParts), strconv.FormatFloat(val, 'f', 4, 32))+}++func float64Encoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.Float()+ if val == 0.0 && !encodeZero {+ return+ }+ values.Add(FormatKey(keyParts), strconv.FormatFloat(val, 'f', 4, 64))+}++func getCachedOrBuildStructEncoder(t reflect.Type) *structEncoder {+ // Just acquire a read lock when extracting a value (note that in Go, a map+ // cannot be read while it's also being written).+ structCache.mu.RLock()+ f := structCache.m[t]+ structCache.mu.RUnlock()++ if f != nil {+ return f+ }++ // We do the work to get the encoder without holding a lock. This could+ // result in duplicate work, but it will help us avoid a deadlock. Encoders+ // may be built and stored recursively in the cases of something like an+ // array or slice, so we need to make sure that this function is properly+ // re-entrant.+ f = makeStructEncoder(t)++ structCache.mu.Lock()+ defer structCache.mu.Unlock()++ if structCache.m == nil {+ structCache.m = make(map[reflect.Type]*structEncoder)+ }+ structCache.m[t] = f++ return f+}++// getCachedOrBuildTypeEncoder tries to get an encoderFunc for the type from+// the cache, and falls back to building one if there wasn't a cached one+// available. If an encoder is built, it's stored back to the cache.+func getCachedOrBuildTypeEncoder(t reflect.Type) encoderFunc {+ // Just acquire a read lock when extracting a value (note that in Go, a map+ // cannot be read while it's also being written).+ encoderCache.mu.RLock()+ f := encoderCache.m[t]+ encoderCache.mu.RUnlock()++ if f != nil {+ return f+ }++ // We do the work to get the encoder without holding a lock. This could+ // result in duplicate work, but it will help us avoid a deadlock. Encoders+ // may be built and stored recursively in the cases of something like an+ // array or slice, so we need to make sure that this function is properly+ // re-entrant.+ f = makeTypeEncoder(t)++ encoderCache.mu.Lock()+ defer encoderCache.mu.Unlock()++ if encoderCache.m == nil {+ encoderCache.m = make(map[reflect.Type]encoderFunc)+ }+ encoderCache.m[t] = f++ return f+}++func intEncoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.Int()+ if val == 0 && !encodeZero {+ return+ }+ values.Add(FormatKey(keyParts), strconv.FormatInt(val, 10))+}++func interfaceEncoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, _ *formOptions) {+ // interfaceEncoder never encodes a `nil`, but it will pass through an+ // `encodeZero` value into its chained encoder+ if v.IsNil() {+ return+ }+ reflectValue(values, v.Elem(), encodeZero, keyParts)+}++func isAppender(t reflect.Type) bool {+ return t.Implements(reflect.TypeOf((*Appender)(nil)).Elem())+}++func mapEncoder(values *Values, v reflect.Value, keyParts []string, _ bool, _ *formOptions) {+ for _, keyVal := range v.MapKeys() {+ if Strict && keyVal.Kind() != reflect.String {+ panic("Don't support serializing maps with non-string keys")+ }++ // Unlike a property on a struct which will contain a zero value even+ // if never set, any value found in a map has been explicitly set, so+ // we always make an effort to encode them, even if a zero value+ // (that's why we pass through `true` here).+ reflectValue(values, v.MapIndex(keyVal), true, append(keyParts, keyVal.String()))+ }+}++func stringEncoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.String()+ if val == "" && !encodeZero {+ return+ }+ values.Add(FormatKey(keyParts), val)+}++func uintEncoder(values *Values, v reflect.Value, keyParts []string, encodeZero bool, options *formOptions) {+ val := v.Uint()+ if val == 0 && !encodeZero {+ return+ }+ values.Add(FormatKey(keyParts), strconv.FormatUint(val, 10))+}++// reflectValue is roughly the shared entry point of any AppendTo functions.+// It's also called recursively in cases where a precise type isn't yet known+// and its encoding needs to be deferred down the chain; for example, when+// encoding interface{} or the values in an array or map containing+// interface{}.+func reflectValue(values *Values, v reflect.Value, encodeZero bool, keyParts []string) {+ t := v.Type()++ f := getCachedOrBuildTypeEncoder(t)+ if f != nil {+ f(values, v, keyParts, encodeZero || v.Kind() == reflect.Ptr, nil)+ }++ if isAppender(t) {+ v.Interface().(Appender).AppendTo(values, keyParts)+ }+}++func makeStructEncoder(t reflect.Type) *structEncoder {+ // Don't specify capacity because we don't know how many fields are tagged with+ // `form`+ se := &structEncoder{}++ for i := 0; i < t.NumField(); i++ {+ reflectField := t.Field(i)+ tag := reflectField.Tag.Get(tagName)+ if Strict && tag == "" {+ panic(fmt.Sprintf(+ "All fields in structs to be form-encoded must have `form` tag; on: %s/%s "++ "(hint: use an explicit `form:\"-\"` if the field should not be encoded",+ t.Name(), reflectField.Name,+ ))+ }++ formName, options := parseTag(tag)++ // Like with encoding/json, a hyphen is an explicit way of saying+ // that this field should not be encoded+ if formName == "-" {+ continue+ }++ fldTyp := reflectField.Type+ fldKind := fldTyp.Kind()++ if Strict && options != nil && options.Empty && fldKind != reflect.Bool {+ panic(fmt.Sprintf(+ "Cannot specify `empty` for non-boolean field; on: %s/%s",+ t.Name(), reflectField.Name,+ ))+ }++ se.fields = append(se.fields, &field{+ formName: formName,+ index: i,+ isAppender: isAppender(fldTyp),+ isPtr: fldKind == reflect.Ptr,+ options: options,+ })+ se.fieldEncs = append(se.fieldEncs,+ getCachedOrBuildTypeEncoder(fldTyp))+ }++ return se+}++func makeTypeEncoder(t reflect.Type) encoderFunc {+ switch t.Kind() {+ case reflect.Array, reflect.Slice:+ return buildArrayOrSliceEncoder(t)++ case reflect.Bool:+ return boolEncoder++ case reflect.Float32:+ return float32Encoder++ case reflect.Float64:+ return float64Encoder++ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:+ return intEncoder++ case reflect.Interface:+ return interfaceEncoder++ case reflect.Map:+ return mapEncoder++ case reflect.Ptr:+ return buildPtrEncoder(t)++ case reflect.String:+ return stringEncoder++ case reflect.Struct:+ return buildStructEncoder(t)++ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:+ return uintEncoder+ }++ return nil+}++func parseTag(tag string) (string, *formOptions) {+ var options *formOptions+ parts := strings.Split(tag, ",")+ name := parts[0]++ for i := 1; i < len(parts); i++ {+ switch parts[i] {+ case "empty":+ if options == nil {+ options = &formOptions{}+ }+ options.Empty = true++ default:+ if Strict {+ part := parts[i]+ if part == "" {+ part = "(empty)"+ }+ panic(fmt.Sprintf("Don't know how to handle form tag part: %s (tag: %s)",+ part, tag))+ }+ }+ }++ return name, options+}++// ---++// Values is a collection of values that can be submitted along with a+// request that specifically allows for duplicate keys and encodes its entries+// in the same order that they were added.+type Values struct {+ values []formValue+}++// Add adds a key/value tuple to the form.+func (f *Values) Add(key, val string) {+ f.values = append(f.values, formValue{key, val})+}++// Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux").+func (f *Values) Encode() string {+ var buf bytes.Buffer+ for _, v := range f.values {+ if buf.Len() > 0 {+ buf.WriteByte('&')+ }+ buf.WriteString(url.QueryEscape(v.Key))+ buf.WriteString("=")+ buf.WriteString(url.QueryEscape(v.Value))+ }+ return buf.String()+}++// Empty returns true if no parameters have been set.+func (f *Values) Empty() bool {+ return len(f.values) == 0+}++// Set sets the first instance of a parameter for the given key to the given+// value. If no parameters exist with the key, a new one is added.+//+// Note that Set is O(n) and may be quite slow for a very large parameter list.+func (f *Values) Set(key, val string) {+ for i, v := range f.values {+ if v.Key == key {+ f.values[i].Value = val+ return+ }+ }++ f.Add(key, val)+}++// Get retrieves the list of values for the given key. If no values exist+// for the key, nil will be returned.+//+// Note that Get is O(n) and may be quite slow for a very large parameter list.+func (f *Values) Get(key string) []string {+ var results []string+ for i, v := range f.values {+ if v.Key == key {+ results = append(results, f.values[i].Value)+ }+ }+ return results+}++// ToValues converts an instance of Values into an instance of+// url.Values. This can be useful in cases where it's useful to make an+// unordered comparison of two sets of request values.+//+// Note that url.Values is incapable of representing certain Rack form types in+// a cohesive way. For example, an array of maps in Rack is encoded with a+// string like:+//+// arr[][foo]=foo0&arr[][bar]=bar0&arr[][foo]=foo1&arr[][bar]=bar1+//+// Because url.Values is a map, values will be handled in a way that's grouped+// by their key instead of in the order they were added. Therefore the above+// may by encoded to something like (maps are unordered so the actual result is+// somewhat non-deterministic):+//+// arr[][foo]=foo0&arr[][foo]=foo1&arr[][bar]=bar0&arr[][bar]=bar1+//+// And thus result in an incorrect request to Stripe.+func (f *Values) ToValues() url.Values {+ values := url.Values{}+ for _, v := range f.values {+ values.Add(v.Key, v.Value)+ }+ return values+}++// A key/value tuple for use in the Values type.+type formValue struct {+ Key string+ Value string+}diff --git a/vendor/github.com/stripe/stripe-go/go.mod b/vendor/github.com/stripe/stripe-go/go.modnew file mode 100644index 000000000..b09a5540a--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/go.mod@@ -0,0 +1 @@+module github.com/stripe/stripe-godiff --git a/vendor/github.com/stripe/stripe-go/invoice.go b/vendor/github.com/stripe/stripe-go/invoice.gonew file mode 100644index 000000000..1a6e49e91--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/invoice.go@@ -0,0 +1,249 @@+package stripe++import "encoding/json"++// InvoiceLineType is the list of allowed values for the invoice line's type.+type InvoiceLineType string++// List of values that InvoiceLineType can take.+const (+ InvoiceLineTypeInvoiceItem InvoiceLineType = "invoiceitem"+ InvoiceLineTypeSubscription InvoiceLineType = "subscription"+)++// InvoiceBilling is the type of billing method for this invoice.+type InvoiceBilling string++// List of values that InvoiceBilling can take.+const (+ InvoiceBillingChargeAutomatically InvoiceBilling = "charge_automatically"+ InvoiceBillingSendInvoice InvoiceBilling = "send_invoice"+)++// InvoiceBillingReason is the reason why a given invoice was created+type InvoiceBillingReason string++// List of values that InvoiceBillingReason can take.+const (+ InvoiceBillingReasonManual InvoiceBillingReason = "manual"+ InvoiceBillingReasonSubscription InvoiceBillingReason = "subscription"+ InvoiceBillingReasonSubscriptionCreate InvoiceBillingReason = "subscription_create"+ InvoiceBillingReasonSubscriptionCycle InvoiceBillingReason = "subscription_cycle"+ InvoiceBillingReasonSubscriptionUpdate InvoiceBillingReason = "subscription_update"+ InvoiceBillingReasonUpcoming InvoiceBillingReason = "upcoming"+)++// InvoiceBillingStatus is the reason why a given invoice was created+type InvoiceBillingStatus string++// List of values that InvoiceBillingStatus can take.+const (+ InvoiceBillingStatusDraft InvoiceBillingStatus = "draft"+ InvoiceBillingStatusOpen InvoiceBillingStatus = "open"+ InvoiceBillingStatusPaid InvoiceBillingStatus = "paid"+ InvoiceBillingStatusUncollectible InvoiceBillingStatus = "uncollectible"+ InvoiceBillingStatusVoid InvoiceBillingStatus = "void"+)++// InvoiceUpcomingInvoiceItemParams is the set of parameters that can be used when adding or modifying+// invoice items on an upcoming invoice.+// For more details see https://stripe.com/docs/api#upcoming_invoice-invoice_items.+type InvoiceUpcomingInvoiceItemParams struct {+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Description *string `form:"description"`+ Discountable *bool `form:"discountable"`+ InvoiceItem *string `form:"invoiceitem"`+}++// InvoiceParams is the set of parameters that can be used when creating or updating an invoice.+// For more details see https://stripe.com/docs/api#create_invoice, https://stripe.com/docs/api#update_invoice.+type InvoiceParams struct {+ Params `form:"*"`+ AutoAdvance *bool `form:"auto_advance"`+ ApplicationFee *int64 `form:"application_fee"`+ Billing *string `form:"billing"`+ Customer *string `form:"customer"`+ DaysUntilDue *int64 `form:"days_until_due"`+ DefaultSource *string `form:"default_source"`+ Description *string `form:"description"`+ DueDate *int64 `form:"due_date"`+ Paid *bool `form:"paid"`+ StatementDescriptor *string `form:"statement_descriptor"`+ Subscription *string `form:"subscription"`+ TaxPercent *float64 `form:"tax_percent"`++ // These are all for exclusive use by GetNext.++ Coupon *string `form:"coupon"`+ InvoiceItems *InvoiceUpcomingInvoiceItemParams `form:"invoice_items"`+ SubscriptionBillingCycleAnchor *int64 `form:"subscription_billing_cycle_anchor"`+ SubscriptionCancelAtPeriodEnd *bool `form:"subscription_cancel_at_period_end"`+ SubscriptionItems []*SubscriptionItemsParams `form:"subscription_items"`+ SubscriptionPlan *string `form:"subscription_plan"`+ SubscriptionProrate *bool `form:"subscription_prorate"`+ SubscriptionProrationDate *int64 `form:"subscription_proration_date"`+ SubscriptionQuantity *int64 `form:"subscription_quantity"`+ SubscriptionTaxPercent *float64 `form:"subscription_tax_percent"`+ SubscriptionTrialEnd *int64 `form:"subscription_trial_end"`+ SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"`+}++// InvoiceListParams is the set of parameters that can be used when listing invoices.+// For more details see https://stripe.com/docs/api#list_customer_invoices.+type InvoiceListParams struct {+ ListParams `form:"*"`+ Billing *string `form:"billing"`+ Customer *string `form:"customer"`+ Date *int64 `form:"date"`+ DateRange *RangeQueryParams `form:"date"`+ DueDate *int64 `form:"due_date"`+ Subscription *string `form:"subscription"`+}++// InvoiceLineListParams is the set of parameters that can be used when listing invoice line items.+// For more details see https://stripe.com/docs/api#invoice_lines.+type InvoiceLineListParams struct {+ ListParams `form:"*"`++ Customer *string `form:"customer"`++ // ID is the invoice ID to list invoice lines for.+ ID *string `form:"-"` // Goes in the URL++ Subscription *string `form:"subscription"`+}++// InvoiceFinalizeParams is the set of parameters that can be used when finalizing invoices.+type InvoiceFinalizeParams struct {+ Params `form:"*"`+ AutoAdvance *bool `form:"auto_advance"`+}++// InvoiceMarkUncollectibleParams is the set of parameters that can be used when marking+// invoices as uncollectible.+type InvoiceMarkUncollectibleParams struct {+ Params `form:"*"`+}++// InvoicePayParams is the set of parameters that can be used when+// paying invoices. For more details, see:+// https://stripe.com/docs/api#pay_invoice.+type InvoicePayParams struct {+ Params `form:"*"`+ Forgive *bool `form:"forgive"`+ PaidOutOfBand *bool `form:"paid_out_of_band"`+ Source *string `form:"source"`+}++// InvoiceSendParams is the set of parameters that can be used when sending invoices.+type InvoiceSendParams struct {+ Params `form:"*"`+}++// InvoiceVoidParams is the set of parameters that can be used when voiding invoices.+type InvoiceVoidParams struct {+ Params `form:"*"`+}++// Invoice is the resource representing a Stripe invoice.+// For more details see https://stripe.com/docs/api#invoice_object.+type Invoice struct {+ AmountDue int64 `json:"amount_due"`+ AmountPaid int64 `json:"amount_paid"`+ AmountRemaining int64 `json:"amount_remaining"`+ ApplicationFee int64 `json:"application_fee"`+ AttemptCount int64 `json:"attempt_count"`+ Attempted bool `json:"attempted"`+ AutoAdvance bool `json:"auto_advance"`+ Billing InvoiceBilling `json:"billing"`+ BillingReason InvoiceBillingReason `json:"billing_reason"`+ Charge *Charge `json:"charge"`+ Currency Currency `json:"currency"`+ Customer *Customer `json:"customer"`+ Date int64 `json:"date"`+ DefaultSource *PaymentSource `json:"default_source"`+ Description string `json:"description"`+ Discount *Discount `json:"discount"`+ DueDate int64 `json:"due_date"`+ EndingBalance int64 `json:"ending_balance"`+ FinalizedAt int64 `json:"finalized_at"`+ HostedInvoiceURL string `json:"hosted_invoice_url"`+ ID string `json:"id"`+ InvoicePDF string `json:"invoice_pdf"`+ Lines *InvoiceLineList `json:"lines"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ NextPaymentAttempt int64 `json:"next_payment_attempt"`+ Number string `json:"number"`+ Paid bool `json:"paid"`+ PeriodEnd int64 `json:"period_end"`+ PeriodStart int64 `json:"period_start"`+ ReceiptNumber string `json:"receipt_number"`+ StartingBalance int64 `json:"starting_balance"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status InvoiceBillingStatus `json:"status"`+ Subscription string `json:"subscription"`+ SubscriptionProrationDate int64 `json:"subscription_proration_date"`+ Subtotal int64 `json:"subtotal"`+ Tax int64 `json:"tax"`+ TaxPercent float64 `json:"tax_percent"`+ Total int64 `json:"total"`+ WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"`+}++// InvoiceList is a list of invoices as retrieved from a list endpoint.+type InvoiceList struct {+ ListMeta+ Data []*Invoice `json:"data"`+}++// InvoiceLine is the resource representing a Stripe invoice line item.+// For more details see https://stripe.com/docs/api#invoice_line_item_object.+type InvoiceLine struct {+ Amount int64 `json:"amount"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ Discountable bool `json:"discountable"`+ ID string `json:"id"`+ Livemode bool `json:"live_mode"`+ Metadata map[string]string `json:"metadata"`+ Period *Period `json:"period"`+ Plan *Plan `json:"plan"`+ Proration bool `json:"proration"`+ Quantity int64 `json:"quantity"`+ Subscription string `json:"subscription"`+ SubscriptionItem string `json:"subscription_item"`+ Type InvoiceLineType `json:"type"`+}++// Period is a structure representing a start and end dates.+type Period struct {+ End int64 `json:"end"`+ Start int64 `json:"start"`+}++// InvoiceLineList is a list object for invoice line items.+type InvoiceLineList struct {+ ListMeta+ Data []*InvoiceLine `json:"data"`+}++// UnmarshalJSON handles deserialization of an Invoice.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *Invoice) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type invoice Invoice+ var v invoice+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = Invoice(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/invoice/client.go b/vendor/github.com/stripe/stripe-go/invoice/client.gonew file mode 100644index 000000000..a8d30e322--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/invoice/client.go@@ -0,0 +1,208 @@+// Package invoice provides the /invoices APIs+package invoice++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is the client used to invoke /invoices APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new invoice.+func New(params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ return getC().New(params)+}++// New creates a new invoice.+func (c Client) New(params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, "/v1/invoices", c.Key, params, invoice)+ return invoice, err+}++// Del deletes an invoice.+func Del(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ return getC().Del(id, params)+}++// Del deletes an invoice.+func (c Client) Del(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, invoice)+ return invoice, err+}++// Get returns the details of an invoice.+func Get(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ return getC().Get(id, params)+}++// Get returns the details of an invoice.+func (c Client) Get(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, invoice)+ return invoice, err+}++// Pay pays an invoice.+func Pay(id string, params *stripe.InvoicePayParams) (*stripe.Invoice, error) {+ return getC().Pay(id, params)+}++// Pay pays an invoice.+func (c Client) Pay(id string, params *stripe.InvoicePayParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s/pay", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// Update updates an invoice.+func Update(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ return getC().Update(id, params)+}++// Update updates an invoice.+func (c Client) Update(id string, params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// GetNext returns an upcoming invoice.+func GetNext(params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ return getC().GetNext(params)+}++// GetNext returns an upcoming invoice.+func (c Client) GetNext(params *stripe.InvoiceParams) (*stripe.Invoice, error) {+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodGet, "/v1/invoices/upcoming", c.Key, params, invoice)+ return invoice, err+}++// List returns a list of invoices.+func List(params *stripe.InvoiceListParams) *Iter {+ return getC().List(params)+}++// List returns a list of invoices.+func (c Client) List(listParams *stripe.InvoiceListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.InvoiceList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/invoices", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// ListLines returns a list of line items on an invoice.+func ListLines(params *stripe.InvoiceLineListParams) *LineIter {+ return getC().ListLines(params)+}++// ListLines returns a list of line items on an invoice.+func (c Client) ListLines(listParams *stripe.InvoiceLineListParams) *LineIter {+ path := stripe.FormatURLPath("/v1/invoices/%s/lines", stripe.StringValue(listParams.ID))+ return &LineIter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.InvoiceLineList{}+ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// FinalizeInvoice finalizes an invoice.+func FinalizeInvoice(id string, params *stripe.InvoiceFinalizeParams) (*stripe.Invoice, error) {+ return getC().FinalizeInvoice(id, params)+}++// FinalizeInvoice finalizes an invoice.+func (c Client) FinalizeInvoice(id string, params *stripe.InvoiceFinalizeParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s/finalize", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// MarkUncollectible marks an invoice as uncollectible.+func MarkUncollectible(id string, params *stripe.InvoiceMarkUncollectibleParams) (*stripe.Invoice, error) {+ return getC().MarkUncollectible(id, params)+}++// MarkUncollectible marks an invoice as uncollectible.+func (c Client) MarkUncollectible(id string, params *stripe.InvoiceMarkUncollectibleParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s/mark_uncollectible", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// SendInvoice sends an invoice.+func SendInvoice(id string, params *stripe.InvoiceSendParams) (*stripe.Invoice, error) {+ return getC().SendInvoice(id, params)+}++// SendInvoice sends an invoice.+func (c Client) SendInvoice(id string, params *stripe.InvoiceSendParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s/send", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// VoidInvoice voids an invoice.+func VoidInvoice(id string, params *stripe.InvoiceVoidParams) (*stripe.Invoice, error) {+ return getC().VoidInvoice(id, params)+}++// VoidInvoice voids an invoice.+func (c Client) VoidInvoice(id string, params *stripe.InvoiceVoidParams) (*stripe.Invoice, error) {+ path := stripe.FormatURLPath("/v1/invoices/%s/void", id)+ invoice := &stripe.Invoice{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoice)+ return invoice, err+}++// Iter is an iterator for invoices.+type Iter struct {+ *stripe.Iter+}++// Invoice returns the invoice which the iterator is currently pointing to.+func (i *Iter) Invoice() *stripe.Invoice {+ return i.Current().(*stripe.Invoice)+}++// LineIter is an iterator for line items on an invoice.+type LineIter struct {+ *stripe.Iter+}++// InvoiceLine returns the line item which the iterator is currently pointing to.+func (i *LineIter) InvoiceLine() *stripe.InvoiceLine {+ return i.Current().(*stripe.InvoiceLine)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/invoiceitem.go b/vendor/github.com/stripe/stripe-go/invoiceitem.gonew file mode 100644index 000000000..9a51a1209--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/invoiceitem.go@@ -0,0 +1,74 @@+package stripe++import "encoding/json"++// InvoiceItemParams is the set of parameters that can be used when creating or updating an invoice item.+// For more details see https://stripe.com/docs/api#create_invoiceitem and https://stripe.com/docs/api#update_invoiceitem.+type InvoiceItemParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ Description *string `form:"description"`+ Discountable *bool `form:"discountable"`+ Invoice *string `form:"invoice"`+ Quantity *int64 `form:"quantity"`+ Subscription *string `form:"subscription"`+ UnitAmount *int64 `form:"unit_amount"`+}++// InvoiceItemListParams is the set of parameters that can be used when listing invoice items.+// For more details see https://stripe.com/docs/api#list_invoiceitems.+type InvoiceItemListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Customer *string `form:"customer"`+}++// InvoiceItem is the resource represneting a Stripe invoice item.+// For more details see https://stripe.com/docs/api#invoiceitems.+type InvoiceItem struct {+ Amount int64 `json:"amount"`+ Currency Currency `json:"currency"`+ Customer *Customer `json:"customer"`+ Date int64 `json:"date"`+ Deleted bool `json:"deleted"`+ Description string `json:"description"`+ Discountable bool `json:"discountable"`+ ID string `json:"id"`+ Invoice *Invoice `json:"invoice"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Period *Period `json:"period"`+ Plan *Plan `json:"plan"`+ Proration bool `json:"proration"`+ Quantity int64 `json:"quantity"`+ Subscription *Subscription `json:"subscription"`+ UnitAmount int64 `json:"unit_amount"`+}++// InvoiceItemList is a list of invoice items as retrieved from a list endpoint.+type InvoiceItemList struct {+ ListMeta+ Data []*InvoiceItem `json:"data"`+}++// UnmarshalJSON handles deserialization of an InvoiceItem.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *InvoiceItem) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type invoiceItem InvoiceItem+ var v invoiceItem+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = InvoiceItem(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/invoiceitem/client.go b/vendor/github.com/stripe/stripe-go/invoiceitem/client.gonew file mode 100644index 000000000..410fe3c31--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/invoiceitem/client.go@@ -0,0 +1,100 @@+// Package invoiceitem provides the /invoiceitems APIs+package invoiceitem++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /invoiceitems APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new invoice item.+func New(params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ return getC().New(params)+}++// New creates a new invoice item.+func (c Client) New(params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ invoiceItem := &stripe.InvoiceItem{}+ err := c.B.Call(http.MethodPost, "/v1/invoiceitems", c.Key, params, invoiceItem)+ return invoiceItem, err+}++// Get returns the details of an invoice item.+func Get(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ return getC().Get(id, params)+}++// Get returns the details of an invoice item.+func (c Client) Get(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ path := stripe.FormatURLPath("/v1/invoiceitems/%s", id)+ invoiceItem := &stripe.InvoiceItem{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, invoiceItem)+ return invoiceItem, err+}++// Update updates an invoice item.+func Update(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ return getC().Update(id, params)+}++// Update updates an invoice item.+func (c Client) Update(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ path := stripe.FormatURLPath("/v1/invoiceitems/%s", id)+ invoiceItem := &stripe.InvoiceItem{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, invoiceItem)+ return invoiceItem, err+}++// Del removes an invoice item.+func Del(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ return getC().Del(id, params)+}++// Del removes an invoice item.+func (c Client) Del(id string, params *stripe.InvoiceItemParams) (*stripe.InvoiceItem, error) {+ path := stripe.FormatURLPath("/v1/invoiceitems/%s", id)+ ii := &stripe.InvoiceItem{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, ii)+ return ii, err+}++// List returns a list of invoice items.+func List(params *stripe.InvoiceItemListParams) *Iter {+ return getC().List(params)+}++// List returns a list of invoice items.+func (c Client) List(listParams *stripe.InvoiceItemListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.InvoiceItemList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/invoiceitems", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for invoice items.+type Iter struct {+ *stripe.Iter+}++// InvoiceItem returns the invoice item which the iterator is currently pointing to.+func (i *Iter) InvoiceItem() *stripe.InvoiceItem {+ return i.Current().(*stripe.InvoiceItem)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuerfraudrecord.go b/vendor/github.com/stripe/stripe-go/issuerfraudrecord.gonew file mode 100644index 000000000..c52fbbdd2--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuerfraudrecord.go@@ -0,0 +1,50 @@+package stripe++// IssuerFraudType are strings that map to the fraud label category from the issuer.+type IssuerFraudType string++// List of values that IssuerFraudType can take.+const (+ IssuerFraudTypeCardNeverReceived IssuerFraudType = "card_never_received"+ IssuerFraudTypeFraudulentCardApplication IssuerFraudType = "fraudulent_card_application"+ IssuerFraudTypeMadeWithCounterfeitCard IssuerFraudType = "made_with_counterfeit_card"+ IssuerFraudTypeMadeWithLostCard IssuerFraudType = "made_with_lost_card"+ IssuerFraudTypeMadeWithStolenCard IssuerFraudType = "made_with_stolen_card"+ IssuerFraudTypeMisc IssuerFraudType = "misc"+ IssuerFraudTypeUnauthorizedUseOfCard IssuerFraudType = "unauthorized_use_of_card"+)++// IssuerFraudRecordParams is the set of parameters that can be used when+// retrieving issuer fraud records. For more details see+// https://stripe.com/docs#retrieve_issuer_fraud_records.+type IssuerFraudRecordParams struct {+ Params `form:"*"`+}++// IssuerFraudRecordListParams is the set of parameters that can be used when+// listing issuer fraud records. For more details see+// https://stripe.com/docs#list_issuer_fraud_records.+type IssuerFraudRecordListParams struct {+ ListParams `form:"*"`+ Charge *string `form:"-"`+}++// IssuerFraudRecordList is a list of issuer fraud records as retrieved from a+// list endpoint.+type IssuerFraudRecordList struct {+ ListMeta+ Values []*IssuerFraudRecord `json:"data"`+}++// IssuerFraudRecord is the resource representing an issuer fraud record. For+// more details see https://stripe.com/docs/api#issuer_fraud_records.+type IssuerFraudRecord struct {+ Actionable bool `json:"actionable"`+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ FraudType IssuerFraudType `json:"fraud_type"`+ HasLiabilityShift bool `json:"has_liability_shift"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ PostDate int64 `json:"post_date"`+}diff --git a/vendor/github.com/stripe/stripe-go/issuerfraudrecord/client.go b/vendor/github.com/stripe/stripe-go/issuerfraudrecord/client.gonew file mode 100644index 000000000..fef537ea4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuerfraudrecord/client.go@@ -0,0 +1,61 @@+package issuerfraudrecord++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to interact with the /issuer_fraud_records API.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of an issuer fraud record.+func Get(id string, params *stripe.IssuerFraudRecordParams) (*stripe.IssuerFraudRecord, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuer fraud record.+func (c Client) Get(id string, params *stripe.IssuerFraudRecordParams) (*stripe.IssuerFraudRecord, error) {+ path := stripe.FormatURLPath("/v1/issuer_fraud_records/%s", id)+ ifr := &stripe.IssuerFraudRecord{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, ifr)+ return ifr, err+}++// List returns a list of issuer fraud records.+func List(params *stripe.IssuerFraudRecordListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuer fraud records.+func (c Client) List(listParams *stripe.IssuerFraudRecordListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuerFraudRecordList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuer_fraud_records", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Values))+ for i, v := range list.Values {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for issuer fraud records.+type Iter struct {+ *stripe.Iter+}++// IssuerFraudRecord returns the issuer fraud record which the iterator is currently pointing to.+func (i *Iter) IssuerFraudRecord() *stripe.IssuerFraudRecord {+ return i.Current().(*stripe.IssuerFraudRecord)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing/authorization/client.go b/vendor/github.com/stripe/stripe-go/issuing/authorization/client.gonew file mode 100644index 000000000..d25d39d99--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing/authorization/client.go@@ -0,0 +1,103 @@+// Package authorization provides API functions related to issuing authorizations.+//+// For more details, see: https://stripe.com/docs/api/go#issuing_authorizations+package authorization++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /issuing/authorizations APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Approve approves an issuing authorization.+func Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ return getC().Approve(id, params)+}++// Approve updates an issuing authorization.+func (c Client) Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/approve", id)+ authorization := &stripe.IssuingAuthorization{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)+ return authorization, err+}++// Decline decline an issuing authorization.+func Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ return getC().Decline(id, params)+}++// Decline updates an issuing authorization.+func (c Client) Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/decline", id)+ authorization := &stripe.IssuingAuthorization{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)+ return authorization, err+}++// Get returns the details of an issuing authorization.+func Get(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuing authorization.+func (c Client) Get(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ path := stripe.FormatURLPath("/v1/issuing/authorizations/%s", id)+ authorization := &stripe.IssuingAuthorization{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, authorization)+ return authorization, err+}++// Update updates an issuing authorization.+func Update(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ return getC().Update(id, params)+}++// Update updates an issuing authorization.+func (c Client) Update(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {+ path := stripe.FormatURLPath("/v1/issuing/authorizations/%s", id)+ authorization := &stripe.IssuingAuthorization{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)+ return authorization, err+}++// List returns a list of issuing authorizations.+func List(params *stripe.IssuingAuthorizationListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuing authorizations.+func (c Client) List(listParams *stripe.IssuingAuthorizationListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuingAuthorizationList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuing/authorizations", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for issuing authorizations.+type Iter struct {+ *stripe.Iter+}++// IssuingAuthorization returns the issuing authorization which the iterator is currently pointing to.+func (i *Iter) IssuingAuthorization() *stripe.IssuingAuthorization {+ return i.Current().(*stripe.IssuingAuthorization)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing/card/client.go b/vendor/github.com/stripe/stripe-go/issuing/card/client.gonew file mode 100644index 000000000..443ae0532--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing/card/client.go@@ -0,0 +1,102 @@+// Package card provides API functions related to issuing cards.+//+// For more details, see: https://stripe.com/docs/api/go#issuing_cards+package card++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /issuing/cards APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new issuing card.+func New(params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ return getC().New(params)+}++// New creates a new issuing card.+func (c Client) New(params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ card := &stripe.IssuingCard{}+ err := c.B.Call(http.MethodPost, "/v1/issuing/cards", c.Key, params, card)+ return card, err+}++// Get returns the details of an issuing card.+func Get(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuing card.+func (c Client) Get(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ path := stripe.FormatURLPath("/v1/issuing/cards/%s", id)+ card := &stripe.IssuingCard{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, card)+ return card, err+}++// Update updates an issuing card.+func Update(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ return getC().Update(id, params)+}++// Update updates an issuing card.+func (c Client) Update(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCard, error) {+ path := stripe.FormatURLPath("/v1/issuing/cards/%s", id)+ card := &stripe.IssuingCard{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, card)+ return card, err+}++// List returns a list of issuing cards.+func List(params *stripe.IssuingCardListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuing cards.+func (c Client) List(listParams *stripe.IssuingCardListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuingCardList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuing/cards", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Details retrieves an issuing card details.+func Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) {+ return getC().Details(id, params)+}++// Details retrieves an issuing card details.+func (c Client) Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) {+ path := stripe.FormatURLPath("/v1/issuing/cards/%s/details", id)+ cardDetails := &stripe.IssuingCardDetails{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, cardDetails)+ return cardDetails, err+}++// Iter is an iterator for issuing cards.+type Iter struct {+ *stripe.Iter+}++// IssuingCard returns the issuing card which the iterator is currently pointing to.+func (i *Iter) IssuingCard() *stripe.IssuingCard {+ return i.Current().(*stripe.IssuingCard)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing/cardholder/client.go b/vendor/github.com/stripe/stripe-go/issuing/cardholder/client.gonew file mode 100644index 000000000..f0eb84920--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing/cardholder/client.go@@ -0,0 +1,89 @@+// Package cardholder provides API functions related to issuing cardholders.+//+// For more details, see: https://stripe.com/docs/api/go#issuing_cardholders+package cardholder++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /issuing/cardholders APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new issuing cardholder.+func New(params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ return getC().New(params)+}++// New creates a new issuing cardholder.+func (c Client) New(params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ cardholder := &stripe.IssuingCardholder{}+ err := c.B.Call(http.MethodPost, "/v1/issuing/cardholders", c.Key, params, cardholder)+ return cardholder, err+}++// Get returns the details of an issuing cardholder.+func Get(id string, params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuing cardholder.+func (c Client) Get(id string, params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ path := stripe.FormatURLPath("/v1/issuing/cardholders/%s", id)+ cardholder := &stripe.IssuingCardholder{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, cardholder)+ return cardholder, err+}++// Update updates an issuing cardholder.+func Update(id string, params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ return getC().Update(id, params)+}++// Update updates an issuing cardholder.+func (c Client) Update(id string, params *stripe.IssuingCardholderParams) (*stripe.IssuingCardholder, error) {+ path := stripe.FormatURLPath("/v1/issuing/cardholders/%s", id)+ cardholder := &stripe.IssuingCardholder{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, cardholder)+ return cardholder, err+}++// List returns a list of issuing cardholders.+func List(params *stripe.IssuingCardholderListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuing cardholders.+func (c Client) List(listParams *stripe.IssuingCardholderListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuingCardholderList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuing/cardholders", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for issuing cardholders.+type Iter struct {+ *stripe.Iter+}++// IssuingCardholder returns the issuing cardholder which the iterator is currently pointing to.+func (i *Iter) IssuingCardholder() *stripe.IssuingCardholder {+ return i.Current().(*stripe.IssuingCardholder)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing/dispute/client.go b/vendor/github.com/stripe/stripe-go/issuing/dispute/client.gonew file mode 100644index 000000000..14d24bbee--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing/dispute/client.go@@ -0,0 +1,89 @@+// Package dispute provides API functions related to issuing disputes.+//+// For more details, see: https://stripe.com/docs/api/go#issuing_disputes+package dispute++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /issuing/disputes APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new issuing dispute.+func New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ return getC().New(params)+}++// New creates a new issuing dispute.+func (c Client) New(params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ dispute := &stripe.IssuingDispute{}+ err := c.B.Call(http.MethodPost, "/v1/issuing/disputes", c.Key, params, dispute)+ return dispute, err+}++// Get returns the details of an issuing dispute.+func Get(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuing dispute.+func (c Client) Get(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ path := stripe.FormatURLPath("/v1/issuing/disputes/%s", id)+ dispute := &stripe.IssuingDispute{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, dispute)+ return dispute, err+}++// Update updates an issuing dispute.+func Update(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ return getC().Update(id, params)+}++// Update updates an issuing dispute.+func (c Client) Update(id string, params *stripe.IssuingDisputeParams) (*stripe.IssuingDispute, error) {+ path := stripe.FormatURLPath("/v1/issuing/disputes/%s", id)+ dispute := &stripe.IssuingDispute{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, dispute)+ return dispute, err+}++// List returns a list of issuing disputes.+func List(params *stripe.IssuingDisputeListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuing disputes.+func (c Client) List(listParams *stripe.IssuingDisputeListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuingDisputeList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuing/disputes", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for issuing disputes.+type Iter struct {+ *stripe.Iter+}++// IssuingDispute returns the issuing dispute which the iterator is currently pointing to.+func (i *Iter) IssuingDispute() *stripe.IssuingDispute {+ return i.Current().(*stripe.IssuingDispute)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing/transaction/client.go b/vendor/github.com/stripe/stripe-go/issuing/transaction/client.gonew file mode 100644index 000000000..85590a9f8--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing/transaction/client.go@@ -0,0 +1,77 @@+// Package transaction provides API functions related to issuing transactions.+//+// For more details, see: https://stripe.com/docs/api/go#issuing_transactions+package transaction++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /issuing/transactions APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of an issuing transaction.+func Get(id string, params *stripe.IssuingTransactionParams) (*stripe.IssuingTransaction, error) {+ return getC().Get(id, params)+}++// Get returns the details of an issuing transaction.+func (c Client) Get(id string, params *stripe.IssuingTransactionParams) (*stripe.IssuingTransaction, error) {+ path := stripe.FormatURLPath("/v1/issuing/transactions/%s", id)+ transaction := &stripe.IssuingTransaction{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, transaction)+ return transaction, err+}++// Update updates an issuing transaction.+func Update(id string, params *stripe.IssuingTransactionParams) (*stripe.IssuingTransaction, error) {+ return getC().Update(id, params)+}++// Update updates an issuing transaction.+func (c Client) Update(id string, params *stripe.IssuingTransactionParams) (*stripe.IssuingTransaction, error) {+ path := stripe.FormatURLPath("/v1/issuing/transactions/%s", id)+ transaction := &stripe.IssuingTransaction{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, transaction)+ return transaction, err+}++// List returns a list of issuing transactions.+func List(params *stripe.IssuingTransactionListParams) *Iter {+ return getC().List(params)+}++// List returns a list of issuing transactions.+func (c Client) List(listParams *stripe.IssuingTransactionListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.IssuingTransactionList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/issuing/transactions", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for issuing transactions.+type Iter struct {+ *stripe.Iter+}++// IssuingTransaction returns the issuing transaction which the iterator is currently pointing to.+func (i *Iter) IssuingTransaction() *stripe.IssuingTransaction {+ return i.Current().(*stripe.IssuingTransaction)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/issuing_authorization.go b/vendor/github.com/stripe/stripe-go/issuing_authorization.gonew file mode 100644index 000000000..10b67981c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing_authorization.go@@ -0,0 +1,156 @@+package stripe++import "encoding/json"++// IssuingAuthorizationAuthorizationMethod is the list of possible values for the authorization method+// on an issuing authorization.+type IssuingAuthorizationAuthorizationMethod string++// List of values that IssuingAuthorizationAuthorizationMethod can take.+const (+ IssuingAuthorizationAuthorizationMethodChip IssuingAuthorizationAuthorizationMethod = "chip"+ IssuingAuthorizationAuthorizationMethodContactless IssuingAuthorizationAuthorizationMethod = "contactless"+ IssuingAuthorizationAuthorizationMethodKeyedIn IssuingAuthorizationAuthorizationMethod = "keyed_in"+ IssuingAuthorizationAuthorizationMethodOnline IssuingAuthorizationAuthorizationMethod = "online"+ IssuingAuthorizationAuthorizationMethodSwipe IssuingAuthorizationAuthorizationMethod = "swipe"+)++// IssuingAuthorizationRequestHistoryReason is the list of possible values for the request history+// reason on an issuing authorization.+type IssuingAuthorizationRequestHistoryReason string++// List of values that IssuingAuthorizationRequestHistoryReason can take.+const (+ IssuingAuthorizationRequestHistoryReasonAuthorizationControls IssuingAuthorizationRequestHistoryReason = "authorization_controls"+ IssuingAuthorizationRequestHistoryReasonCardActive IssuingAuthorizationRequestHistoryReason = "card_active"+ IssuingAuthorizationRequestHistoryReasonCardInactive IssuingAuthorizationRequestHistoryReason = "card_inactive"+ IssuingAuthorizationRequestHistoryReasonInsufficientFunds IssuingAuthorizationRequestHistoryReason = "insufficient_funds"+ IssuingAuthorizationRequestHistoryReasonWebhookApproved IssuingAuthorizationRequestHistoryReason = "webhook_approved"+ IssuingAuthorizationRequestHistoryReasonWebhookDeclined IssuingAuthorizationRequestHistoryReason = "webhook_declined"+ IssuingAuthorizationRequestHistoryReasonWebhookTimeout IssuingAuthorizationRequestHistoryReason = "webhook_timeout"+)++// IssuingAuthorizationStatus is the possible values for status for an issuing authorization.+type IssuingAuthorizationStatus string++// List of values that IssuingAuthorizationStatus can take.+const (+ IssuingAuthorizationStatusClosed IssuingAuthorizationStatus = "closed"+ IssuingAuthorizationStatusPending IssuingAuthorizationStatus = "pending"+ IssuingAuthorizationStatusReversed IssuingAuthorizationStatus = "reversed"+)++// IssuingAuthorizationVerificationDataCheck is the list of possible values for result of a check+// for verification data on an issuing authorization.+type IssuingAuthorizationVerificationDataCheck string++// List of values that IssuingAuthorizationVerificationDataCheck can take.+const (+ IssuingAuthorizationVerificationDataCheckMatch IssuingAuthorizationVerificationDataCheck = "match"+ IssuingAuthorizationVerificationDataCheckMismatch IssuingAuthorizationVerificationDataCheck = "mismatch"+ IssuingAuthorizationVerificationDataCheckNotProvided IssuingAuthorizationVerificationDataCheck = "not_provided"+)++// IssuingAuthorizationParams is the set of parameters that can be used when updating an issuing authorization.+type IssuingAuthorizationParams struct {+ Params `form:"*"`+}++// IssuingAuthorizationListParams is the set of parameters that can be used when listing issuing authorizations.+type IssuingAuthorizationListParams struct {+ ListParams `form:"*"`+ Card *string `form:"card"`+ Cardholder *string `form:"cardholder"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Status *string `form:"status"`+}++// IssuingAuthorizationAuthorizationControls is the resource representing authorization controls on an issuing authorization.+type IssuingAuthorizationAuthorizationControls struct {+ AllowedCategories []string `json:"allowed_categories"`+ BlockedCategories []string `json:"blocked_categories"`+ Currency Currency `json:"currency"`+ MaxAmount int64 `json:"max_amount"`+ MaxApprovals int64 `json:"max_approvals"`+}++// IssuingAuthorizationRequestHistory is the resource representing a request history on an issuing authorization.+type IssuingAuthorizationRequestHistory struct {+ Approved bool `json:"approved"`+ AuthorizedAmount int64 `json:"authorized_amount"`+ AuthorizedCurrency Currency `json:"authorized_currency"`+ Created int64 `json:"created"`+ HeldAmount int64 `json:"held_amount"`+ HeldCurrency Currency `json:"held_currency"`+ Reason IssuingAuthorizationRequestHistoryReason `json:"reason"`+}++// IssuingAuthorizationVerificationData is the resource representing verification data on an issuing authorization.+type IssuingAuthorizationVerificationData struct {+ AddressLine1Check IssuingAuthorizationVerificationDataCheck `json:"address_line1_check"`+ AddressZipCheck IssuingAuthorizationVerificationDataCheck `json:"address_zip_check"`+ CVCCheck IssuingAuthorizationVerificationDataCheck `json:"cvc_check"`+}++// IssuingAuthorization is the resource representing a Stripe issuing authorization.+type IssuingAuthorization struct {+ Approved bool `json:"approved"`+ AuthorizationMethod IssuingAuthorizationAuthorizationMethod `json:"authorization_method"`+ AuthorizedAmount int64 `json:"authorized_amount"`+ AuthorizedCurrency Currency `json:"authorized_currency"`+ BalanceTransactions []*BalanceTransaction `json:"balance_transactions"`+ Card *IssuingCard `json:"card"`+ Cardholder *IssuingCardholder `json:"cardholder"`+ Created int64 `json:"created"`+ HeldAmount int64 `json:"held_amount"`+ HeldCurrency Currency `json:"held_currency"`+ ID string `json:"id"`+ IsHeldAmountControllable bool `json:"is_held_amount_controllable"`+ Livemode bool `json:"livemode"`+ MerchantData *IssuingMerchantData `json:"merchant_data"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ PendingAuthorizedAmount int64 `json:"pending_authorized_amount"`+ PendingHeldAmount int64 `json:"pending_held_amount"`+ RequestHistory []*IssuingAuthorizationRequestHistory `json:"request_history"`+ Status IssuingAuthorizationStatus `json:"status"`+ Transactions []*IssuingTransaction `json:"transactions"`+ VerificationData *IssuingAuthorizationVerificationData `json:"verification_data"`+}++// IssuingMerchantData is the resource representing merchant data on Issuing APIs.+type IssuingMerchantData struct {+ Category string `json:"category"`+ City string `json:"city"`+ Country string `json:"country"`+ Name string `json:"name"`+ NetworkID string `json:"network_id"`+ PostalCode string `json:"postal_code"`+ State string `json:"state"`+}++// IssuingAuthorizationList is a list of issuing authorizations as retrieved from a list endpoint.+type IssuingAuthorizationList struct {+ ListMeta+ Data []*IssuingAuthorization `json:"data"`+}++// UnmarshalJSON handles deserialization of an IssuingAuthorization.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *IssuingAuthorization) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type issuingAuthorization IssuingAuthorization+ var v issuingAuthorization+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = IssuingAuthorization(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/issuing_card.go b/vendor/github.com/stripe/stripe-go/issuing_card.gonew file mode 100644index 000000000..c1a1c8e26--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing_card.go@@ -0,0 +1,164 @@+package stripe++import "encoding/json"++// IssuingCardShippingStatus is the list of possible values for the shipping status+// on an issuing card.+type IssuingCardShippingStatus string++// List of values that IssuingCardShippingStatus can take.+const (+ IssuingCardShippingTypeDelivered IssuingCardShippingStatus = "delivered"+ IssuingCardShippingTypeFailure IssuingCardShippingStatus = "failure"+ IssuingCardShippingTypePending IssuingCardShippingStatus = "pending"+ IssuingCardShippingTypeReturned IssuingCardShippingStatus = "returned"+ IssuingCardShippingTypeShipped IssuingCardShippingStatus = "shipped"+)++// IssuingCardShippingType is the list of possible values for the shipping type+// on an issuing card.+type IssuingCardShippingType string++// List of values that IssuingCardShippingType can take.+const (+ IssuingCardShippingTypeBulk IssuingCardShippingType = "bulk"+ IssuingCardShippingTypeIndividual IssuingCardShippingType = "individual"+)++// IssuingCardStatus is the list of possible values for status on an issuing card.+type IssuingCardStatus string++// List of values that IssuingCardStatus can take.+const (+ IssuingCardStatusActive IssuingCardStatus = "active"+ IssuingCardStatusCanceled IssuingCardStatus = "canceled"+ IssuingCardStatusInactive IssuingCardStatus = "inactive"+ IssuingCardStatusPending IssuingCardStatus = "pending"+)++// IssuingCardType is the type of an issuing card.+type IssuingCardType string++// List of values that IssuingCardType can take.+const (+ IssuingCardTypePhysical IssuingCardType = "physical"+ IssuingCardTypeVirtual IssuingCardType = "virtual"+)++// AuthorizationControlsParams is the set of parameters that can be used for the shipping parameter.+type AuthorizationControlsParams struct {+ AllowedCategories []*string `form:"allowed_categories"`+ BlockedCategories []*string `form:"blocked_categories"`+ MaxAmount *int64 `form:"max_amount"`+ MaxApprovals *int64 `form:"max_approvals"`+}++// IssuingCardShippingParams is the set of parameters that can be used for the shipping parameter.+type IssuingCardShippingParams struct {+ Address *AddressParams `form:"address"`+ Name string `form:"name"`+ Type *string `form:"type"`+}++// IssuingCardParams is the set of parameters that can be used when creating or updating an issuing card.+type IssuingCardParams struct {+ Params `form:"*"`+ AuthorizationControls *AuthorizationControlsParams `form:"authorization_controls"`+ Billing *IssuingBillingParams `form:"billing"`+ Cardholder *string `form:"cardholder"`+ Currency *string `form:"currency"`+ Name *string `form:"name"`+ Status *string `form:"status"`+ Shipping *IssuingCardShippingParams `form:"shipping"`+ Type *string `form:"type"`+}++// IssuingCardListParams is the set of parameters that can be used when listing issuing cards.+type IssuingCardListParams struct {+ ListParams `form:"*"`+ Cardholder *string `form:"cardholder"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ ExpMonth *int64 `form:"exp_month"`+ ExpYear *int64 `form:"exp_year"`+ Last4 *string `form:"last4"`+ Source *string `form:"source"`+ Status *string `form:"status"`+ Type *string `form:"type"`+}++// IssuingCardDetails is the resource representing issuing card details.+type IssuingCardDetails struct {+ Card *IssuingCard `json:"card"`+ CVC string `json:"cvc"`+ ExpMonth *string `form:"exp_month"`+ ExpYear *string `form:"exp_year"`+ Number string `json:"number"`+ Object string `json:"object"`+}++// IssuingCardAuthorizationControls is the resource representing authorization controls on an issuing card.+type IssuingCardAuthorizationControls struct {+ AllowedCategories []string `json:"allowed_categories"`+ BlockedCategories []string `json:"blocked_categories"`+ Currency Currency `json:"currency"`+ MaxAmount int64 `json:"max_amount"`+ MaxApprovals int64 `json:"max_approvals"`+}++// IssuingCardShipping is the resource representing shipping on an issuing card.+type IssuingCardShipping struct {+ Address *Address `json:"address"`+ Carrier string `json:"carrier"`+ ETA int64 `json:"eta"`+ Name string `json:"name"`+ Phone string `json:"phone"`+ Status IssuingCardShippingStatus `json:"status"`+ TrackingNumber string `json:"tracking_number"`+ Type IssuingCardShippingType `json:"type"`+}++// IssuingCard is the resource representing a Stripe issuing card.+type IssuingCard struct {+ AuthorizationControls *IssuingCardAuthorizationControls `json:"authorization_controls"`+ Billing *IssuingBilling `json:"billing"`+ Brand string `json:"brand"`+ Cardholder *IssuingCardholder `json:"cardholder"`+ Created int64 `json:"created"`+ ExpMonth int64 `json:"exp_month"`+ ExpYear int64 `json:"exp_year"`+ Last4 string `json:"last4"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ Object string `json:"object"`+ Shipping *IssuingCardShipping `json:"shipping"`+ Status IssuingCardStatus `json:"status"`+ Type IssuingCardType `json:"type"`+}++// IssuingCardList is a list of issuing cards as retrieved from a list endpoint.+type IssuingCardList struct {+ ListMeta+ Data []*IssuingCard `json:"data"`+}++// UnmarshalJSON handles deserialization of an IssuingCard.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *IssuingCard) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type issuingCard IssuingCard+ var v issuingCard+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = IssuingCard(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/issuing_cardholder.go b/vendor/github.com/stripe/stripe-go/issuing_cardholder.gonew file mode 100644index 000000000..c62ae0e16--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing_cardholder.go@@ -0,0 +1,95 @@+package stripe++import "encoding/json"++// IssuingCardholderStatus is the possible values for status on an issuing cardholder.+type IssuingCardholderStatus string++// List of values that IssuingCardholderStatus can take.+const (+ IssuingCardholderStatusActive IssuingCardholderStatus = "active"+ IssuingCardholderStatusInactive IssuingCardholderStatus = "inactive"+ IssuingCardholderStatusPending IssuingCardholderStatus = "pending"+)++// IssuingCardholderType is the type of an issuing cardholder.+type IssuingCardholderType string++// List of values that IssuingCardholderType can take.+const (+ IssuingCardholderTypeBusinessEntity IssuingCardholderType = "business_entity"+ IssuingCardholderTypeIndividual IssuingCardholderType = "individual"+)++// IssuingBillingParams isis the set of parameters that can be used for billing with the Issuing APIs.+type IssuingBillingParams struct {+ Address *AddressParams `form:"address"`+ Name *string `form:"name"`+}++// IssuingCardholderParams is the set of parameters that can be used when creating or updating an issuing cardholder.+type IssuingCardholderParams struct {+ Params `form:"*"`+ Billing *IssuingBillingParams `form:"billing"`+ Email *string `form:"email"`+ Name *string `form:"name"`+ PhoneNumber *string `form:"phone_number"`+ Type *string `form:"type"`+}++// IssuingCardholderListParams is the set of parameters that can be used when listing issuing cardholders.+type IssuingCardholderListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Email *string `form:"email"`+ PhoneNumber *string `form:"phone_number"`+ Status *string `form:"status"`+ Type *string `form:"type"`+}++// IssuingBilling is the resource representing the billing hash with the Issuing APIs.+type IssuingBilling struct {+ Address *Address `json:"address"`+ Name string `json:"name"`+}++// IssuingCardholder is the resource representing a Stripe issuing cardholder.+type IssuingCardholder struct {+ Billing *IssuingBilling `json:"billing"`+ Created int64 `json:"created"`+ Email string `json:"email"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ Object string `json:"object"`+ PhoneNumber string `json:"phone_number"`+ Status IssuingCardholderStatus `json:"status"`+ Type IssuingCardholderType `json:"type"`+}++// IssuingCardholderList is a list of issuing cardholders as retrieved from a list endpoint.+type IssuingCardholderList struct {+ ListMeta+ Data []*IssuingCardholder `json:"data"`+}++// UnmarshalJSON handles deserialization of an IssuingCardholder.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *IssuingCardholder) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type issuingCardholder IssuingCardholder+ var v issuingCardholder+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = IssuingCardholder(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/issuing_dispute.go b/vendor/github.com/stripe/stripe-go/issuing_dispute.gonew file mode 100644index 000000000..a34bbdefd--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing_dispute.go@@ -0,0 +1,120 @@+package stripe++import "encoding/json"++// IssuingDisputeReason is the list of possible values for status on an issuing dispute.+type IssuingDisputeReason string++// List of values that IssuingDisputeReason can take.+const (+ IssuingDisputeReasonFraudulent IssuingDisputeReason = "fraudulent"+ IssuingDisputeReasonOther IssuingDisputeReason = "other"+)++// IssuingDisputeStatus is the list of possible values for status on an issuing dispute.+type IssuingDisputeStatus string++// List of values that IssuingDisputeStatus can take.+const (+ IssuingDisputeStatusLost IssuingDisputeStatus = "lost"+ IssuingDisputeStatusUnderReview IssuingDisputeStatus = "under_review"+ IssuingDisputeStatusUnsubmitted IssuingDisputeStatus = "unsubmitted"+ IssuingDisputeStatusWon IssuingDisputeStatus = "won"+)++// IssuingDisputeEvidenceFraudulentParams is the subset of parameters that can be sent as evidence for an issuing dispute+// with the reason set as fraudulent.+type IssuingDisputeEvidenceFraudulentParams struct {+ DisputeExplanation *string `form:"dispute_explanation"`+ UncategorizedFile *string `form:"uncategorized_file"`+}++// IssuingDisputeEvidenceOtherParams is the subset of parameters that can be sent as evidence for an issuing dispute+// with the reason set as other.+type IssuingDisputeEvidenceOtherParams struct {+ DisputeExplanation *string `form:"dispute_explanation"`+ UncategorizedFile *string `form:"uncategorized_file"`+}++// IssuingDisputeEvidenceParams is the set of parameters that can be sent as evidence for an issuing dispute.+type IssuingDisputeEvidenceParams struct {+ Fraudulent *IssuingDisputeEvidenceFraudulentParams `form:"fraudulent"`+ Other *IssuingDisputeEvidenceOtherParams `form:"other"`+}++// IssuingDisputeParams is the set of parameters that can be used when creating or updating an issuing dispute.+type IssuingDisputeParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Evidence *IssuingDisputeEvidenceParams `form:"evidence"`+ Reason *string `form:"reason"`+ DisputedTransaction *string `form:"disputed_transaction"`+}++// IssuingDisputeListParams is the set of parameters that can be used when listing issuing dispute.+type IssuingDisputeListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Transaction *string `form:"transaction"`+}++// IssuingDisputeEvidenceFraudulent is the resource representing the evidence hash on an issuing dispute+// with the reason set as fraudulent.+type IssuingDisputeEvidenceFraudulent struct {+ DisputeExplanation string `json:"dispute_explanation"`+ UncategorizedFile *File `json:"uncategorized_file"`+}++// IssuingDisputeEvidenceOther is the resource representing the evidence hash on an issuing dispute+// with the reason set as other.+type IssuingDisputeEvidenceOther struct {+ DisputeExplanation string `json:"dispute_explanation"`+ UncategorizedFile *File `json:"uncategorized_file"`+}++// IssuingDisputeEvidence is the resource representing evidence on an issuing dispute.+type IssuingDisputeEvidence struct {+ Fraudulent *IssuingDisputeEvidenceFraudulent `json:"fraudulent"`+ Other *IssuingDisputeEvidenceOther `json:"other"`+}++// IssuingDispute is the resource representing an issuing dispute.+type IssuingDispute struct {+ Amount int64 `json:"amount"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Evidence *IssuingDisputeEvidence `json:"evidence"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ Reason IssuingDisputeReason `json:"reason"`+ Status IssuingDisputeStatus `json:"status"`+ Transaction *IssuingTransaction `json:"transaction"`+}++// IssuingDisputeList is a list of issuing disputes as retrieved from a list endpoint.+type IssuingDisputeList struct {+ ListMeta+ Data []*IssuingDispute `json:"data"`+}++// UnmarshalJSON handles deserialization of an IssuingDispute.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *IssuingDispute) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type issuingDispute IssuingDispute+ var v issuingDispute+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = IssuingDispute(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/issuing_transaction.go b/vendor/github.com/stripe/stripe-go/issuing_transaction.gonew file mode 100644index 000000000..f6cd48220--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/issuing_transaction.go@@ -0,0 +1,70 @@+package stripe++import "encoding/json"++// IssuingTransactionType is the type of an issuing transaction.+type IssuingTransactionType string++// List of values that IssuingTransactionType can take.+const (+ IssuingTransactionTypeCapture IssuingTransactionType = "capture"+ IssuingTransactionTypeCashWithdrawal IssuingTransactionType = "cash_withdrawal"+ IssuingTransactionTypeRefund IssuingTransactionType = "refund"+ IssuingTransactionTypeRefundReversal IssuingTransactionType = "refund_reversal"+)++// IssuingTransactionParams is the set of parameters that can be used when creating or updating an issuing transaction.+type IssuingTransactionParams struct {+ Params `form:"*"`+}++// IssuingTransactionListParams is the set of parameters that can be used when listing issuing transactions.+type IssuingTransactionListParams struct {+ ListParams `form:"*"`+ Card *string `form:"card"`+ Cardholder *string `form:"cardholder"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// IssuingTransaction is the resource representing a Stripe issuing transaction.+type IssuingTransaction struct {+ Authorization *IssuingAuthorization `json:"authorization"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Card *IssuingCard `json:"card"`+ Cardholder *IssuingCardholder `json:"cardholder"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Dispute *IssuingDispute `json:"dispute"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ MerchantData *IssuingMerchantData `json:"merchant_data"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ Type IssuingTransactionType `json:"type"`+}++// IssuingTransactionList is a list of issuing transactions as retrieved from a list endpoint.+type IssuingTransactionList struct {+ ListMeta+ Data []*IssuingTransaction `json:"data"`+}++// UnmarshalJSON handles deserialization of an IssuingTransaction.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *IssuingTransaction) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type issuingTransaction IssuingTransaction+ var v issuingTransaction+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = IssuingTransaction(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/iter.go b/vendor/github.com/stripe/stripe-go/iter.gonew file mode 100644index 000000000..c11b621f2--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/iter.go@@ -0,0 +1,133 @@+package stripe++import (+ "reflect"++ "github.com/stripe/stripe-go/form"+)++//+// Public types+//++// Iter provides a convenient interface+// for iterating over the elements+// returned from paginated list API calls.+// Successive calls to the Next method+// will step through each item in the list,+// fetching pages of items as needed.+// Iterators are not thread-safe, so they should not be consumed+// across multiple goroutines.+type Iter struct {+ cur interface{}+ err error+ formValues *form.Values+ listParams ListParams+ meta ListMeta+ query Query+ values []interface{}+}++// Current returns the most recent item+// visited by a call to Next.+func (it *Iter) Current() interface{} {+ return it.cur+}++// Err returns the error, if any,+// that caused the Iter to stop.+// It must be inspected+// after Next returns false.+func (it *Iter) Err() error {+ return it.err+}++// Meta returns the list metadata.+func (it *Iter) Meta() *ListMeta {+ return &it.meta+}++// Next advances the Iter to the next item in the list,+// which will then be available+// through the Current method.+// It returns false when the iterator stops+// at the end of the list.+func (it *Iter) Next() bool {+ if len(it.values) == 0 && it.meta.HasMore && !it.listParams.Single {+ // determine if we're moving forward or backwards in paging+ if it.listParams.EndingBefore != nil {+ it.listParams.EndingBefore = String(listItemID(it.cur))+ it.formValues.Set(EndingBefore, *it.listParams.EndingBefore)+ } else {+ it.listParams.StartingAfter = String(listItemID(it.cur))+ it.formValues.Set(StartingAfter, *it.listParams.StartingAfter)+ }+ it.getPage()+ }+ if len(it.values) == 0 {+ return false+ }+ it.cur = it.values[0]+ it.values = it.values[1:]+ return true+}++func (it *Iter) getPage() {+ it.values, it.meta, it.err = it.query(it.listParams.GetParams(), it.formValues)++ if it.listParams.EndingBefore != nil {+ // We are moving backward,+ // but items arrive in forward order.+ reverse(it.values)+ }+}++// Query is the function used to get a page listing.+type Query func(*Params, *form.Values) ([]interface{}, ListMeta, error)++//+// Public functions+//++// GetIter returns a new Iter for a given query and its options.+func GetIter(container ListParamsContainer, query Query) *Iter {+ var listParams *ListParams+ formValues := &form.Values{}++ if container != nil {+ reflectValue := reflect.ValueOf(container)++ // See the comment on Call in stripe.go.+ if reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil() {+ listParams = container.GetListParams()+ form.AppendTo(formValues, container)+ }+ }++ if listParams == nil {+ listParams = &ListParams{}+ }+ iter := &Iter{+ formValues: formValues,+ listParams: *listParams,+ query: query,+ }++ iter.getPage()++ return iter+}++//+// Private functions+//++func listItemID(x interface{}) string {+ return reflect.ValueOf(x).Elem().FieldByName("ID").String()+}++func reverse(a []interface{}) {+ for i := 0; i < len(a)/2; i++ {+ a[i], a[len(a)-i-1] = a[len(a)-i-1], a[i]+ }+}diff --git a/vendor/github.com/stripe/stripe-go/loginlink.go b/vendor/github.com/stripe/stripe-go/loginlink.gonew file mode 100644index 000000000..59e018068--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/loginlink.go@@ -0,0 +1,15 @@+package stripe++// LoginLinkParams is the set of parameters that can be used when creating a login_link.+// For more details see https://stripe.com/docs/api#create_login_link.+type LoginLinkParams struct {+ Params `form:"*"`+ Account *string `form:"-"` // Included in URL+}++// LoginLink is the resource representing a login link for Express accounts.+// For more details see https://stripe.com/docs/api#login_link_object+type LoginLink struct {+ Created int64 `json:"created"`+ URL string `json:"url"`+}diff --git a/vendor/github.com/stripe/stripe-go/loginlink/client.go b/vendor/github.com/stripe/stripe-go/loginlink/client.gonew file mode 100644index 000000000..fa602a135--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/loginlink/client.go@@ -0,0 +1,36 @@+// Package loginlink provides the /login_links APIs+package loginlink++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke /login_links APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a login link for an account.+func New(params *stripe.LoginLinkParams) (*stripe.LoginLink, error) {+ return getC().New(params)+}++// New creates a login link for an account.+func (c Client) New(params *stripe.LoginLinkParams) (*stripe.LoginLink, error) {+ if params.Account == nil {+ return nil, errors.New("Invalid login link params: Account must be set")+ }++ path := stripe.FormatURLPath("/v1/accounts/%s/login_links", stripe.StringValue(params.Account))+ loginLink := &stripe.LoginLink{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, loginLink)+ return loginLink, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/order.go b/vendor/github.com/stripe/stripe-go/order.gonew file mode 100644index 000000000..79e609a6c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/order.go@@ -0,0 +1,276 @@+package stripe++import (+ "encoding/json"+)++// OrderStatus represents the statuses of an order object.+type OrderStatus string++// List of values that OrderStatus can take.+const (+ OrderStatusCanceled OrderStatus = "canceled"+ OrderStatusCreated OrderStatus = "created"+ OrderStatusFulfilled OrderStatus = "fulfilled"+ OrderStatusPaid OrderStatus = "paid"+ OrderStatusReturned OrderStatus = "returned"+)++// OrderDeliveryEstimateType represents the type of delivery estimate for shipping methods+type OrderDeliveryEstimateType string++// List of values that OrderDeliveryEstimateType can take.+const (+ OrderDeliveryEstimateTypeExact OrderDeliveryEstimateType = "exact"+ OrderDeliveryEstimateTypeRange OrderDeliveryEstimateType = "range"+)++// OrderItemType represents the type of order item+type OrderItemType string++// List of values that OrderItemType can take.+const (+ OrderItemTypeCoupon OrderItemType = "coupon"+ OrderItemTypeDiscount OrderItemType = "discount"+ OrderItemTypeSKU OrderItemType = "sku"+ OrderItemTypeShipping OrderItemType = "shipping"+ OrderItemTypeTax OrderItemType = "tax"+)++// OrderItemParentType represents the type of order item parent+type OrderItemParentType string++// List of values that OrderItemParentType can take.+const (+ OrderItemParentTypeCoupon OrderItemParentType = "coupon"+ OrderItemParentTypeDiscount OrderItemParentType = "discount"+ OrderItemParentTypeSKU OrderItemParentType = "sku"+ OrderItemParentTypeShipping OrderItemParentType = "shipping"+ OrderItemParentTypeTax OrderItemParentType = "tax"+)++// OrderItemParent describes the parent of an order item.+type OrderItemParent struct {+ ID string `json:"id"`+ SKU *SKU `json:"-"`+ Type OrderItemParentType `json:"object"`+}++// OrderParams is the set of parameters that can be used when creating an order.+type OrderParams struct {+ Params `form:"*"`+ Coupon *string `form:"coupon"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ Email *string `form:"email"`+ Items []*OrderItemParams `form:"items"`+ Shipping *ShippingParams `form:"shipping"`+}++// ShippingParams is the set of parameters that can be used for the shipping hash+// on order creation.+type ShippingParams struct {+ Address *AddressParams `form:"address"`+ Name *string `form:"name"`+ Phone *string `form:"phone"`+}++// OrderUpdateParams is the set of parameters that can be used when updating an order.+type OrderUpdateParams struct {+ Params `form:"*"`+ Coupon *string `form:"coupon"`+ SelectedShippingMethod *string `form:"selected_shipping_method"`+ Shipping *OrderUpdateShippingParams `form:"shipping"`+ Status *string `form:"status"`+}++// OrderUpdateShippingParams is the set of parameters that can be used for the shipping+// hash on order update.+type OrderUpdateShippingParams struct {+ Carrier *string `form:"carrier"`+ TrackingNumber *string `form:"tracking_number"`+}++// OrderReturnParams is the set of parameters that can be used when returning orders.+type OrderReturnParams struct {+ Params `form:"*"`+ Items []*OrderItemParams `form:"items"`+}++// Shipping describes the shipping hash on an order.+type Shipping struct {+ Address *Address `json:"address"`+ Carrier string `json:"carrier"`+ Name string `json:"name"`+ Phone string `json:"phone"`+ TrackingNumber string `json:"tracking_number"`+}++// ShippingMethod describes a shipping method as available on an order.+type ShippingMethod struct {+ Amount int64 `json:"amount"`+ ID string `json:"id"`+ Currency Currency `json:"currency"`+ DeliveryEstimate *DeliveryEstimate `json:"delivery_estimate"`+ Description string `json:"description"`+}++// DeliveryEstimate represent the properties available for a shipping method's+// estimated delivery.+type DeliveryEstimate struct {+ // If Type == Exact+ Date string `json:"date"`+ // If Type == Range+ Earliest string `json:"earliest"`+ Latest string `json:"latest"`+ Type OrderDeliveryEstimateType `json:"type"`+}++// Order is the resource representing a Stripe charge.+// For more details see https://stripe.com/docs/api#orders.+type Order struct {+ Amount int64 `json:"amount"`+ AmountReturned int64 `json:"amount_returned"`+ Application string `json:"application"`+ ApplicationFee int64 `json:"application_fee"`+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Customer Customer `json:"customer"`+ Email string `json:"email"`+ ID string `json:"id"`+ Items []*OrderItem `json:"items"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Returns *OrderReturnList `json:"returns"`+ SelectedShippingMethod *string `json:"selected_shipping_method"`+ Shipping *Shipping `json:"shipping"`+ ShippingMethods []*ShippingMethod `json:"shipping_methods"`+ Status string `json:"status"`+ StatusTransitions StatusTransitions `json:"status_transitions"`+ Updated int64 `json:"updated"`+}++// OrderList is a list of orders as retrieved from a list endpoint.+type OrderList struct {+ ListMeta+ Data []*Order `json:"data"`+}++// OrderListParams is the set of parameters that can be used when listing orders.+type OrderListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Customer *string `form:"customer"`+ IDs []*string `form:"ids"`+ Status *string `form:"status"`+ StatusTransitions *StatusTransitionsFilterParams `form:"status_transitions"`+}++// StatusTransitionsFilterParams are parameters that can used to filter on status_transition when listing orders.+type StatusTransitionsFilterParams struct {+ Canceled *int64 `form:"canceled"`+ CanceledRange *RangeQueryParams `form:"canceled"`+ Fulfilled *int64 `form:"fulfilled"`+ FulfilledRange *RangeQueryParams `form:"fulfilled"`+ Paid *int64 `form:"paid"`+ PaidRange *RangeQueryParams `form:"paid"`+ Returned *int64 `form:"returned"`+ ReturnedRange *RangeQueryParams `form:"returned"`+}++// StatusTransitions are the timestamps at which the order status was updated.+type StatusTransitions struct {+ Canceled int64 `json:"canceled"`+ Fulfilled int64 `json:"fulfiled"`+ Paid int64 `json:"paid"`+ Returned int64 `json:"returned"`+}++// OrderPayParams is the set of parameters that can be used when paying orders.+type OrderPayParams struct {+ Params `form:"*"`+ ApplicationFee *int64 `form:"application_fee"`+ Customer *string `form:"customer"`+ Email *string `form:"email"`+ Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"+}++// OrderItemParams is the set of parameters describing an order item on order creation or update.+type OrderItemParams struct {+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Description *string `form:"description"`+ Parent *string `form:"parent"`+ Quantity *int64 `form:"quantity"`+ Type *string `form:"type"`+}++// OrderItem is the resource representing an order item.+type OrderItem struct {+ Amount int64 `json:"amount"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ Parent *OrderItemParent `json:"parent"`+ Quantity int64 `json:"quantity"`+ Type OrderItemType `json:"type"`+}++// SetSource adds valid sources to a OrderParams object,+// returning an error for unsupported sources.+func (op *OrderPayParams) SetSource(sp interface{}) error {+ source, err := SourceParamsFor(sp)+ op.Source = source+ return err+}++// UnmarshalJSON handles deserialization of an OrderItemParent.+// This custom unmarshaling is needed because the resulting+// property may be an id or a full SKU struct if it was expanded.+func (p *OrderItemParent) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ p.ID = id+ return nil+ }++ type orderItemParent OrderItemParent+ var v orderItemParent+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *p = OrderItemParent(v)++ switch p.Type {+ case OrderItemParentTypeSKU:+ // Currently only SKUs `parent` is returned as an object when expanded.+ // For other items only IDs are returned.+ if err = json.Unmarshal(data, &p.SKU); err != nil {+ return err+ }+ p.ID = p.SKU.ID+ }++ return nil+}++// UnmarshalJSON handles deserialization of an Order.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (o *Order) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ o.ID = id+ return nil+ }++ type order Order+ var v order+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *o = Order(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/order/client.go b/vendor/github.com/stripe/stripe-go/order/client.gonew file mode 100644index 000000000..12d822417--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/order/client.go@@ -0,0 +1,111 @@+package order++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /orders APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new order.+func New(params *stripe.OrderParams) (*stripe.Order, error) {+ return getC().New(params)+}++// New creates a new order.+func (c Client) New(params *stripe.OrderParams) (*stripe.Order, error) {+ p := &stripe.Order{}+ err := c.B.Call(http.MethodPost, "/v1/orders", c.Key, params, p)+ return p, err+}++// Update updates an order's properties.+func Update(id string, params *stripe.OrderUpdateParams) (*stripe.Order, error) {+ return getC().Update(id, params)+}++// Update updates an order's properties.+func (c Client) Update(id string, params *stripe.OrderUpdateParams) (*stripe.Order, error) {+ path := stripe.FormatURLPath("/v1/orders/%s", id)+ o := &stripe.Order{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, o)+ return o, err+}++// Pay pays an order.+func Pay(id string, params *stripe.OrderPayParams) (*stripe.Order, error) {+ return getC().Pay(id, params)+}++// Pay pays an order.+func (c Client) Pay(id string, params *stripe.OrderPayParams) (*stripe.Order, error) {+ path := stripe.FormatURLPath("/v1/orders/%s/pay", id)+ o := &stripe.Order{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, o)+ return o, err+}++// Get returns the details of an order.+func Get(id string, params *stripe.OrderParams) (*stripe.Order, error) {+ return getC().Get(id, params)+}++// Get returns the details of an order.+func (c Client) Get(id string, params *stripe.OrderParams) (*stripe.Order, error) {+ path := stripe.FormatURLPath("/v1/orders/%s", id)+ order := &stripe.Order{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, order)+ return order, err+}++// List returns a list of orders.+func List(params *stripe.OrderListParams) *Iter {+ return getC().List(params)+}++// List returns a list of orders.+func (c Client) List(listParams *stripe.OrderListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.OrderList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/orders", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Return returns all or part of an order.+func Return(id string, params *stripe.OrderReturnParams) (*stripe.OrderReturn, error) {+ return getC().Return(id, params)+}++// Return returns all or part of an order.+func (c Client) Return(id string, params *stripe.OrderReturnParams) (*stripe.OrderReturn, error) {+ path := stripe.FormatURLPath("/v1/orders/%s/returns", id)+ ret := &stripe.OrderReturn{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, ret)+ return ret, err+}++// Iter is an iterator for orders.+type Iter struct {+ *stripe.Iter+}++// Order returns the order which the iterator is currently pointing to.+func (i *Iter) Order() *stripe.Order {+ return i.Current().(*stripe.Order)+}+func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/orderreturn.go b/vendor/github.com/stripe/stripe-go/orderreturn.gonew file mode 100644index 000000000..61aba4510--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/orderreturn.go@@ -0,0 +1,49 @@+package stripe++import "encoding/json"++// OrderReturn is the resource representing an order return.+// For more details see https://stripe.com/docs/api#order_returns.+type OrderReturn struct {+ Amount int64 `json:"amount"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ ID string `json:"id"`+ Items []*OrderItem `json:"items"`+ Livemode bool `json:"livemode"`+ Order *Order `json:"order"`+ Refund *Refund `json:"refund"`+}++// OrderReturnList is a list of order returns as retrieved from a list endpoint.+type OrderReturnList struct {+ ListMeta+ Data []*OrderReturn `json:"data"`+}++// OrderReturnListParams is the set of parameters that can be used when listing order returns.+type OrderReturnListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Order *string `form:"order"`+}++// UnmarshalJSON handles deserialization of an OrderReturn.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *OrderReturn) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type orderReturn OrderReturn+ var v orderReturn+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = OrderReturn(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/orderreturn/client.go b/vendor/github.com/stripe/stripe-go/orderreturn/client.gonew file mode 100644index 000000000..b6c13f852--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/orderreturn/client.go@@ -0,0 +1,48 @@+package orderreturn++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /orders APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// List returns a list of order returns.+func List(params *stripe.OrderReturnListParams) *Iter {+ return getC().List(params)+}++// List returns a list of order returns.+func (c Client) List(listParams *stripe.OrderReturnListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.OrderReturnList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/order_returns", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for order returns.+type Iter struct {+ *stripe.Iter+}++// OrderReturn returns the order return which the iterator is currently pointing to.+func (i *Iter) OrderReturn() *stripe.OrderReturn {+ return i.Current().(*stripe.OrderReturn)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/params.go b/vendor/github.com/stripe/stripe-go/params.gonew file mode 100644index 000000000..dd782ece7--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/params.go@@ -0,0 +1,269 @@+package stripe++import (+ "context"+ "crypto/rand"+ "encoding/base64"+ "fmt"+ "net/http"+ "net/url"+ "time"++ "github.com/stripe/stripe-go/form"+)++//+// Public constants+//++// Contains constants for the names of parameters used for pagination in list APIs.+const (+ EndingBefore = "ending_before"+ StartingAfter = "starting_after"+)++//+// Public types+//++// ExtraValues are extra parameters that are attached to an API request.+// They're implemented as a custom type so that they can have their own+// AppendTo implementation.+type ExtraValues struct {+ url.Values `form:"-"` // See custom AppendTo implementation+}++// AppendTo implements custom form encoding for extra parameter values.+func (v ExtraValues) AppendTo(body *form.Values, keyParts []string) {+ for k, vs := range v.Values {+ for _, v := range vs {+ body.Add(form.FormatKey(append(keyParts, k)), v)+ }+ }+}++// Filters is a structure that contains a collection of filters for list-related APIs.+type Filters struct {+ f []*filter `form:"-"` // See custom AppendTo implementation+}++// AddFilter adds a new filter with a given key, op and value.+func (f *Filters) AddFilter(key, op, value string) {+ filter := &filter{Key: key, Op: op, Val: value}+ f.f = append(f.f, filter)+}++// AppendTo implements custom form encoding for filters.+func (f Filters) AppendTo(body *form.Values, keyParts []string) {+ if len(f.f) > 0 {+ for _, v := range f.f {+ if len(v.Op) > 0 {+ body.Add(form.FormatKey(append(keyParts, v.Key, v.Op)), v.Val)+ } else {+ body.Add(form.FormatKey(append(keyParts, v.Key)), v.Val)+ }+ }+ }+}++// ListMeta is the structure that contains the common properties+// of List iterators. The Count property is only populated if the+// total_count include option is passed in (see tests for example).+type ListMeta struct {+ HasMore bool `json:"has_more"`+ TotalCount uint32 `json:"total_count"`+ URL string `json:"url"`+}++// ListParams is the structure that contains the common properties+// of any *ListParams structure.+type ListParams struct {+ // Context used for request. It may carry deadlines, cancelation signals,+ // and other request-scoped values across API boundaries and between+ // processes.+ //+ // Note that a cancelled or timed out context does not provide any+ // guarantee whether the operation was or was not completed on Stripe's API+ // servers. For certainty, you must either retry with the same idempotency+ // key or query the state of the API.+ Context context.Context `form:"-"`++ EndingBefore *string `form:"ending_before"`+ Expand []*string `form:"expand"`+ Filters Filters `form:"*"`+ Limit *int64 `form:"limit"`++ // Single specifies whether this is a single page iterator. By default,+ // listing through an iterator will automatically grab additional pages as+ // the query progresses. To change this behavior and just load a single+ // page, set this to true.+ Single bool `form:"-"` // Not an API parameter++ StartingAfter *string `form:"starting_after"`++ // StripeAccount may contain the ID of a connected account. By including+ // this field, the request is made as if it originated from the connected+ // account instead of under the account of the owner of the configured+ // Stripe key.+ StripeAccount *string `form:"-"` // Passed as header+}++// AddExpand appends a new field to expand.+func (p *ListParams) AddExpand(f string) {+ p.Expand = append(p.Expand, &f)+}++// GetListParams returns a ListParams struct (itself). It exists because any+// structs that embed ListParams will inherit it, and thus implement the+// ListParamsContainer interface.+func (p *ListParams) GetListParams() *ListParams {+ return p+}++// GetParams returns ListParams as a Params struct. It exists because any+// structs that embed Params will inherit it, and thus implement the+// ParamsContainer interface.+func (p *ListParams) GetParams() *Params {+ return p.ToParams()+}++// SetStripeAccount sets a value for the Stripe-Account header.+func (p *ListParams) SetStripeAccount(val string) {+ p.StripeAccount = &val+}++// ToParams converts a ListParams to a Params by moving over any fields that+// have valid targets in the new type. This is useful because fields in+// Params can be injected directly into an http.Request while generally+// ListParams is only used to build a set of parameters.+func (p *ListParams) ToParams() *Params {+ return &Params{+ Context: p.Context,+ StripeAccount: p.StripeAccount,+ }+}++// ListParamsContainer is a general interface for which all list parameter+// structs should comply. They achieve this by embedding a ListParams struct+// and inheriting its implementation of this interface.+type ListParamsContainer interface {+ GetListParams() *ListParams+}++// Params is the structure that contains the common properties+// of any *Params structure.+type Params struct {+ // Context used for request. It may carry deadlines, cancelation signals,+ // and other request-scoped values across API boundaries and between+ // processes.+ //+ // Note that a cancelled or timed out context does not provide any+ // guarantee whether the operation was or was not completed on Stripe's API+ // servers. For certainty, you must either retry with the same idempotency+ // key or query the state of the API.+ Context context.Context `form:"-"`++ Expand []*string `form:"expand"`+ Extra *ExtraValues `form:"*"`++ // Headers may be used to provide extra header lines on the HTTP request.+ Headers http.Header `form:"-"`++ IdempotencyKey *string `form:"-"` // Passed as header+ Metadata map[string]string `form:"metadata"`++ // StripeAccount may contain the ID of a connected account. By including+ // this field, the request is made as if it originated from the connected+ // account instead of under the account of the owner of the configured+ // Stripe key.+ StripeAccount *string `form:"-"` // Passed as header+}++// AddExpand appends a new field to expand.+func (p *Params) AddExpand(f string) {+ p.Expand = append(p.Expand, &f)+}++// AddExtra adds a new arbitrary key-value pair to the request data+func (p *Params) AddExtra(key, value string) {+ if p.Extra == nil {+ p.Extra = &ExtraValues{Values: make(url.Values)}+ }++ p.Extra.Add(key, value)+}++// AddMetadata adds a new key-value pair to the Metadata.+func (p *Params) AddMetadata(key, value string) {+ if p.Metadata == nil {+ p.Metadata = make(map[string]string)+ }++ p.Metadata[key] = value+}++// GetParams returns a Params struct (itself). It exists because any structs+// that embed Params will inherit it, and thus implement the ParamsContainer+// interface.+func (p *Params) GetParams() *Params {+ return p+}++// SetIdempotencyKey sets a value for the Idempotency-Key header.+func (p *Params) SetIdempotencyKey(val string) {+ p.IdempotencyKey = &val+}++// SetStripeAccount sets a value for the Stripe-Account header.+func (p *Params) SetStripeAccount(val string) {+ p.StripeAccount = &val+}++// ParamsContainer is a general interface for which all parameter structs+// should comply. They achieve this by embedding a Params struct and inheriting+// its implementation of this interface.+type ParamsContainer interface {+ GetParams() *Params+}++// RangeQueryParams are a set of generic request parameters that are used on+// list endpoints to filter their results by some timestamp.+type RangeQueryParams struct {+ // GreaterThan specifies that values should be a greater than this+ // timestamp.+ GreaterThan int64 `form:"gt"`++ // GreaterThanOrEqual specifies that values should be greater than or equal+ // to this timestamp.+ GreaterThanOrEqual int64 `form:"gte"`++ // LesserThan specifies that values should be lesser than this timetamp.+ LesserThan int64 `form:"lt"`++ // LesserThanOrEqual specifies that values should be lesser than or+ // equalthis timetamp.+ LesserThanOrEqual int64 `form:"lte"`+}++//+// Public functions+//++// NewIdempotencyKey generates a new idempotency key that+// can be used on a request.+func NewIdempotencyKey() string {+ now := time.Now().UnixNano()+ buf := make([]byte, 4)+ rand.Read(buf)+ return fmt.Sprintf("%v_%v", now, base64.URLEncoding.EncodeToString(buf)[:6])+}++//+// Private types+//++// filter is the structure that contains a filter for list-related APIs.+// It ends up passing query string parameters in the format key[op]=value.+type filter struct {+ Key, Op, Val string+}diff --git a/vendor/github.com/stripe/stripe-go/paymentintent.go b/vendor/github.com/stripe/stripe-go/paymentintent.gonew file mode 100644index 000000000..23f44bb45--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/paymentintent.go@@ -0,0 +1,203 @@+package stripe++import (+ "encoding/json"+)++// PaymentIntentCancellationReason is the list of allowed values for the cancelation reason.+type PaymentIntentCancellationReason string++// List of values that PaymentIntentCaptureMethod can take.+const (+ PaymentIntentCancellationReasonDuplicate PaymentIntentCancellationReason = "duplicate"+ PaymentIntentCancellationReasonFraudulent PaymentIntentCancellationReason = "fraudulent"+ PaymentIntentCancellationReasonRequestedByCustomer PaymentIntentCancellationReason = "requested_by_customer"+)++// PaymentIntentCaptureMethod is the list of allowed values for the capture method.+type PaymentIntentCaptureMethod string++// List of values that PaymentIntentCaptureMethod can take.+const (+ PaymentIntentCaptureMethodAutomatic PaymentIntentCaptureMethod = "automatic"+ PaymentIntentCaptureMethodManual PaymentIntentCaptureMethod = "manual"+)++// PaymentIntentConfirmationMethod is the list of allowed values for the confirmation method.+type PaymentIntentConfirmationMethod string++// List of values that PaymentIntentConfirmationMethod can take.+const (+ PaymentIntentConfirmationMethodPublishable PaymentIntentConfirmationMethod = "publishable"+ PaymentIntentConfirmationMethodSecret PaymentIntentConfirmationMethod = "secret"+)++// PaymentIntentNextActionType is the list of allowed values for the next action's type.+type PaymentIntentNextActionType string++// List of values that PaymentIntentNextActionType can take.+const (+ PaymentIntentNextActionAuthorizeWithURL PaymentIntentNextActionType = "authorize_with_url"+)++// PaymentIntentStatus is the list of allowed values for the payment intent's status.+type PaymentIntentStatus string++// List of values that PaymentIntentStatus can take.+const (+ PaymentIntentStatusCanceled PaymentIntentStatus = "canceled"+ PaymentIntentStatusProcessing PaymentIntentStatus = "processing"+ PaymentIntentStatusRequiresCapture PaymentIntentStatus = "requires_capture"+ PaymentIntentStatusRequiresConfirmation PaymentIntentStatus = "requires_confirmation"+ PaymentIntentStatusRequiresSource PaymentIntentStatus = "requires_source"+ PaymentIntentStatusRequiresSourceAction PaymentIntentStatus = "requires_source_action"+ PaymentIntentStatusSucceeded PaymentIntentStatus = "succeeded"+)++// PaymentIntentCancelParams is the set of parameters that can be used when canceling a payment intent.+type PaymentIntentCancelParams struct {+ Params `form:"*"`+ CancellationReason *string `form:"cancellation_reason"`+}++// PaymentIntentCaptureParams is the set of parameters that can be used when capturing a payment intent.+type PaymentIntentCaptureParams struct {+ Params `form:"*"`+ AmountToCapture *int64 `form:"amount_to_capture"`+ ApplicationFeeAmount *int64 `form:"application_fee_amount"`+ TransferData *PaymentIntentTransferDataParams `form:"transfer_data"`+}++// PaymentIntentConfirmParams is the set of parameters that can be used when confirming a payment intent.+type PaymentIntentConfirmParams struct {+ Params `form:"*"`+ ReceiptEmail *string `form:"receipt_email"`+ ReturnURL *string `form:"return_url"`+ SaveSourceToCustomer *bool `form:"save_source_to_customer"`+ Shipping *ShippingDetailsParams `form:"shipping"`+ Source *string `form:"source"`+}++// PaymentIntentTransferDataParams is the set of parameters allowed for the transfer hash.+type PaymentIntentTransferDataParams struct {+ Amount *int64 `form:"amount"`+ Destination *string `form:"destination"`+}++// PaymentIntentParams is the set of parameters that can be used when handling a payment intent.+type PaymentIntentParams struct {+ Params `form:"*"`+ AllowedSourceTypes []*string `form:"allowed_source_types"`+ Amount *int64 `form:"amount"`+ ApplicationFeeAmount *int64 `form:"application_fee_amount"`+ Confirm *bool `form:"confirm"`+ CaptureMethod *string `form:"capture_method"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ Description *string `form:"description"`+ OnBehalfOf *string `form:"on_behalf_of"`+ ReceiptEmail *string `form:"receipt_email"`+ ReturnURL *string `form:"return_url"`+ SaveSourceToCustomer *bool `form:"save_source_to_customer"`+ Shipping *ShippingDetailsParams `form:"shipping"`+ Source *string `form:"source"`+ StatementDescriptor *string `form:"statement_descriptor"`+ TransferData *PaymentIntentTransferDataParams `form:"transfer_data"`+ TransferGroup *string `form:"transfer_group"`+}++// PaymentIntentListParams is the set of parameters that can be used when listing payment intents.+// For more details see https://stripe.com/docs/api#list_payouts.+type PaymentIntentListParams struct {+ ListParams `form:"*"`+}++// PaymentIntentLastPaymentError represents the last error happening on a payment intent.+type PaymentIntentLastPaymentError struct {+ Charge string `json:"charge"`+ Code string `json:"code"`+ DeclineCode string `json:"decline_code"`+ DocURL string `json:"doc_url"`+ Message string `json:"message"`+ Param string `json:"param"`+ Source *PaymentSource `json:"source"`+ Type ErrorType `json:"type"`+}++// PaymentIntentSourceActionAuthorizeWithURL represents the resource for the next action of type+// "authorize_with_url".+type PaymentIntentSourceActionAuthorizeWithURL struct {+ ReturnURL string `json:"return_url"`+ URL string `json:"url"`+}++// PaymentIntentSourceAction represents the type of action to take on a payment intent.+type PaymentIntentSourceAction struct {+ AuthorizeWithURL *PaymentIntentSourceActionAuthorizeWithURL `json:"authorize_with_url"`+ Type PaymentIntentNextActionType `json:"type"`+}++// PaymentIntentTransferData represents the information for the transfer associated with a payment intent.+type PaymentIntentTransferData struct {+ Amount int64 `json:"amount"`+ Destination *Account `json:"destination"`+}++// PaymentIntent is the resource representing a Stripe payout.+// For more details see https://stripe.com/docs/api#payment_intents.+type PaymentIntent struct {+ AllowedSourceTypes []string `json:"allowed_source_types"`+ Amount int64 `json:"amount"`+ AmountCapturable int64 `json:"amount_capturable"`+ AmountReceived int64 `json:"amount_received"`+ Application *Application `json:"application"`+ ApplicationFee int64 `json:"application_fee"`+ CanceledAt int64 `json:"canceled_at"`+ CaptureMethod PaymentIntentCaptureMethod `json:"capture_method"`+ Charges *ChargeList `json:"charges"`+ ClientSecret string `json:"client_secret"`+ ConfirmationMethod PaymentIntentConfirmationMethod `json:"confirmation_method"`+ Created int64 `json:"created"`+ Currency string `json:"currency"`+ Customer *Customer `json:"customer"`+ Description string `json:"description"`+ LastPaymentError *PaymentIntentLastPaymentError `json:"last_payment_error"`+ Livemode bool `json:"livemode"`+ ID string `json:"id"`+ Metadata map[string]string `json:"metadata"`+ NextSourceAction *PaymentIntentSourceAction `json:"next_source_action"`+ OnBehalfOf *Account `json:"on_behalf_of"`+ ReceiptEmail string `json:"receipt_email"`+ Review *Review `json:"review"`+ Shipping ShippingDetails `json:"shipping"`+ Source *PaymentSource `json:"source"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status PaymentIntentStatus `json:"status"`+ TransferData *PaymentIntentTransferData `json:"transfer_data"`+ TransferGroup string `json:"transfer_group"`+}++// PaymentIntentList is a list of payment intents as retrieved from a list endpoint.+type PaymentIntentList struct {+ ListMeta+ Data []*PaymentIntent `json:"data"`+}++// UnmarshalJSON handles deserialization of a Payment Intent.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (p *PaymentIntent) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ p.ID = id+ return nil+ }++ type paymentintent PaymentIntent+ var v paymentintent+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *p = PaymentIntent(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/paymentintent/client.go b/vendor/github.com/stripe/stripe-go/paymentintent/client.gonew file mode 100644index 000000000..f428f2ef7--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/paymentintent/client.go@@ -0,0 +1,128 @@+// Package paymentintent provides API functions related to payment intents.+//+// For more details, see: https://stripe.com/docs/api/go#payment_intents.+package paymentintent++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke APIs related to payment intents.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a payment intent.+func New(params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ return getC().New(params)+}++// New creates a payment intent.+func (c Client) New(params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodPost, "/v1/payment_intents", c.Key, params, intent)+ return intent, err+}++// Get retrieves a payment intent.+func Get(id string, params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ return getC().Get(id, params)+}++// Get retrieves a payment intent.+func (c Client) Get(id string, params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ path := stripe.FormatURLPath("/v1/payment_intents/%s", id)+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, intent)+ return intent, err+}++// Update updates a payment intent.+func Update(id string, params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ return getC().Update(id, params)+}++// Update updates a payment intent.+func (c Client) Update(id string, params *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {+ path := stripe.FormatURLPath("/v1/payment_intents/%s", id)+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, intent)+ return intent, err+}++// Cancel cancels a payment intent.+func Cancel(id string, params *stripe.PaymentIntentCancelParams) (*stripe.PaymentIntent, error) {+ return getC().Cancel(id, params)+}++// Cancel cancels a payment intent.+func (c Client) Cancel(id string, params *stripe.PaymentIntentCancelParams) (*stripe.PaymentIntent, error) {+ path := stripe.FormatURLPath("/v1/payment_intents/%s/cancel", id)+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, intent)+ return intent, err+}++// Capture captures a payment intent.+func Capture(id string, params *stripe.PaymentIntentCaptureParams) (*stripe.PaymentIntent, error) {+ return getC().Capture(id, params)+}++// Capture captures a payment intent.+func (c Client) Capture(id string, params *stripe.PaymentIntentCaptureParams) (*stripe.PaymentIntent, error) {+ path := stripe.FormatURLPath("/v1/payment_intents/%s/capture", id)+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, intent)+ return intent, err+}++// Confirm confirms a payment intent.+func Confirm(id string, params *stripe.PaymentIntentConfirmParams) (*stripe.PaymentIntent, error) {+ return getC().Confirm(id, params)+}++// Confirm confirms a payment intent.+func (c Client) Confirm(id string, params *stripe.PaymentIntentConfirmParams) (*stripe.PaymentIntent, error) {+ path := stripe.FormatURLPath("/v1/payment_intents/%s/confirm", id)+ intent := &stripe.PaymentIntent{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, intent)+ return intent, err+}++// List returns a list of payment intents.+func List(params *stripe.PaymentIntentListParams) *Iter {+ return getC().List(params)+}++// List returns a list of payment intents.+func (c Client) List(listParams *stripe.PaymentIntentListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.PaymentIntentList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/payment_intents", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for payment intents.+type Iter struct {+ *stripe.Iter+}++// PaymentIntent returns the payment intent which the iterator is currently pointing to.+func (i *Iter) PaymentIntent() *stripe.PaymentIntent {+ return i.Current().(*stripe.PaymentIntent)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/paymentsource.go b/vendor/github.com/stripe/stripe-go/paymentsource.gonew file mode 100644index 000000000..4f592948b--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/paymentsource.go@@ -0,0 +1,202 @@+package stripe++import (+ "encoding/json"+ "fmt"++ "github.com/stripe/stripe-go/form"+)++// PaymentSourceType consts represent valid payment sources.+type PaymentSourceType string++// List of values that PaymentSourceType can take.+const (+ PaymentSourceTypeAccount PaymentSourceType = "account"+ PaymentSourceTypeBankAccount PaymentSourceType = "bank_account"+ PaymentSourceTypeBitcoinReceiver PaymentSourceType = "bitcoin_receiver"+ PaymentSourceTypeCard PaymentSourceType = "card"+ PaymentSourceTypeObject PaymentSourceType = "source"+)++// SourceParams is a union struct used to describe an+// arbitrary payment source.+type SourceParams struct {+ Card *CardParams `form:"-"`+ Token *string `form:"source"`+}++// AppendTo implements custom encoding logic for SourceParams.+func (p *SourceParams) AppendTo(body *form.Values, keyParts []string) {+ if p.Card != nil {+ p.Card.AppendToAsCardSourceOrExternalAccount(body, keyParts)+ }+}++// CustomerSourceParams are used to manipulate a given Stripe+// Customer object's payment sources.+// For more details see https://stripe.com/docs/api#sources+type CustomerSourceParams struct {+ Params `form:"*"`+ Customer *string `form:"-"` // Goes in the URL+ Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"+}++// SourceVerifyParams are used to verify a customer source+// For more details see https://stripe.com/docs/guides/ach-beta+type SourceVerifyParams struct {+ Params `form:"*"`+ Amounts [2]int64 `form:"amounts"` // Amounts is used when verifying bank accounts+ Customer *string `form:"-"` // Goes in the URL+ Values []*string `form:"values"` // Values is used when verifying sources+}++// SetSource adds valid sources to a CustomerSourceParams object,+// returning an error for unsupported sources.+func (cp *CustomerSourceParams) SetSource(sp interface{}) error {+ source, err := SourceParamsFor(sp)+ cp.Source = source+ return err+}++// SourceParamsFor creates SourceParams objects around supported+// payment sources, returning errors if not.+//+// Currently supported source types are Card (CardParams) and+// Tokens/IDs (string), where Tokens could be single use card+// tokens or bitcoin receiver ids+func SourceParamsFor(obj interface{}) (*SourceParams, error) {+ var sp *SourceParams+ var err error+ switch p := obj.(type) {+ case *CardParams:+ sp = &SourceParams{+ Card: p,+ }+ case string:+ sp = &SourceParams{+ Token: &p,+ }+ default:+ err = fmt.Errorf("Unsupported source type %s", p)+ }+ return sp, err+}++// PaymentSource describes the payment source used to make a Charge.+// The Type should indicate which object is fleshed out (eg. BitcoinReceiver or Card)+// For more details see https://stripe.com/docs/api#retrieve_charge+type PaymentSource struct {+ BankAccount *BankAccount `json:"-"`+ BitcoinReceiver *BitcoinReceiver `json:"-"`+ Card *Card `json:"-"`+ Deleted bool `json:"deleted"`+ ID string `json:"id"`+ SourceObject *Source `json:"-"`+ Type PaymentSourceType `json:"object"`+}++// SourceList is a list object for cards.+type SourceList struct {+ ListMeta+ Data []*PaymentSource `json:"data"`+}++// SourceListParams are used to enumerate the payment sources that are attached+// to a Customer.+type SourceListParams struct {+ ListParams `form:"*"`+ Customer *string `form:"-"` // Handled in URL+}++// UnmarshalJSON handles deserialization of a PaymentSource.+// This custom unmarshaling is needed because the specific+// type of payment instrument it refers to is specified in the JSON+func (s *PaymentSource) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ s.ID = id+ return nil+ }++ type paymentSource PaymentSource+ var v paymentSource+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *s = PaymentSource(v)++ switch s.Type {+ case PaymentSourceTypeBankAccount:+ err = json.Unmarshal(data, &s.BankAccount)+ case PaymentSourceTypeBitcoinReceiver:+ err = json.Unmarshal(data, &s.BitcoinReceiver)+ case PaymentSourceTypeCard:+ err = json.Unmarshal(data, &s.Card)+ case PaymentSourceTypeObject:+ err = json.Unmarshal(data, &s.SourceObject)+ }++ return err+}++// MarshalJSON handles serialization of a PaymentSource.+// This custom marshaling is needed because the specific type+// of payment instrument it represents is specified by the Type+func (s *PaymentSource) MarshalJSON() ([]byte, error) {+ var target interface{}++ switch s.Type {+ case PaymentSourceTypeBitcoinReceiver:+ target = struct {+ *BitcoinReceiver+ Type PaymentSourceType `json:"object"`+ }{+ BitcoinReceiver: s.BitcoinReceiver,+ Type: s.Type,+ }+ case PaymentSourceTypeCard:+ var customerID *string+ if s.Card.Customer != nil {+ customerID = &s.Card.Customer.ID+ }++ target = struct {+ *Card+ Customer *string `json:"customer"`+ Type PaymentSourceType `json:"object"`+ }{+ Card: s.Card,+ Customer: customerID,+ Type: s.Type,+ }+ case PaymentSourceTypeAccount:+ target = struct {+ ID string `json:"id"`+ Type PaymentSourceType `json:"object"`+ }{+ ID: s.ID,+ Type: s.Type,+ }+ case PaymentSourceTypeBankAccount:+ var customerID *string+ if s.BankAccount.Customer != nil {+ customerID = &s.BankAccount.Customer.ID+ }++ target = struct {+ *BankAccount+ Customer *string `json:"customer"`+ Type PaymentSourceType `json:"object"`+ }{+ BankAccount: s.BankAccount,+ Customer: customerID,+ Type: s.Type,+ }+ case "":+ target = s.ID+ }++ return json.Marshal(target)+}diff --git a/vendor/github.com/stripe/stripe-go/paymentsource/client.go b/vendor/github.com/stripe/stripe-go/paymentsource/client.gonew file mode 100644index 000000000..55d710045--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/paymentsource/client.go@@ -0,0 +1,177 @@+// Package paymentsource provides the /sources APIs+package paymentsource++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /sources APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new source for a customer.+func New(params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ return getC().New(params)+}++// New creates a new source for a customer.+func (s Client) New(params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ if params.Customer == nil {+ return nil, errors.New("Invalid source params: customer needs to be set")+ }++ path := stripe.FormatURLPath("/v1/customers/%s/sources", stripe.StringValue(params.Customer))+ source := &stripe.PaymentSource{}+ err := s.B.Call(http.MethodPost, path, s.Key, params, source)+ return source, err+}++// Get returns the details of a source.+func Get(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ return getC().Get(id, params)+}++// Get returns the details of a source.+func (s Client) Get(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ if params.Customer == nil {+ return nil, errors.New("Invalid source params: customer needs to be set")+ }++ path := stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ source := &stripe.PaymentSource{}+ err := s.B.Call(http.MethodGet, path, s.Key, params, source)+ return source, err+}++// Update updates a source's properties.+func Update(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ return getC().Update(id, params)+}++// Update updates a source's properties.+func (s Client) Update(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ if params.Customer == nil {+ return nil, errors.New("Invalid source params: customer needs to be set")+ }++ path := stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ source := &stripe.PaymentSource{}+ err := s.B.Call(http.MethodPost, path, s.Key, params, source)+ return source, err+}++// Del removes a source.+func Del(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ return getC().Del(id, params)+}++// Del removes a source.+func (s Client) Del(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ if params.Customer == nil {+ return nil, errors.New("Invalid source params: customer needs to be set")+ }++ source := &stripe.PaymentSource{}+ path := stripe.FormatURLPath("/v1/customers/%s/sources/%s", stripe.StringValue(params.Customer), id)+ err := s.B.Call(http.MethodDelete, path, s.Key, params, source)+ return source, err+}++// List returns a list of sources.+func List(params *stripe.SourceListParams) *Iter {+ return getC().List(params)+}++// List returns a list of sources.+func (s Client) List(listParams *stripe.SourceListParams) *Iter {+ var outerErr error+ var path string++ if listParams == nil {+ outerErr = errors.New("params should not be nil")+ } else if listParams.Customer == nil {+ outerErr = errors.New("Invalid source params: customer needs to be set")+ } else {+ path = stripe.FormatURLPath("/v1/customers/%s/sources",+ stripe.StringValue(listParams.Customer))+ }++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SourceList{}++ if outerErr != nil {+ return nil, list.ListMeta, outerErr+ }++ err := s.B.CallRaw(http.MethodGet, path, s.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Verify verifies a source which is used for bank accounts.+func Verify(id string, params *stripe.SourceVerifyParams) (*stripe.PaymentSource, error) {+ return getC().Verify(id, params)+}++// Verify verifies a source which is used for bank accounts.+func (s Client) Verify(id string, params *stripe.SourceVerifyParams) (*stripe.PaymentSource, error) {+ if params == nil {+ return nil, errors.New("params should not be nil")+ }++ var path string+ if params.Customer != nil {+ path = stripe.FormatURLPath("/v1/customers/%s/sources/%s/verify",+ stripe.StringValue(params.Customer), id)+ } else if len(params.Values) > 0 {+ path = stripe.FormatURLPath("/v1/sources/%s/verify", id)+ } else {+ return nil, errors.New("Only customer bank accounts or sources can be verified in this manner")+ }++ source := &stripe.PaymentSource{}+ err := s.B.Call(http.MethodPost, path, s.Key, params, source)+ return source, err+}++// Iter is an iterator for sources.+type Iter struct {+ *stripe.Iter+}++// PaymentSource returns the source which the iterator is currently pointing to.+func (i *Iter) PaymentSource() *stripe.PaymentSource {+ return i.Current().(*stripe.PaymentSource)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/payout.go b/vendor/github.com/stripe/stripe-go/payout.gonew file mode 100644index 000000000..0d3e11b39--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/payout.go@@ -0,0 +1,190 @@+package stripe++import "encoding/json"++// PayoutDestinationType consts represent valid payout destinations.+type PayoutDestinationType string++// List of values that PayoutDestinationType can take.+const (+ PayoutDestinationTypeBankAccount PayoutDestinationType = "bank_account"+ PayoutDestinationTypeCard PayoutDestinationType = "card"+)++// PayoutFailureCode is the list of allowed values for the payout's failure code.+type PayoutFailureCode string++// List of values that PayoutFailureCode can take.+const (+ PayoutFailureCodeAccountClosed PayoutFailureCode = "account_closed"+ PayoutFailureCodeAccountFrozen PayoutFailureCode = "account_frozen"+ PayoutFailureCodeBankAccountRestricted PayoutFailureCode = "bank_account_restricted"+ PayoutFailureCodeBankOwnershipChanged PayoutFailureCode = "bank_ownership_changed"+ PayoutFailureCodeCouldNotProcess PayoutFailureCode = "could_not_process"+ PayoutFailureCodeDebitNotAuthorized PayoutFailureCode = "debit_not_authorized"+ PayoutFailureCodeInsufficientFunds PayoutFailureCode = "insufficient_funds"+ PayoutFailureCodeInvalidAccountNumber PayoutFailureCode = "invalid_account_number"+ PayoutFailureCodeInvalidCurrency PayoutFailureCode = "invalid_currency"+ PayoutFailureCodeNoAccount PayoutFailureCode = "no_account"+)++// PayoutSourceType is the list of allowed values for the payout's source_type field.+type PayoutSourceType string++// List of values that PayoutSourceType can take.+const (+ PayoutSourceTypeAlipayAccount PayoutSourceType = "alipay_account"+ PayoutSourceTypeBankAccount PayoutSourceType = "bank_account"+ PayoutSourceTypeBitcoinReceiver PayoutSourceType = "bitcoin_receiver"+ PayoutSourceTypeCard PayoutSourceType = "card"+)++// PayoutStatus is the list of allowed values for the payout's status.+type PayoutStatus string++// List of values that PayoutStatus can take.+const (+ PayoutStatusCanceled PayoutStatus = "canceled"+ PayoutStatusFailed PayoutStatus = "failed"+ PayoutStatusInTransit PayoutStatus = "in_transit"+ PayoutStatusPaid PayoutStatus = "paid"+ PayoutStatusPending PayoutStatus = "pending"+)++// PayoutType is the list of allowed values for the payout's type.+type PayoutType string++// List of values that PayoutType can take.+const (+ PayoutTypeBank PayoutType = "bank_account"+ PayoutTypeCard PayoutType = "card"+)++// PayoutMethodType represents the type of payout+type PayoutMethodType string++// List of values that PayoutMethodType can take.+const (+ PayoutMethodInstant PayoutMethodType = "instant"+ PayoutMethodStandard PayoutMethodType = "standard"+)++// PayoutDestination describes the destination of a Payout.+// The Type should indicate which object is fleshed out+// For more details see https://stripe.com/docs/api/go#payout_object+type PayoutDestination struct {+ BankAccount *BankAccount `json:"-"`+ Card *Card `json:"-"`+ ID string `json:"id"`+ Type PayoutDestinationType `json:"object"`+}++// PayoutParams is the set of parameters that can be used when creating or updating a payout.+// For more details see https://stripe.com/docs/api#create_payout and https://stripe.com/docs/api#update_payout.+type PayoutParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Destination *string `form:"destination"`+ Method *string `form:"method"`+ SourceType *string `form:"source_type"`+ StatementDescriptor *string `form:"statement_descriptor"`+}++// PayoutListParams is the set of parameters that can be used when listing payouts.+// For more details see https://stripe.com/docs/api#list_payouts.+type PayoutListParams struct {+ ListParams `form:"*"`+ ArrivalDate *int64 `form:"arrival_date"`+ ArrivalDateRange *RangeQueryParams `form:"arrival_date"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Destination *string `form:"destination"`+ Status *string `form:"status"`+}++// Payout is the resource representing a Stripe payout.+// For more details see https://stripe.com/docs/api#payouts.+type Payout struct {+ Amount int64 `json:"amount"`+ ArrivalDate int64 `json:"arrival_date"`+ Automatic bool `json:"automatic"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ BankAccount *BankAccount `json:"bank_account"`+ Card *Card `json:"card"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Destination *PayoutDestination `json:"destination"`+ FailureBalanceTransaction *BalanceTransaction `json:"failure_balance_transaction"`+ FailureCode PayoutFailureCode `json:"failure_code"`+ FailureMessage string `json:"failure_message"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Method PayoutMethodType `json:"method"`+ SourceType PayoutSourceType `json:"source_type"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status PayoutStatus `json:"status"`+ Type PayoutType `json:"type"`+}++// PayoutList is a list of payouts as retrieved from a list endpoint.+type PayoutList struct {+ ListMeta+ Data []*Payout `json:"data"`+}++// UnmarshalJSON handles deserialization of a Payout.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (p *Payout) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ p.ID = id+ return nil+ }++ type payout Payout+ var v payout+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *p = Payout(v)+ return nil+}++// UnmarshalJSON handles deserialization of a PayoutDestination.+// This custom unmarshaling is needed because the specific+// type of destination it refers to is specified in the JSON+func (d *PayoutDestination) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ d.ID = id+ return nil+ }++ type payoutDestination PayoutDestination+ var v payoutDestination+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *d = PayoutDestination(v)++ switch d.Type {+ case PayoutDestinationTypeBankAccount:+ err = json.Unmarshal(data, &d.BankAccount)+ case PayoutDestinationTypeCard:+ err = json.Unmarshal(data, &d.Card)+ }++ return err+}++// MarshalJSON handles serialization of a PayoutDestination.+// This custom marshaling is needed because we can only send a string+// ID as a destination, even though it can be expanded to a full+// object when retrieving+func (d *PayoutDestination) MarshalJSON() ([]byte, error) {+ return json.Marshal(d.ID)+}diff --git a/vendor/github.com/stripe/stripe-go/payout/client.go b/vendor/github.com/stripe/stripe-go/payout/client.gonew file mode 100644index 000000000..bebfa580e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/payout/client.go@@ -0,0 +1,100 @@+// Package payout provides the /payouts APIs+package payout++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /payouts APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new payout.+func New(params *stripe.PayoutParams) (*stripe.Payout, error) {+ return getC().New(params)+}++// New creates a new payout.+func (c Client) New(params *stripe.PayoutParams) (*stripe.Payout, error) {+ payout := &stripe.Payout{}+ err := c.B.Call(http.MethodPost, "/v1/payouts", c.Key, params, payout)+ return payout, err+}++// Get returns the details of a payout.+func Get(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ return getC().Get(id, params)+}++// Get returns the details of a payout.+func (c Client) Get(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ path := stripe.FormatURLPath("/v1/payouts/%s", id)+ payout := &stripe.Payout{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, payout)+ return payout, err+}++// Update updates a payout's properties.+func Update(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ return getC().Update(id, params)+}++// Update updates a payout's properties.+func (c Client) Update(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ path := stripe.FormatURLPath("/v1/payouts/%s", id)+ payout := &stripe.Payout{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, payout)+ return payout, err+}++// Cancel cancels a pending payout.+func Cancel(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ return getC().Cancel(id, params)+}++// Cancel cancels a pending payout.+func (c Client) Cancel(id string, params *stripe.PayoutParams) (*stripe.Payout, error) {+ path := stripe.FormatURLPath("/v1/payouts/%s/cancel", id)+ payout := &stripe.Payout{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, payout)+ return payout, err+}++// List returns a list of payouts.+func List(params *stripe.PayoutListParams) *Iter {+ return getC().List(params)+}++// List returns a list of payouts.+func (c Client) List(listParams *stripe.PayoutListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.PayoutList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/payouts", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for payouts.+type Iter struct {+ *stripe.Iter+}++// Payout returns the payout which the iterator is currently pointing to.+func (i *Iter) Payout() *stripe.Payout {+ return i.Current().(*stripe.Payout)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/person.go b/vendor/github.com/stripe/stripe-go/person.gonew file mode 100644index 000000000..72ecbddd4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/person.go@@ -0,0 +1,124 @@+package stripe++import "encoding/json"++// RelationshipParams is used to set the relationship between an account and a person.+type RelationshipParams struct {+ AccountOpener *bool `form:"account_opener"`+ Director *bool `form:"director"`+ Executive *bool `form:"executive"`+ Owner *bool `form:"owner"`+ PercentOwnership *float64 `form:"percent_ownership"`+ Title *string `form:"title"`+}++// PersonParams is the set of parameters that can be used when creating or updating a person.+// For more details see https://stripe.com/docs/api#create_person.+type PersonParams struct {+ Params `form:"*"`+ Account *string `form:"-"` // Included in URL+ Address *AccountAddressParams `form:"address"`+ AddressKana *AccountAddressParams `form:"address_kana"`+ AddressKanji *AccountAddressParams `form:"address_kanji"`+ DOB *DOBParams `form:"dob"`+ Email *string `form:"email"`+ FirstName *string `form:"first_name"`+ FirstNameKana *string `form:"first_name_kana"`+ FirstNameKanji *string `form:"first_name_kanji"`+ Gender *string `form:"gender"`+ IDNumber *string `form:"id_number"`+ LastName *string `form:"last_name"`+ LastNameKana *string `form:"last_name_kana"`+ LastNameKanji *string `form:"last_name_kanji"`+ MaidenName *string `form:"maiden_name"`+ Phone *string `form:"phone"`+ Relationship *RelationshipParams `form:"relationship"`+ SSNLast4 *string `form:"ssn_last_4"`+}++// RelationshipListParams is used to filter persons by the relationship+type RelationshipListParams struct {+ AccountOpener *bool `form:"account_opener"`+ Director *bool `form:"director"`+ Executive *bool `form:"executive"`+ Owner *bool `form:"owner"`+}++// PersonListParams is the set of parameters that can be used when listing persons.+// For more detail see https://stripe.com/docs/api#list_persons.+type PersonListParams struct {+ ListParams `form:"*"`+ Account *string `form:"-"` // Included in URL+ Relationship *RelationshipListParams `form:"relationship"`+}++// Relationship represents extra information needed for a Person.+type Relationship struct {+ AccountOpener bool `json:"account_opener"`+ Director bool `json:"director"`+ Executive bool `json:"executive"`+ Owner bool `json:"owner"`+ PercentOwnership float64 `json:"percent_ownership"`+ Title string `json:"title"`+}++// Requirements represents what's missing to verify a Person.+type Requirements struct {+ CurrentlyDue []string `json:"currently_due"`+ EventuallyDue []string `json:"eventually_due"`+ PastDue []string `json:"past_due"`+}++// Person is the resource representing a Stripe person.+// For more details see https://stripe.com/docs/api#persons.+type Person struct {+ Account string `json:"account"`+ Address *AccountAddress `json:"address"`+ AddressKana *AccountAddress `json:"address_kana"`+ AddressKanji *AccountAddress `json:"address_kanji"`+ Deleted bool `json:"deleted"`+ DOB *DOB `json:"dob"`+ Email string `json:"email"`+ FirstName string `json:"first_name"`+ FirstNameKana string `json:"first_name_kana"`+ FirstNameKanji string `json:"first_name_kanji"`+ Gender string `json:"gender"`+ ID string `json:"id"`+ IDNumberProvided bool `json:"id_number_provided"`+ LastName string `json:"last_name"`+ LastNameKana string `json:"last_name_kana"`+ LastNameKanji string `json:"last_name_kanji"`+ MaidenName string `json:"maiden_name"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ Phone string `json:"phone"`+ Relationship *Relationship `json:"relationship"`+ Requirements *Requirements `json:"requirements"`+ SSNLast4Provided bool `json:"ssn_last_4_provided"`+ Verification *IdentityVerification `json:"verification"`+}++// PersonList is a list of persons as retrieved from a list endpoint.+type PersonList struct {+ ListMeta+ Data []*Person `json:"data"`+}++// UnmarshalJSON handles deserialization of a Person.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *Person) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type person Person+ var v person+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = Person(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/plan.go b/vendor/github.com/stripe/stripe-go/plan.gonew file mode 100644index 000000000..fc0df7da4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/plan.go@@ -0,0 +1,174 @@+package stripe++import (+ "strconv"++ "github.com/stripe/stripe-go/form"+)++// PlanInterval is the list of allowed values for a plan's interval.+type PlanInterval string++// List of values that PlanInterval can take.+const (+ PlanIntervalDay PlanInterval = "day"+ PlanIntervalWeek PlanInterval = "week"+ PlanIntervalMonth PlanInterval = "month"+ PlanIntervalYear PlanInterval = "year"+)++// PlanBillingScheme is the list of allowed values for a plan's billing scheme.+type PlanBillingScheme string++// List of values that PlanBillingScheme can take.+const (+ PlanBillingSchemePerUnit PlanBillingScheme = "per_unit"+ PlanBillingSchemeTiered PlanBillingScheme = "tiered"+)++// PlanUsageType is the list of allowed values for a plan's usage type.+type PlanUsageType string++// List of values that PlanUsageType can take.+const (+ PlanUsageTypeLicensed PlanUsageType = "licensed"+ PlanUsageTypeMetered PlanUsageType = "metered"+)++// PlanTiersMode is the list of allowed values for a plan's tiers mode.+type PlanTiersMode string++// List of values that PlanTiersMode can take.+const (+ PlanTiersModeGraduated PlanTiersMode = "graduated"+ PlanTiersModeVolume PlanTiersMode = "volume"+)++// PlanTransformUsageRound is the list of allowed values for a plan's transform usage round logic.+type PlanTransformUsageRound string++// List of values that PlanTransformUsageRound can take.+const (+ PlanTransformUsageRoundDown PlanTransformUsageRound = "down"+ PlanTransformUsageRoundUp PlanTransformUsageRound = "up"+)++// PlanAggregateUsage is the list of allowed values for a plan's aggregate usage.+type PlanAggregateUsage string++// List of values that PlanAggregateUsage can take.+const (+ PlanAggregateUsageLastDuringPeriod PlanAggregateUsage = "last_during_period"+ PlanAggregateUsageLastEver PlanAggregateUsage = "last_ever"+ PlanAggregateUsageMax PlanAggregateUsage = "max"+ PlanAggregateUsageSum PlanAggregateUsage = "sum"+)++// Plan is the resource representing a Stripe plan.+// For more details see https://stripe.com/docs/api#plans.+type Plan struct {+ Active bool `json:"active"`+ AggregateUsage string `json:"aggregate_usage"`+ Amount int64 `json:"amount"`+ BillingScheme PlanBillingScheme `json:"billing_scheme"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Deleted bool `json:"deleted"`+ ID string `json:"id"`+ Interval PlanInterval `json:"interval"`+ IntervalCount int64 `json:"interval_count"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Nickname string `json:"nickname"`+ Product *Product `json:"product"`+ Tiers []*PlanTier `json:"tiers"`+ TiersMode string `json:"tiers_mode"`+ TransformUsage *PlanTransformUsage `json:"transform_usage"`+ TrialPeriodDays int64 `json:"trial_period_days"`+ UsageType PlanUsageType `json:"usage_type"`+}++// PlanList is a list of plans as returned from a list endpoint.+type PlanList struct {+ ListMeta+ Data []*Plan `json:"data"`+}++// PlanListParams is the set of parameters that can be used when listing plans.+// For more details see https://stripe.com/docs/api#list_plans.+type PlanListParams struct {+ ListParams `form:"*"`+ Active *bool `form:"active"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Product *string `form:"product"`+}++// PlanParams is the set of parameters that can be used when creating or updating a plan.+// For more details see https://stripe.com/docs/api#create_plan and https://stripe.com/docs/api#update_plan.+type PlanParams struct {+ Params `form:"*"`+ Active *bool `form:"active"`+ AggregateUsage *string `form:"aggregate_usage"`+ Amount *int64 `form:"amount"`+ BillingScheme *string `form:"billing_scheme"`+ Currency *string `form:"currency"`+ ID *string `form:"id"`+ Interval *string `form:"interval"`+ IntervalCount *int64 `form:"interval_count"`+ Nickname *string `form:"nickname"`+ Product *PlanProductParams `form:"product"`+ ProductID *string `form:"product"`+ Tiers []*PlanTierParams `form:"tiers"`+ TiersMode *string `form:"tiers_mode"`+ TransformUsage *PlanTransformUsageParams `form:"transform_usage"`+ TrialPeriodDays *int64 `form:"trial_period_days"`+ UsageType *string `form:"usage_type"`+}++// PlanTier configures tiered pricing+type PlanTier struct {+ FlatAmount int64 `json:"flat_amount"`+ UnitAmount int64 `json:"unit_amount"`+ UpTo int64 `json:"up_to"`+}++// PlanTransformUsage represents the bucket billing configuration.+type PlanTransformUsage struct {+ DivideBy int64 `json:"divide_by"`+ Round PlanTransformUsageRound `json:"round"`+}++// PlanTransformUsageParams represents the bucket billing configuration.+type PlanTransformUsageParams struct {+ DivideBy *int64 `form:"divide_by"`+ Round *string `form:"round"`+}++// PlanTierParams configures tiered pricing+type PlanTierParams struct {+ Params `form:"*"`+ FlatAmount *int64 `form:"flat_amount"`+ UnitAmount *int64 `form:"unit_amount"`+ UpTo *int64 `form:"-"` // handled in custom AppendTo+ UpToInf *bool `form:"-"` // handled in custom AppendTo+}++// AppendTo implements custom up_to serialisation logic for tiers configuration+func (p *PlanTierParams) AppendTo(body *form.Values, keyParts []string) {+ if BoolValue(p.UpToInf) {+ body.Add(form.FormatKey(append(keyParts, "up_to")), "inf")+ } else {+ body.Add(form.FormatKey(append(keyParts, "up_to")), strconv.FormatInt(Int64Value(p.UpTo), 10))+ }+}++// PlanProductParams is the set of parameters that can be used when creating a product inside a plan+// This can only be used on plan creation and won't work on plan update.+// For more details see https://stripe.com/docs/api#create_plan-product and https://stripe.com/docs/api#update_plan-product+type PlanProductParams struct {+ ID *string `form:"id"`+ Name *string `form:"name"`+ Metadata map[string]string `form:"metadata"`+ StatementDescriptor *string `form:"statement_descriptor"`+}diff --git a/vendor/github.com/stripe/stripe-go/plan/client.go b/vendor/github.com/stripe/stripe-go/plan/client.gonew file mode 100644index 000000000..4df0c6010--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/plan/client.go@@ -0,0 +1,100 @@+// Package plan provides the /plans APIs+package plan++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /plans APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new plan.+func New(params *stripe.PlanParams) (*stripe.Plan, error) {+ return getC().New(params)+}++// New creates a new plan.+func (c Client) New(params *stripe.PlanParams) (*stripe.Plan, error) {+ plan := &stripe.Plan{}+ err := c.B.Call(http.MethodPost, "/v1/plans", c.Key, params, plan)+ return plan, err+}++// Get returns the details of a plan.+func Get(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ return getC().Get(id, params)+}++// Get returns the details of a plan.+func (c Client) Get(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ path := stripe.FormatURLPath("/v1/plans/%s", id)+ plan := &stripe.Plan{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, plan)+ return plan, err+}++// Update updates a plan's properties.+func Update(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ return getC().Update(id, params)+}++// Update updates a plan's properties.+func (c Client) Update(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ path := stripe.FormatURLPath("/v1/plans/%s", id)+ plan := &stripe.Plan{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, plan)+ return plan, err+}++// Del removes a plan.+func Del(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ return getC().Del(id, params)+}++// Del removes a plan.+func (c Client) Del(id string, params *stripe.PlanParams) (*stripe.Plan, error) {+ path := stripe.FormatURLPath("/v1/plans/%s", id)+ plan := &stripe.Plan{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, plan)+ return plan, err+}++// List returns a list of plans.+func List(params *stripe.PlanListParams) *Iter {+ return getC().List(params)+}++// List returns a list of plans.+func (c Client) List(listParams *stripe.PlanListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.PlanList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/plans", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for plans.+type Iter struct {+ *stripe.Iter+}++// Plan returns the plan which the iterator is currently pointing to.+func (i *Iter) Plan() *stripe.Plan {+ return i.Current().(*stripe.Plan)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/product.go b/vendor/github.com/stripe/stripe-go/product.gonew file mode 100644index 000000000..67f55ff67--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/product.go@@ -0,0 +1,107 @@+package stripe++import "encoding/json"++// ProductType is the type of a product.+type ProductType string++// List of values that ProductType can take.+const (+ ProductTypeGood ProductType = "good"+ ProductTypeService ProductType = "service"+)++// PackageDimensionsParams represents the set of parameters for the the dimension of a+// product or a SKU from the perspective of shipping .+type PackageDimensionsParams struct {+ Height *float64 `form:"height"`+ Length *float64 `form:"length"`+ Weight *float64 `form:"weight"`+ Width *float64 `form:"width"`+}++// ProductParams is the set of parameters that can be used when creating or updating a product.+type ProductParams struct {+ Params `form:"*"`+ Active *bool `form:"active"`+ Attributes []*string `form:"attributes"`+ Caption *string `form:"caption"`+ DeactivateOn []*string `form:"deactivate_on"`+ Description *string `form:"description"`+ ID *string `form:"id"`+ Images []*string `form:"images"`+ Name *string `form:"name"`+ PackageDimensions *PackageDimensionsParams `form:"package_dimensions"`+ Shippable *bool `form:"shippable"`+ StatementDescriptor *string `form:"statement_descriptor"`+ Type *string `form:"type"`+ UnitLabel *string `form:"unit_label"`+ URL *string `form:"url"`+}++// PackageDimensions represents the dimension of a product or a SKU from the+// perspective of shipping.+type PackageDimensions struct {+ Height float64 `json:"height"`+ Length float64 `json:"length"`+ Weight float64 `json:"weight"`+ Width float64 `json:"width"`+}++// Product is the resource representing a Stripe product.+// For more details see https://stripe.com/docs/api#products.+type Product struct {+ Active bool `json:"active"`+ Attributes []string `json:"attributes"`+ Caption string `json:"caption"`+ Created int64 `json:"created"`+ DeactivateOn []string `json:"deactivate_on"`+ Description string `json:"description"`+ ID string `json:"id"`+ Images []string `json:"images"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ PackageDimensions *PackageDimensions `json:"package_dimensions"`+ Shippable bool `json:"shippable"`+ StatementDescriptor string `json:"statement_descriptor"`+ Type ProductType `json:"type"`+ UnitLabel string `json:"unit_label"`+ URL string `json:"url"`+ Updated int64 `json:"updated"`+}++// ProductList is a list of products as retrieved from a list endpoint.+type ProductList struct {+ ListMeta+ Data []*Product `json:"data"`+}++// ProductListParams is the set of parameters that can be used when listing products.+type ProductListParams struct {+ ListParams `form:"*"`+ Active *bool `form:"active"`+ IDs []*string `form:"ids"`+ Shippable *bool `form:"shippable"`+ URL *string `form:"url"`+ Type *string `form:"type"`+}++// UnmarshalJSON handles deserialization of a Product.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (p *Product) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ p.ID = id+ return nil+ }++ type product Product+ var v product+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *p = Product(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/product/client.go b/vendor/github.com/stripe/stripe-go/product/client.gonew file mode 100644index 000000000..9c0dfd5c6--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/product/client.go@@ -0,0 +1,100 @@+package product++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /products APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new product.+func New(params *stripe.ProductParams) (*stripe.Product, error) {+ return getC().New(params)+}++// New creates a new product.+func (c Client) New(params *stripe.ProductParams) (*stripe.Product, error) {+ p := &stripe.Product{}+ err := c.B.Call(http.MethodPost, "/v1/products", c.Key, params, p)+ return p, err+}++// Update updates a product's properties.+func Update(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ return getC().Update(id, params)+}++// Update updates a product's properties.+func (c Client) Update(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ path := stripe.FormatURLPath("/v1/products/%s", id)+ p := &stripe.Product{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, p)+ return p, err+}++// Get returns the details of a product.+func Get(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ return getC().Get(id, params)+}++// Get returns the details of a product.+func (c Client) Get(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ path := stripe.FormatURLPath("/v1/products/%s", id)+ p := &stripe.Product{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, p)+ return p, err+}++// List returns a list of products.+func List(params *stripe.ProductListParams) *Iter {+ return getC().List(params)+}++// List returns a list of products.+func (c Client) List(listParams *stripe.ProductListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ProductList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/products", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Del deletes a product+func Del(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ return getC().Del(id, params)+}++// Del deletes a product.+func (c Client) Del(id string, params *stripe.ProductParams) (*stripe.Product, error) {+ path := stripe.FormatURLPath("/v1/products/%s", id)+ p := &stripe.Product{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, p)++ return p, err+}++// Iter is an iterator for products.+type Iter struct {+ *stripe.Iter+}++// Product returns the product which the iterator is currently pointing to.+func (i *Iter) Product() *stripe.Product {+ return i.Current().(*stripe.Product)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/radar/valuelist/client.go b/vendor/github.com/stripe/stripe-go/radar/valuelist/client.gonew file mode 100644index 000000000..f2d3f40eb--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/radar/valuelist/client.go@@ -0,0 +1,102 @@+// Package valuelist provides API functions related to value lists.+//+// For more details, see: https://stripe.com/docs/api/radar/lists?lang=go+package valuelist++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /radar/value_lists APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new value list.+func New(params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ return getC().New(params)+}++// New creates a new value list.+func (c Client) New(params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ vl := &stripe.RadarValueList{}+ err := c.B.Call(http.MethodPost, "/v1/radar/value_lists", c.Key, params, vl)+ return vl, err+}++// Get returns the details of a value list.+func Get(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ return getC().Get(id, params)+}++// Get returns the details of a value list.+func (c Client) Get(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ path := stripe.FormatURLPath("/v1/radar/value_lists/%s", id)+ vl := &stripe.RadarValueList{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, vl)+ return vl, err+}++// Update updates a vl's properties.+func Update(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ return getC().Update(id, params)+}++// Update updates a vl's properties.+func (c Client) Update(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ path := stripe.FormatURLPath("/v1/radar/value_lists/%s", id)+ vl := &stripe.RadarValueList{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, vl)+ return vl, err+}++// Del removes a value list.+func Del(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ return getC().Del(id, params)+}++// Del removes a value list.+func (c Client) Del(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {+ path := stripe.FormatURLPath("/v1/radar/value_lists/%s", id)+ vl := &stripe.RadarValueList{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, vl)+ return vl, err+}++// List returns a list of vls.+func List(params *stripe.RadarValueListListParams) *Iter {+ return getC().List(params)+}++// List returns a list of vls.+func (c Client) List(listParams *stripe.RadarValueListListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.RadarValueListList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/radar/value_lists", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for vls.+type Iter struct {+ *stripe.Iter+}++// RadarValueList returns the vl which the iterator is currently pointing to.+func (i *Iter) RadarValueList() *stripe.RadarValueList {+ return i.Current().(*stripe.RadarValueList)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/radar/valuelistitem/client.go b/vendor/github.com/stripe/stripe-go/radar/valuelistitem/client.gonew file mode 100644index 000000000..66408f6c7--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/radar/valuelistitem/client.go@@ -0,0 +1,89 @@+// Package valuelistitem provides API functions related to value list items.+//+// For more details, see: https://stripe.com/docs/api/radar/list_items?lang=go+package valuelistitem++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /radar/value_list_items APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new value list item.+func New(params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ return getC().New(params)+}++// New creates a new value list item.+func (c Client) New(params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ vli := &stripe.RadarValueListItem{}+ err := c.B.Call(http.MethodPost, "/v1/radar/value_list_items", c.Key, params, vli)+ return vli, err+}++// Get returns the details of a value list item.+func Get(id string, params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ return getC().Get(id, params)+}++// Get returns the details of a value list item.+func (c Client) Get(id string, params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ path := stripe.FormatURLPath("/v1/radar/value_list_items/%s", id)+ vli := &stripe.RadarValueListItem{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, vli)+ return vli, err+}++// Del removes a value list item.+func Del(id string, params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ return getC().Del(id, params)+}++// Del removes a value list item.+func (c Client) Del(id string, params *stripe.RadarValueListItemParams) (*stripe.RadarValueListItem, error) {+ path := stripe.FormatURLPath("/v1/radar/value_list_items/%s", id)+ vli := &stripe.RadarValueListItem{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, vli)+ return vli, err+}++// List returns a list of vlis.+func List(params *stripe.RadarValueListItemListParams) *Iter {+ return getC().List(params)+}++// List returns a list of vlis.+func (c Client) List(listParams *stripe.RadarValueListItemListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.RadarValueListItemList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/radar/value_list_items", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for vlis.+type Iter struct {+ *stripe.Iter+}++// RadarValueListItem returns the vli which the iterator is currently pointing to.+func (i *Iter) RadarValueListItem() *stripe.RadarValueListItem {+ return i.Current().(*stripe.RadarValueListItem)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/radar_valuelist.go b/vendor/github.com/stripe/stripe-go/radar_valuelist.gonew file mode 100644index 000000000..a8a39e8ff--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/radar_valuelist.go@@ -0,0 +1,55 @@+package stripe++// RadarValueListItemType is the possible values for a type of value list items.+type RadarValueListItemType string++// List of values that RadarValueListItemType can take.+const (+ RadarValueListItemTypeCardBin RadarValueListItemType = "card_bin"+ RadarValueListItemTypeCardFingerprint RadarValueListItemType = "card_fingerprint"+ RadarValueListItemTypeCountry RadarValueListItemType = "country"+ RadarValueListItemTypeEmail RadarValueListItemType = "email"+ RadarValueListItemTypeIPAddress RadarValueListItemType = "ip_address"+ RadarValueListItemTypeString RadarValueListItemType = "string"+ RadarValueListItemTypeCaseSensitiveString RadarValueListItemType = "case_sensitive_string"+)++// RadarValueListParams is the set of parameters that can be used when creating a value list.+type RadarValueListParams struct {+ Params `form:"*"`+ Alias *string `form:"alias"`+ ItemType *string `form:"item_type"`+ Name *string `form:"name"`+}++// RadarValueListListParams is the set of parameters that can be used when listing value lists.+type RadarValueListListParams struct {+ ListParams `form:"*"`+ Alias *string `form:"alias"`+ Contains *string `form:"contains"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// RadarValueList is the resource representing a value list.+type RadarValueList struct {+ Alias string `json:"alias"`+ Created int64 `json:"created"`+ CreatedBy string `json:"created_by"`+ Deleted bool `json:"deleted"`+ ID string `json:"id"`+ ItemType RadarValueListItemType `json:"item_type"`+ ListItems *RadarValueListItemList `json:"list_items"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Name string `json:"name"`+ Object string `json:"object"`+ Updated int64 `json:"updated"`+ UpdatedBy string `json:"updated_by"`+}++// RadarValueListList is a list of value lists as retrieved from a list endpoint.+type RadarValueListList struct {+ ListMeta+ Data []*RadarValueList `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/radar_valuelistitem.go b/vendor/github.com/stripe/stripe-go/radar_valuelistitem.gonew file mode 100644index 000000000..98dfcbcb3--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/radar_valuelistitem.go@@ -0,0 +1,36 @@+package stripe++// RadarValueListItemParams is the set of parameters that can be used when creating a value list item.+type RadarValueListItemParams struct {+ Params `form:"*"`+ Value *string `form:"value"`+ RadarValueList *string `form:"value_list"`+}++// RadarValueListItemListParams is the set of parameters that can be used when listing value list items.+type RadarValueListItemListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ RadarValueList *string `form:"value_list"`+ Value *string `form:"value"`+}++// RadarValueListItem is the resource representing a value list item.+type RadarValueListItem struct {+ Created int64 `json:"created"`+ CreatedBy string `json:"created_by"`+ Deleted bool `json:"deleted"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Name string `json:"name"`+ Object string `json:"object"`+ Value string `json:"value"`+ RadarValueList string `json:"value_list"`+}++// RadarValueListItemList is a list of value list items as retrieved from a list endpoint.+type RadarValueListItemList struct {+ ListMeta+ Data []*RadarValueListItem `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/recipient.go b/vendor/github.com/stripe/stripe-go/recipient.gonew file mode 100644index 000000000..7b1676a19--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/recipient.go@@ -0,0 +1,95 @@+package stripe++import (+ "encoding/json"++ "github.com/stripe/stripe-go/form"+)++// RecipientType is the list of allowed values for the recipient's type.+type RecipientType string++// List of values that RecipientType can take.+const (+ RecipientTypeIndividual RecipientType = "individual"+ RecipientTypeCorporation RecipientType = "corporation"+)++// RecipientParams is the set of parameters that can be used when creating or updating recipients.+// For more details see https://stripe.com/docs/api#create_recipient and https://stripe.com/docs/api#update_recipient.+type RecipientParams struct {+ Params `form:"*"`++ BankAccount *BankAccountParams `form:"-"` // Kind of an abberation because a bank account's token will be replace the rest of its data. Keep this in a custom AppendTo for now.+ Card *CardParams `form:"card"`+ DefaultCard *string `form:"default_card"`+ Description *string `form:"description"`+ Email *string `form:"email"`+ Name *string `form:"name"`+ TaxID *string `form:"tax_id"`+ Token *string `form:"card"`+ Type *string `form:"-"` // Doesn't seem to be used anywhere+}++// AppendTo implements some custom behavior around a recipient's bank account.+// This was probably the wrong way to go about this, but grandfather the+// behavior for the time being.+func (p *RecipientParams) AppendTo(body *form.Values, keyParts []string) {+ if p.BankAccount != nil {+ if p.BankAccount.Token != nil {+ body.Add("bank_account", StringValue(p.BankAccount.Token))+ } else {+ form.AppendToPrefixed(body, p.BankAccount, append(keyParts, "bank_account"))+ }+ }+}++// RecipientListParams is the set of parameters that can be used when listing recipients.+// For more details see https://stripe.com/docs/api#list_recipients.+type RecipientListParams struct {+ ListParams `form:"*"`+ Verified *bool `form:"verified"`+}++// Recipient is the resource representing a Stripe recipient.+// For more details see https://stripe.com/docs/api#recipients.+type Recipient struct {+ ActiveAccount *BankAccount `json:"active_account"`+ Cards *CardList `json:"cards"`+ Created int64 `json:"created"`+ DefaultCard *Card `json:"default_card"`+ Deleted bool `json:"deleted"`+ Description string `json:"description"`+ Email string `json:"email"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ MigratedTo *Account `json:"migrated_to"`+ Name string `json:"name"`+ Type RecipientType `json:"type"`+}++// RecipientList is a list of recipients as retrieved from a list endpoint.+type RecipientList struct {+ ListMeta+ Data []*Recipient `json:"data"`+}++// UnmarshalJSON handles deserialization of a Recipient.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *Recipient) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type recipient Recipient+ var v recipient+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = Recipient(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/recipient/client.go b/vendor/github.com/stripe/stripe-go/recipient/client.gonew file mode 100644index 000000000..35ba3080f--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/recipient/client.go@@ -0,0 +1,91 @@+// Package recipient provides the /recipients APIs+package recipient++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /recipients APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Since API version 2017-04-06, new recipients can't be created anymore.+// For that reason, there isn't a New() method for the Recipient resource.++// Get returns the details of a recipient.+func Get(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ return getC().Get(id, params)+}++// Get returns the details of a recipient.+func (c Client) Get(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ path := stripe.FormatURLPath("/v1/recipients/%s", id)+ recipient := &stripe.Recipient{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, recipient)+ return recipient, err+}++// Update updates a recipient's properties.+func Update(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ return getC().Update(id, params)+}++// Update updates a recipient's properties.+func (c Client) Update(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ path := stripe.FormatURLPath("/v1/recipients/%s", id)+ recipient := &stripe.Recipient{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, recipient)+ return recipient, err+}++// Del removes a recipient.+func Del(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ return getC().Del(id, params)+}++// Del removes a recipient.+func (c Client) Del(id string, params *stripe.RecipientParams) (*stripe.Recipient, error) {+ path := stripe.FormatURLPath("/v1/recipients/%s", id)+ recipient := &stripe.Recipient{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, recipient)+ return recipient, err+}++// List returns a list of recipients.+func List(params *stripe.RecipientListParams) *Iter {+ return getC().List(params)+}++// List returns a list of recipients.+func (c Client) List(listParams *stripe.RecipientListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.RecipientList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/recipients", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for recipients.+type Iter struct {+ *stripe.Iter+}++// Recipient returns the recipient which the iterator is currently pointing to.+func (i *Iter) Recipient() *stripe.Recipient {+ return i.Current().(*stripe.Recipient)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/recipienttransfer.go b/vendor/github.com/stripe/stripe-go/recipienttransfer.gonew file mode 100644index 000000000..b6f6482fd--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/recipienttransfer.go@@ -0,0 +1,163 @@+package stripe++import "encoding/json"++// RecipientTransferDestinationType consts represent valid recipient_transfer destinations.+type RecipientTransferDestinationType string++// List of values that RecipientTransferDestinationType can take.+const (+ RecipientTransferDestinationBankAccount RecipientTransferDestinationType = "bank_account"+ RecipientTransferDestinationCard RecipientTransferDestinationType = "card"+)++// RecipientTransferFailureCode is the list of allowed values for the recipient_transfer's failure code.+type RecipientTransferFailureCode string++// List of values that RecipientTransferFailureCode can take.+const (+ RecipientTransferFailureCodeAccountClosed RecipientTransferFailureCode = "account_closed"+ RecipientTransferFailureCodeAccountFrozen RecipientTransferFailureCode = "account_frozen"+ RecipientTransferFailureCodeBankAccountRestricted RecipientTransferFailureCode = "bank_account_restricted"+ RecipientTransferFailureCodeBankOwnershipChanged RecipientTransferFailureCode = "bank_ownership_changed"+ RecipientTransferFailureCodeDebitNotAuthorized RecipientTransferFailureCode = "debit_not_authorized"+ RecipientTransferFailureCodeCouldNotProcess RecipientTransferFailureCode = "could_not_process"+ RecipientTransferFailureCodeInsufficientFunds RecipientTransferFailureCode = "insufficient_funds"+ RecipientTransferFailureCodeInvalidAccountNumber RecipientTransferFailureCode = "invalid_account_number"+ RecipientTransferFailureCodeInvalidCurrency RecipientTransferFailureCode = "invalid_currency"+ RecipientTransferFailureCodeNoAccount RecipientTransferFailureCode = "no_account"+)++// RecipientTransferSourceType is the list of allowed values for the recipient_transfer's source_type field.+type RecipientTransferSourceType string++// List of values that RecipientTransferSourceType can take.+const (+ RecipientTransferSourceTypeAlipayAccount RecipientTransferSourceType = "alipay_account"+ RecipientTransferSourceTypeBankAccount RecipientTransferSourceType = "bank_account"+ RecipientTransferSourceTypeBitcoinReceiver RecipientTransferSourceType = "bitcoin_receiver"+ RecipientTransferSourceTypeCard RecipientTransferSourceType = "card"+)++// RecipientTransferStatus is the list of allowed values for the recipient_transfer's status.+type RecipientTransferStatus string++// List of values that RecipientTransferStatus can take.+const (+ RecipientTransferStatusFailed RecipientTransferStatus = "failed"+ RecipientTransferStatusInTransit RecipientTransferStatus = "in_transit"+ RecipientTransferStatusPaid RecipientTransferStatus = "paid"+ RecipientTransferStatusPending RecipientTransferStatus = "pending"+)++// RecipientTransferType is the list of allowed values for the recipient_transfer's type.+type RecipientTransferType string++// List of values that RecipientTransferType can take.+const (+ RecipientTransferTypeBankAccount RecipientTransferType = "bank_account"+ RecipientTransferTypeCard RecipientTransferType = "card"+)++// RecipientTransferMethodType represents the type of recipient_transfer+type RecipientTransferMethodType string++// List of values that RecipientTransferMethodType can take.+const (+ RecipientTransferMethodInstant RecipientTransferMethodType = "instant"+ RecipientTransferMethodStandard RecipientTransferMethodType = "standard"+)++// RecipientTransferDestination describes the destination of a RecipientTransfer.+// The Type should indicate which object is fleshed out+// For more details see https://stripe.com/docs/api/go#recipient_transfer_object+type RecipientTransferDestination struct {+ BankAccount *BankAccount `json:"-"`+ Card *Card `json:"-"`+ ID string `json:"id"`+ Type RecipientTransferDestinationType `json:"object"`+}++// RecipientTransfer is the resource representing a Stripe recipient_transfer.+// For more details see https://stripe.com/docs/api#recipient_transfers.+type RecipientTransfer struct {+ Amount int64 `json:"amount"`+ AmountReversed int64 `json:"amount_reversed"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ BankAccount *BankAccount `json:"bank_account"`+ Card *Card `json:"card"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Date int64 `json:"date"`+ Description string `json:"description"`+ Destination string `json:"destination"`+ FailureCode RecipientTransferFailureCode `json:"failure_code"`+ FailureMessage string `json:"failure_message"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Method RecipientTransferMethodType `json:"method"`+ Recipient *Recipient `json:"recipient"`+ Reversals *ReversalList `json:"reversals"`+ Reversed bool `json:"reversed"`+ SourceTransaction *BalanceTransactionSource `json:"source_transaction"`+ SourceType RecipientTransferSourceType `json:"source_type"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status RecipientTransferStatus `json:"status"`+ Type RecipientTransferType `json:"type"`+}++// UnmarshalJSON handles deserialization of a RecipientTransfer.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (t *RecipientTransfer) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ t.ID = id+ return nil+ }++ type recipientTransfer RecipientTransfer+ var v recipientTransfer+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *t = RecipientTransfer(v)+ return nil+}++// UnmarshalJSON handles deserialization of a RecipientTransferDestination.+// This custom unmarshaling is needed because the specific+// type of destination it refers to is specified in the JSON+func (d *RecipientTransferDestination) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ d.ID = id+ return nil+ }++ type recipientTransferDestination RecipientTransferDestination+ var v recipientTransferDestination+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ var err error+ *d = RecipientTransferDestination(v)++ switch d.Type {+ case RecipientTransferDestinationBankAccount:+ err = json.Unmarshal(data, &d.BankAccount)+ case RecipientTransferDestinationCard:+ err = json.Unmarshal(data, &d.Card)+ }++ return err+}++// MarshalJSON handles serialization of a RecipientTransferDestination.+// This custom marshaling is needed because we can only send a string+// ID as a destination, even though it can be expanded to a full+// object when retrieving+func (d *RecipientTransferDestination) MarshalJSON() ([]byte, error) {+ return json.Marshal(d.ID)+}diff --git a/vendor/github.com/stripe/stripe-go/refund.go b/vendor/github.com/stripe/stripe-go/refund.gonew file mode 100644index 000000000..d821dce1c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/refund.go@@ -0,0 +1,85 @@+package stripe++import "encoding/json"++// RefundReason is, if set, the reason the refund is being made+type RefundReason string++// List of values that RefundReason can take.+const (+ RefundReasonDuplicate RefundReason = "duplicate"+ RefundReasonFraudulent RefundReason = "fraudulent"+ RefundReasonRequestedByCustomer RefundReason = "requested_by_customer"+)++// RefundStatus is the status of the refund.+type RefundStatus string++// List of values that RefundStatus can take.+const (+ RefundStatusCanceled RefundStatus = "canceled"+ RefundStatusFailed RefundStatus = "failed"+ RefundStatusPending RefundStatus = "pending"+ RefundStatusSucceeded RefundStatus = "succeeded"+)++// RefundParams is the set of parameters that can be used when refunding a charge.+// For more details see https://stripe.com/docs/api#refund.+type RefundParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Charge *string `form:"charge"`+ Reason *string `form:"reason"`+ RefundApplicationFee *bool `form:"refund_application_fee"`+ ReverseTransfer *bool `form:"reverse_transfer"`+}++// RefundListParams is the set of parameters that can be used when listing refunds.+// For more details see https://stripe.com/docs/api#list_refunds.+type RefundListParams struct {+ ListParams `form:"*"`+}++// Refund is the resource representing a Stripe refund.+// For more details see https://stripe.com/docs/api#refunds.+type Refund struct {+ Amount int64 `json:"amount"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ FailureBalanceTransaction *BalanceTransaction `json:"failure_balance_transaction"`+ ID string `json:"id"`+ Metadata map[string]string `json:"metadata"`+ Object string `json:"object"`+ Reason RefundReason `json:"reason"`+ ReceiptNumber string `json:"receipt_number"`+ SourceTransferReversal *Reversal `json:"source_transfer_reversal"`+ Status RefundStatus `json:"status"`+ TransferReversal *Reversal `json:"transfer_reversal"`+}++// RefundList is a list object for refunds.+type RefundList struct {+ ListMeta+ Data []*Refund `json:"data"`+}++// UnmarshalJSON handles deserialization of a Refund.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *Refund) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type refund Refund+ var v refund+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = Refund(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/refund/client.go b/vendor/github.com/stripe/stripe-go/refund/client.gonew file mode 100644index 000000000..1d0084422--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/refund/client.go@@ -0,0 +1,87 @@+// Package refund provides the /refunds APIs+package refund++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /refunds APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a refund.+func New(params *stripe.RefundParams) (*stripe.Refund, error) {+ return getC().New(params)+}++// New creates a refund.+func (c Client) New(params *stripe.RefundParams) (*stripe.Refund, error) {+ refund := &stripe.Refund{}+ err := c.B.Call(http.MethodPost, "/v1/refunds", c.Key, params, refund)+ return refund, err+}++// Get returns the details of a refund.+func Get(id string, params *stripe.RefundParams) (*stripe.Refund, error) {+ return getC().Get(id, params)+}++// Get returns the details of a refund.+func (c Client) Get(id string, params *stripe.RefundParams) (*stripe.Refund, error) {+ path := stripe.FormatURLPath("/v1/refunds/%s", id)+ refund := &stripe.Refund{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, refund)+ return refund, err+}++// Update updates a refund's properties.+func Update(id string, params *stripe.RefundParams) (*stripe.Refund, error) {+ return getC().Update(id, params)+}++// Update updates a refund's properties.+func (c Client) Update(id string, params *stripe.RefundParams) (*stripe.Refund, error) {+ path := stripe.FormatURLPath("/v1/refunds/%s", id)+ refund := &stripe.Refund{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, refund)+ return refund, err+}++// List returns a list of refunds.+func List(params *stripe.RefundListParams) *Iter {+ return getC().List(params)+}++// List returns a list of refunds.+func (c Client) List(listParams *stripe.RefundListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.RefundList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/refunds", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for refunds.+type Iter struct {+ *stripe.Iter+}++// Refund returns the refund which the iterator is currently pointing to.+func (i *Iter) Refund() *stripe.Refund {+ return i.Current().(*stripe.Refund)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/reporting/reportrun/client.go b/vendor/github.com/stripe/stripe-go/reporting/reportrun/client.gonew file mode 100644index 000000000..c4150823e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reporting/reportrun/client.go@@ -0,0 +1,76 @@+// Package reportrun provides API functions related to report runs.+//+// For more details, see: https://stripe.com/docs/api/go#reporting_report_run+package reportrun++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /reporting/report_runs APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new report run.+func New(params *stripe.ReportRunParams) (*stripe.ReportRun, error) {+ return getC().New(params)+}++// New creates a new report run.+func (c Client) New(params *stripe.ReportRunParams) (*stripe.ReportRun, error) {+ reportrun := &stripe.ReportRun{}+ err := c.B.Call(http.MethodPost, "/v1/reporting/report_runs", c.Key, params, reportrun)+ return reportrun, err+}++// Get returns the details of a report run.+func Get(id string, params *stripe.ReportRunParams) (*stripe.ReportRun, error) {+ return getC().Get(id, params)+}++// Get returns the details of a report run.+func (c Client) Get(id string, params *stripe.ReportRunParams) (*stripe.ReportRun, error) {+ path := stripe.FormatURLPath("/v1/reporting/report_runs/%s", id)+ reportrun := &stripe.ReportRun{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, reportrun)+ return reportrun, err+}++// List returns a list of report runs.+func List(params *stripe.ReportRunListParams) *Iter {+ return getC().List(params)+}++// List returns a list of report runs.+func (c Client) List(listParams *stripe.ReportRunListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ReportRunList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/reporting/report_runs", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for report runs.+type Iter struct {+ *stripe.Iter+}++// ReportRun returns the report run which the iterator is currently pointing to.+func (i *Iter) ReportRun() *stripe.ReportRun {+ return i.Current().(*stripe.ReportRun)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/reporting/reporttype/client.go b/vendor/github.com/stripe/stripe-go/reporting/reporttype/client.gonew file mode 100644index 000000000..05946a8d4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reporting/reporttype/client.go@@ -0,0 +1,64 @@+// Package reporttype provides API functions related to report types.+//+// For more details, see: https://stripe.com/docs/api/go#reporting_report_type+package reporttype++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /reporting/report_types APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of a report type.+func Get(id string, params *stripe.ReportTypeParams) (*stripe.ReportType, error) {+ return getC().Get(id, params)+}++// Get returns the details of a report type.+func (c Client) Get(id string, params *stripe.ReportTypeParams) (*stripe.ReportType, error) {+ path := stripe.FormatURLPath("/v1/reporting/report_types/%s", id)+ reporttype := &stripe.ReportType{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, reporttype)+ return reporttype, err+}++// List returns a list of report types.+func List(params *stripe.ReportTypeListParams) *Iter {+ return getC().List(params)+}++// List returns a list of report types.+func (c Client) List(listParams *stripe.ReportTypeListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ReportTypeList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/reporting/report_types", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for report types.+type Iter struct {+ *stripe.Iter+}++// ReportType returns the report type which the iterator is currently pointing to.+func (i *Iter) ReportType() *stripe.ReportType {+ return i.Current().(*stripe.ReportType)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/reporting_reportrun.go b/vendor/github.com/stripe/stripe-go/reporting_reportrun.gonew file mode 100644index 000000000..728d43d9c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reporting_reportrun.go@@ -0,0 +1,65 @@+package stripe++// ReportRunStatus is the possible values for status on a report run.+type ReportRunStatus string++// List of values that ReportRunStatus can take.+const (+ ReportRunStatusFailed ReportRunStatus = "failed"+ ReportRunStatusPending ReportRunStatus = "pending"+ ReportRunStatusSucceeded ReportRunStatus = "succeeded"+)++// ReportRunParametersParams is the set of parameters that can be used when creating a report run.+type ReportRunParametersParams struct {+ ConnectedAccount *string `form:"connected_account"`+ Currency *string `form:"currency"`+ IntervalEnd *int64 `form:"interval_end"`+ IntervalStart *int64 `form:"interval_start"`+ Payout *string `form:"payout"`+ ReportingCategory *string `form:"reporting_category"`+}++// ReportRunParams is the set of parameters that can be used when creating a report run.+type ReportRunParams struct {+ Params `form:"*"`+ Parameters *ReportRunParametersParams `form:"parameters"`+ ReportType *string `form:"report_type"`+}++// ReportRunListParams is the set of parameters that can be used when listing report runs.+type ReportRunListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// ReportRunParameters describes the parameters hash on a report run.+type ReportRunParameters struct {+ ConnectedAccount string `json:"connected_account"`+ Currency Currency `json:"currency"`+ IntervalEnd int64 `json:"interval_end"`+ IntervalStart int64 `json:"interval_start"`+ Payout string `json:"payout"`+ ReportingCategory string `json:"reporting_category"`+}++// ReportRun is the resource representing a report run.+type ReportRun struct {+ Created int64 `json:"created"`+ Error string `json:"error"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Object string `json:"object"`+ Parameters *ReportRunParameters `json:"parameters"`+ ReportType string `json:"report_type"`+ Result *File `json:"result"`+ Status ReportRunStatus `json:"status"`+ SucceededAt int64 `json:"succeeded_at"`+}++// ReportRunList is a list of report runs as retrieved from a list endpoint.+type ReportRunList struct {+ ListMeta+ Data []*ReportRun `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/reporting_reporttype.go b/vendor/github.com/stripe/stripe-go/reporting_reporttype.gonew file mode 100644index 000000000..36503b40e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reporting_reporttype.go@@ -0,0 +1,29 @@+package stripe++// ReportTypeListParams is the set of parameters that can be used when listing report types.+type ReportTypeListParams struct {+ ListParams `form:"*"`+}++// ReportTypeParams is the set of parameters that can be used when retrieving a report type.+type ReportTypeParams struct {+ Params `form:"*"`+}++// ReportType is the resource representing a report type.+type ReportType struct {+ Created int64 `json:"created"`+ DataAvailableEnd int64 `json:"data_available_end"`+ DataAvailableStart int64 `json:"data_available_start"`+ ID string `json:"id"`+ Name string `json:"name"`+ Object string `json:"object"`+ Updated int64 `json:"updated"`+ Version int64 `json:"version"`+}++// ReportTypeList is a list of report types as retrieved from a list endpoint.+type ReportTypeList struct {+ ListMeta+ Data []*ReportType `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/reversal.go b/vendor/github.com/stripe/stripe-go/reversal.gonew file mode 100644index 000000000..05602bcdc--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reversal.go@@ -0,0 +1,53 @@+package stripe++import "encoding/json"++// ReversalParams is the set of parameters that can be used when reversing a transfer.+type ReversalParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ RefundApplicationFee *bool `form:"refund_application_fee"`+ Transfer *string `form:"-"` // Included in URL+}++// ReversalListParams is the set of parameters that can be used when listing reversals.+type ReversalListParams struct {+ ListParams `form:"*"`+ Transfer *string `form:"-"` // Included in URL+}++// Reversal represents a transfer reversal.+type Reversal struct {+ Amount int64 `json:"amount"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ ID string `json:"id"`+ Metadata map[string]string `json:"metadata"`+ Transfer string `json:"transfer"`+}++// ReversalList is a list of object for reversals.+type ReversalList struct {+ ListMeta+ Data []*Reversal `json:"data"`+}++// UnmarshalJSON handles deserialization of a Reversal.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *Reversal) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type reversal Reversal+ var v reversal+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = Reversal(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/reversal/client.go b/vendor/github.com/stripe/stripe-go/reversal/client.gonew file mode 100644index 000000000..be5ab28bf--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/reversal/client.go@@ -0,0 +1,97 @@+// Package reversal provides the /transfers/reversals APIs+package reversal++import (+ "fmt"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /transfers/reversals APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new transfer reversal.+func New(params *stripe.ReversalParams) (*stripe.Reversal, error) {+ return getC().New(params)+}++// New creates a new transfer reversal.+func (c Client) New(params *stripe.ReversalParams) (*stripe.Reversal, error) {+ path := stripe.FormatURLPath("/v1/transfers/%s/reversals", stripe.StringValue(params.Transfer))+ reversal := &stripe.Reversal{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, reversal)+ return reversal, err+}++// Get returns the details of a transfer reversal.+func Get(id string, params *stripe.ReversalParams) (*stripe.Reversal, error) {+ return getC().Get(id, params)+}++// Get returns the details of a transfer reversal.+func (c Client) Get(id string, params *stripe.ReversalParams) (*stripe.Reversal, error) {+ if params == nil {+ return nil, fmt.Errorf("params cannot be nil, and params.Transfer must be set")+ }++ path := stripe.FormatURLPath("/v1/transfers/%s/reversals/%s",+ stripe.StringValue(params.Transfer), id)+ reversal := &stripe.Reversal{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, reversal)+ return reversal, err+}++// Update updates a transfer reversal's properties.+func Update(id string, params *stripe.ReversalParams) (*stripe.Reversal, error) {+ return getC().Update(id, params)+}++// Update updates a transfer reversal's properties.+func (c Client) Update(id string, params *stripe.ReversalParams) (*stripe.Reversal, error) {+ path := stripe.FormatURLPath("/v1/transfers/%s/reversals/%s",+ stripe.StringValue(params.Transfer), id)+ reversal := &stripe.Reversal{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, reversal)+ return reversal, err+}++// List returns a list of transfer reversals.+func List(params *stripe.ReversalListParams) *Iter {+ return getC().List(params)+}++// List returns a list of transfer reversals.+func (c Client) List(listParams *stripe.ReversalListParams) *Iter {+ path := stripe.FormatURLPath("/v1/transfers/%s/reversals", stripe.StringValue(listParams.Transfer))++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.ReversalList{}+ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for transfer reversals.+type Iter struct {+ *stripe.Iter+}++// Reversal returns the transfer reversal which the iterator is currently pointing to.+func (i *Iter) Reversal() *stripe.Reversal {+ return i.Current().(*stripe.Reversal)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/review.go b/vendor/github.com/stripe/stripe-go/review.gonew file mode 100644index 000000000..3ef33f233--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/review.go@@ -0,0 +1,71 @@+package stripe++import "encoding/json"++// ReviewReasonType describes the reason why the review is open or closed.+type ReviewReasonType string++// List of values that ReviewReasonType can take.+const (+ ReviewReasonApproved ReviewReasonType = "approved"+ ReviewReasonDisputed ReviewReasonType = "disputed"+ ReviewReasonManual ReviewReasonType = "manual"+ ReviewReasonRefunded ReviewReasonType = "refunded"+ ReviewReasonRefundedAsFraud ReviewReasonType = "refunded_as_fraud"+ ReviewReasonRule ReviewReasonType = "rule"+)++// ReviewParams is the set of parameters that can be used when approving a review.+type ReviewParams struct {+ Params `form:"*"`+}++// ReviewApproveParams is the set of parameters that can be used when approving a review.+type ReviewApproveParams struct {+ Params `form:"*"`+}++// ReviewListParams is the set of parameters that can be used when listing reviews.+type ReviewListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// Review is the resource representing a Radar review.+// For more details see https://stripe.com/docs/api#reviews.+type Review struct {+ Charge *Charge `json:"charge"`+ Created int64 `json:"created"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Object string `json:"object"`+ Open bool `json:"open"`+ PaymentIntent *PaymentIntent `json:"payment_intent"`+ Reason ReviewReasonType `json:"reason"`+}++// ReviewList is a list of reviews as retrieved from a list endpoint.+type ReviewList struct {+ ListMeta+ Data []*Review `json:"data"`+}++// UnmarshalJSON handles deserialization of a Review.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (r *Review) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ r.ID = id+ return nil+ }++ type review Review+ var v review+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *r = Review(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/sigma/scheduledqueryrun/client.go b/vendor/github.com/stripe/stripe-go/sigma/scheduledqueryrun/client.gonew file mode 100644index 000000000..06e8eaac9--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sigma/scheduledqueryrun/client.go@@ -0,0 +1,64 @@+// Package scheduledqueryrun provides API functions related to scheduled query runs.+//+// For more details, see: https://stripe.com/docs/api#scheduled_queries+package scheduledqueryrun++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /sigma/scheduled_query_runs APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Get returns the details of an scheduled query run.+func Get(id string, params *stripe.SigmaScheduledQueryRunParams) (*stripe.SigmaScheduledQueryRun, error) {+ return getC().Get(id, params)+}++// Get returns the details of an scheduled query run.+func (c Client) Get(id string, params *stripe.SigmaScheduledQueryRunParams) (*stripe.SigmaScheduledQueryRun, error) {+ path := stripe.FormatURLPath("/v1/sigma/scheduled_query_runs/%s", id)+ run := &stripe.SigmaScheduledQueryRun{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, run)+ return run, err+}++// List returns a list of scheduled query runs.+func List(params *stripe.SigmaScheduledQueryRunListParams) *Iter {+ return getC().List(params)+}++// List returns a list of scheduled query runs.+func (c Client) List(listParams *stripe.SigmaScheduledQueryRunListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SigmaScheduledQueryRunList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/sigma/scheduled_query_runs", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for scheduled query runs.+type Iter struct {+ *stripe.Iter+}++// SigmaScheduledQueryRun returns the scheduled query run which the iterator is currently pointing to.+func (i *Iter) SigmaScheduledQueryRun() *stripe.SigmaScheduledQueryRun {+ return i.Current().(*stripe.SigmaScheduledQueryRun)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/sigma_scheduledqueryrun.go b/vendor/github.com/stripe/stripe-go/sigma_scheduledqueryrun.gonew file mode 100644index 000000000..9f9690cee--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sigma_scheduledqueryrun.go@@ -0,0 +1,64 @@+package stripe++import "encoding/json"++// SigmaScheduledQueryRunStatus is the possible values for status for a scheduled query run.+type SigmaScheduledQueryRunStatus string++// List of values that SigmaScheduledQueryRunStatus can take.+const (+ SigmaScheduledQueryRunStatusCanceled SigmaScheduledQueryRunStatus = "canceled"+ SigmaScheduledQueryRunStatusCompleted SigmaScheduledQueryRunStatus = "completed"+ SigmaScheduledQueryRunStatusFailed SigmaScheduledQueryRunStatus = "failed"+ SigmaScheduledQueryRunStatusTimedOut SigmaScheduledQueryRunStatus = "timed_out"+)++// SigmaScheduledQueryRunParams is the set of parameters that can be used when updating a scheduled query run.+type SigmaScheduledQueryRunParams struct {+ Params `form:"*"`+}++// SigmaScheduledQueryRunListParams is the set of parameters that can be used when listing scheduled query runs.+type SigmaScheduledQueryRunListParams struct {+ ListParams `form:"*"`+}++// SigmaScheduledQueryRun is the resource representing a scheduled query run.+type SigmaScheduledQueryRun struct {+ Created int64 `json:"created"`+ DataLoadTime int64 `json:"data_load_time"`+ Error string `json:"error"`+ File *File `json:"file"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Object string `json:"object"`+ ResultAvailableUntil int64 `json:"result_available_until"`+ SQL string `json:"sql"`+ Status SigmaScheduledQueryRunStatus `json:"status"`+ Query string `json:"query"`+}++// SigmaScheduledQueryRunList is a list of scheduled query runs as retrieved from a list endpoint.+type SigmaScheduledQueryRunList struct {+ ListMeta+ Data []*SigmaScheduledQueryRun `json:"data"`+}++// UnmarshalJSON handles deserialization of an SigmaScheduledQueryRun.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (i *SigmaScheduledQueryRun) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ i.ID = id+ return nil+ }++ type sigmaScheduledQueryRun SigmaScheduledQueryRun+ var v sigmaScheduledQueryRun+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *i = SigmaScheduledQueryRun(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/sku.go b/vendor/github.com/stripe/stripe-go/sku.gonew file mode 100644index 000000000..3d976d4e1--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sku.go@@ -0,0 +1,106 @@+package stripe++import "encoding/json"++// SKUInventoryType describe's the possible value for inventory type+type SKUInventoryType string++// List of values that SKUInventoryType can take.+const (+ SKUInventoryTypeBucket SKUInventoryType = "bucket"+ SKUInventoryTypeFinite SKUInventoryType = "finite"+ SKUInventoryTypeInfinite SKUInventoryType = "infinite"+)++// SKUInventoryValue describe's the possible value for inventory value+type SKUInventoryValue string++// List of values that SKUInventoryValue can take.+const (+ SKUInventoryValueInStock SKUInventoryValue = "in_stock"+ SKUInventoryValueLimited SKUInventoryValue = "limited"+ SKUInventoryValueOutOfStock SKUInventoryValue = "out_of_stock"+)++// InventoryParams is the set of parameters allowed as inventory on a SKU.+type InventoryParams struct {+ Quantity *int64 `form:"quantity"`+ Type *string `form:"type"`+ Value *string `form:"value"`+}++// SKUParams is the set of parameters allowed on SKU creation or update.+type SKUParams struct {+ Params `form:"*"`+ Active *bool `form:"active"`+ Attributes map[string]string `form:"attributes"`+ Currency *string `form:"currency"`+ Description *string `form:"description"`+ ID *string `form:"id"`+ Image *string `form:"image"`+ Inventory *InventoryParams `form:"inventory"`+ PackageDimensions *PackageDimensionsParams `form:"package_dimensions"`+ Price *int64 `form:"price"`+ Product *string `form:"product"`+}++// Inventory represents the inventory options of a SKU.+type Inventory struct {+ Quantity int64 `json:"quantity"`+ Type SKUInventoryType `json:"type"`+ Value SKUInventoryValue `json:"value"`+}++// SKU is the resource representing a SKU.+// For more details see https://stripe.com/docs/api#skus.+type SKU struct {+ Active bool `json:"active"`+ Attributes map[string]string `json:"attributes"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ ID string `json:"id"`+ Image string `json:"image"`+ Inventory *Inventory `json:"inventory"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ PackageDimensions *PackageDimensions `json:"package_dimensions"`+ Price int64 `json:"price"`+ Product *Product `json:"product"`+ Updated int64 `json:"updated"`+}++// SKUList is a list of SKUs as returned from a list endpoint.+type SKUList struct {+ ListMeta+ Data []*SKU `json:"data"`+}++// SKUListParams is the set of parameters that can be used when listing SKUs.+type SKUListParams struct {+ ListParams `form:"*"`+ Active *bool `form:"active"`+ Attributes map[string]string `form:"attributes"`+ IDs []*string `form:"ids"`+ InStock *bool `form:"in_stock"`+ Product *string `form:"product"`+}++// UnmarshalJSON handles deserialization of a SKU.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (s *SKU) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ s.ID = id+ return nil+ }++ type sku SKU+ var v sku+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *s = SKU(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/sku/client.go b/vendor/github.com/stripe/stripe-go/sku/client.gonew file mode 100644index 000000000..961914aa5--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sku/client.go@@ -0,0 +1,100 @@+package sku++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /skus APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new SKU.+func New(params *stripe.SKUParams) (*stripe.SKU, error) {+ return getC().New(params)+}++// New creates a new SKU.+func (c Client) New(params *stripe.SKUParams) (*stripe.SKU, error) {+ s := &stripe.SKU{}+ err := c.B.Call(http.MethodPost, "/v1/skus", c.Key, params, s)+ return s, err+}++// Update updates a SKU's properties.+func Update(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ return getC().Update(id, params)+}++// Update updates a SKU's properties.+func (c Client) Update(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ path := stripe.FormatURLPath("/v1/skus/%s", id)+ s := &stripe.SKU{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, s)+ return s, err+}++// Get returns the details of a SKU.+func Get(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ return getC().Get(id, params)+}++// Get returns the details of a SKU.+func (c Client) Get(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ path := stripe.FormatURLPath("/v1/skus/%s", id)+ s := &stripe.SKU{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, s)+ return s, err+}++// List returns a list of SKUs.+func List(params *stripe.SKUListParams) *Iter {+ return getC().List(params)+}++// List returns a list of SKUs.+func (c Client) List(listParams *stripe.SKUListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SKUList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/skus", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Del removes a SKU.+func Del(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ return getC().Del(id, params)+}++// Del removes a SKU.+func (c Client) Del(id string, params *stripe.SKUParams) (*stripe.SKU, error) {+ path := stripe.FormatURLPath("/v1/skus/%s", id)+ s := &stripe.SKU{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, s)++ return s, err+}++// Iter is an iterator for SKUs.+type Iter struct {+ *stripe.Iter+}++// SKU returns the SKU which the iterator is currently pointing to.+func (i *Iter) SKU() *stripe.SKU {+ return i.Current().(*stripe.SKU)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/source.go b/vendor/github.com/stripe/stripe-go/source.gonew file mode 100644index 000000000..5451b9ce6--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/source.go@@ -0,0 +1,283 @@+package stripe++import (+ "encoding/json"++ "github.com/stripe/stripe-go/form"+)++// SourceCodeVerificationFlowStatus represents the possible statuses of a code verification flow.+type SourceCodeVerificationFlowStatus string++// List of values that SourceCodeVerificationFlowStatus can take.+const (+ SourceCodeVerificationFlowStatusFailed SourceCodeVerificationFlowStatus = "failed"+ SourceCodeVerificationFlowStatusPending SourceCodeVerificationFlowStatus = "pending"+ SourceCodeVerificationFlowStatusSucceeded SourceCodeVerificationFlowStatus = "succeeded"+)++// SourceFlow represents the possible flows of a source object.+type SourceFlow string++// List of values that SourceFlow can take.+const (+ SourceFlowCodeVerification SourceFlow = "code_verification"+ SourceFlowNone SourceFlow = "none"+ SourceFlowReceiver SourceFlow = "receiver"+ SourceFlowRedirect SourceFlow = "redirect"+)++// SourceMandateAcceptanceStatus represents the possible failure reasons of a redirect flow.+type SourceMandateAcceptanceStatus string++// List of values that SourceMandateAcceptanceStatus can take.+const (+ SourceMandateAcceptanceStatusAccepted SourceMandateAcceptanceStatus = "accepted"+ SourceMandateAcceptanceStatusRefused SourceMandateAcceptanceStatus = "refused"+)++// SourceMandateNotificationMethod represents the possible methods of notification for a mandate.+type SourceMandateNotificationMethod string++// List of values that SourceMandateNotificationMethod can take.+const (+ SourceMandateNotificationMethodEmail SourceMandateNotificationMethod = "email"+ SourceMandateNotificationMethodManual SourceMandateNotificationMethod = "manual"+ SourceMandateNotificationMethodNone SourceMandateNotificationMethod = "none"+)++// SourceRedirectFlowFailureReason represents the possible failure reasons of a redirect flow.+type SourceRedirectFlowFailureReason string++// List of values that SourceRedirectFlowFailureReason can take.+const (+ SourceRedirectFlowFailureReasonDeclined SourceRedirectFlowFailureReason = "declined"+ SourceRedirectFlowFailureReasonProcessingError SourceRedirectFlowFailureReason = "processing_error"+ SourceRedirectFlowFailureReasonUserAbort SourceRedirectFlowFailureReason = "user_abort"+)++// SourceRedirectFlowStatus represents the possible statuses of a redirect flow.+type SourceRedirectFlowStatus string++// List of values that SourceRedirectFlowStatus can take.+const (+ SourceRedirectFlowStatusFailed SourceRedirectFlowStatus = "failed"+ SourceRedirectFlowStatusNotRequired SourceRedirectFlowStatus = "not_required"+ SourceRedirectFlowStatusPending SourceRedirectFlowStatus = "pending"+ SourceRedirectFlowStatusSucceeded SourceRedirectFlowStatus = "succeeded"+)++// SourceRefundAttributesMethod are the possible method to retrieve a receiver's refund attributes.+type SourceRefundAttributesMethod string++// List of values that SourceRefundAttributesMethod can take.+const (+ SourceRefundAttributesMethodEmail SourceRefundAttributesMethod = "email"+ SourceRefundAttributesMethodManual SourceRefundAttributesMethod = "manual"+)++// SourceRefundAttributesStatus are the possible status of a receiver's refund attributes.+type SourceRefundAttributesStatus string++// List of values that SourceRefundAttributesStatus can take.+const (+ SourceRefundAttributesStatusAvailable SourceRefundAttributesStatus = "available"+ SourceRefundAttributesStatusMissing SourceRefundAttributesStatus = "missing"+ SourceRefundAttributesStatusRequested SourceRefundAttributesStatus = "requested"+)++// SourceStatus represents the possible statuses of a source object.+type SourceStatus string++// List of values that SourceStatus can take.+const (+ SourceStatusCanceled SourceStatus = "canceled"+ SourceStatusChargeable SourceStatus = "chargeable"+ SourceStatusConsumed SourceStatus = "consumed"+ SourceStatusFailed SourceStatus = "failed"+ SourceStatusPending SourceStatus = "pending"+)++// SourceUsage represents the possible usages of a source object.+type SourceUsage string++// List of values that SourceUsage can take.+const (+ SourceUsageReusable SourceUsage = "reusable"+ SourceUsageSingleUse SourceUsage = "single_use"+)++// SourceOwnerParams is the set of parameters allowed for the owner hash on+// source creation or update.+type SourceOwnerParams struct {+ Address *AddressParams `form:"address"`+ Email *string `form:"email"`+ Name *string `form:"name"`+ Phone *string `form:"phone"`+}++// RedirectParams is the set of parameters allowed for the redirect hash on+// source creation or update.+type RedirectParams struct {+ ReturnURL *string `form:"return_url"`+}++// SourceObjectParams is the set of parameters allowed on source creation or update.+type SourceObjectParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ Flow *string `form:"flow"`+ Mandate *SourceMandateParams `form:"mandate"`+ OriginalSource *string `form:"original_source"`+ Owner *SourceOwnerParams `form:"owner"`+ Receiver *SourceReceiverParams `form:"receiver"`+ Redirect *RedirectParams `form:"redirect"`+ StatementDescriptor *string `form:"statement_descriptor"`+ Token *string `form:"token"`+ Type *string `form:"type"`+ TypeData map[string]string `form:"-"`+ Usage *string `form:"usage"`+}++// SourceMandateAcceptanceParams describes the set of parameters allowed for the `acceptance`+// hash on source creation or update.+type SourceMandateAcceptanceParams struct {+ Date *int64 `form:"date"`+ IP *string `form:"ip"`+ Status *string `form:"status"`+ UserAgent *string `form:"user_agent"`+}++// SourceMandateParams describes the set of parameters allowed for the `mandate` hash on+// source creation or update.+type SourceMandateParams struct {+ Acceptance *SourceMandateAcceptanceParams `form:"acceptance"`+ NotificationMethod *string `form:"notification_method"`+}++// SourceReceiverParams is the set of parameters allowed for the `receiver` hash on+// source creation or update.+type SourceReceiverParams struct {+ RefundAttributesMethod *string `form:"refund_attributes_method"`+}++// SourceObjectDetachParams is the set of parameters that can be used when detaching+// a source from a customer.+type SourceObjectDetachParams struct {+ Params `form:"*"`+ Customer *string `form:"-"`+}++// SourceOwner describes the owner hash on a source.+type SourceOwner struct {+ Address *Address `json:"address,omitempty"`+ Email string `json:"email"`+ Name string `json:"name"`+ Phone string `json:"phone"`+ VerifiedAddress *Address `json:"verified_address,omitempty"`+ VerifiedEmail string `json:"verified_email"`+ VerifiedName string `json:"verified_name"`+ VerifiedPhone string `json:"verified_phone"`+}++// RedirectFlow informs of the state of a redirect authentication flow.+type RedirectFlow struct {+ FailureReason SourceRedirectFlowFailureReason `json:"failure_reason"`+ ReturnURL string `json:"return_url"`+ Status SourceRedirectFlowStatus `json:"status"`+ URL string `json:"url"`+}++// ReceiverFlow informs of the state of a receiver authentication flow.+type ReceiverFlow struct {+ Address string `json:"address"`+ AmountCharged int64 `json:"amount_charged"`+ AmountReceived int64 `json:"amount_received"`+ AmountReturned int64 `json:"amount_returned"`+ RefundAttributesMethod SourceRefundAttributesMethod `json:"refund_attributes_method"`+ RefundAttributesStatus SourceRefundAttributesStatus `json:"refund_attributes_status"`+}++// CodeVerificationFlow informs of the state of a verification authentication flow.+type CodeVerificationFlow struct {+ AttemptsRemaining int64 `json:"attempts_remaining"`+ Status SourceCodeVerificationFlowStatus `json:"status"`+}++// SourceMandateAcceptance describes a source mandate acceptance state.+type SourceMandateAcceptance struct {+ Date int64 `json:"date"`+ IP string `json:"ip"`+ Status SourceMandateAcceptanceStatus `json:"status"`+ UserAgent string `json:"user_agent"`+}++// SourceMandate describes a source mandate.+type SourceMandate struct {+ Acceptance *SourceMandateAcceptance `json:"acceptance"`+ NotificationMethod SourceMandateNotificationMethod `json:"notification_method"`+ Reference string `json:"reference"`+ URL string `json:"url"`+}++// Source is the resource representing a Source.+// For more details see https://stripe.com/docs/api#sources.+type Source struct {+ Amount int64 `json:"amount"`+ ClientSecret string `json:"client_secret"`+ CodeVerification *CodeVerificationFlow `json:"code_verification,omitempty"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Flow SourceFlow `json:"flow"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Mandate *SourceMandate `json:"mandate"`+ Metadata map[string]string `json:"metadata"`+ Owner *SourceOwner `json:"owner"`+ Receiver *ReceiverFlow `json:"receiver,omitempty"`+ Redirect *RedirectFlow `json:"redirect,omitempty"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status SourceStatus `json:"status"`+ Type string `json:"type"`+ TypeData map[string]interface{}+ Usage SourceUsage `json:"usage"`+}++// AppendTo implements custom encoding logic for SourceObjectParams so that the special+// "TypeData" value for is sent as the correct parameter based on the Source type+func (p *SourceObjectParams) AppendTo(body *form.Values, keyParts []string) {+ if len(p.TypeData) > 0 && p.Type == nil {+ panic("You can not fill TypeData if you don't explicitly set Type")+ }++ for k, vs := range p.TypeData {+ body.Add(form.FormatKey(append(keyParts, StringValue(p.Type), k)), vs)+ }+}++// UnmarshalJSON handles deserialization of an Source. This custom unmarshaling+// is needed to extract the type specific data (accessible under `TypeData`)+// but stored in JSON under a hash named after the `type` of the source.+func (s *Source) UnmarshalJSON(data []byte) error {+ type source Source+ var v source+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }+ *s = Source(v)++ var raw map[string]interface{}+ if err := json.Unmarshal(data, &raw); err != nil {+ return err+ }++ if d, ok := raw[s.Type]; ok {+ if m, ok := d.(map[string]interface{}); ok {+ s.TypeData = m+ }+ }++ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/source/client.go b/vendor/github.com/stripe/stripe-go/source/client.gonew file mode 100644index 000000000..ea043b773--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/source/client.go@@ -0,0 +1,74 @@+package source++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke /sources APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new source.+func New(params *stripe.SourceObjectParams) (*stripe.Source, error) {+ return getC().New(params)+}++// New creates a new source.+func (c Client) New(params *stripe.SourceObjectParams) (*stripe.Source, error) {+ p := &stripe.Source{}+ err := c.B.Call(http.MethodPost, "/v1/sources", c.Key, params, p)+ return p, err+}++// Get returns the details of a source.+func Get(id string, params *stripe.SourceObjectParams) (*stripe.Source, error) {+ return getC().Get(id, params)+}++// Get returns the details of a source.+func (c Client) Get(id string, params *stripe.SourceObjectParams) (*stripe.Source, error) {+ path := stripe.FormatURLPath("/v1/sources/%s", id)+ source := &stripe.Source{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, source)+ return source, err+}++// Update updates a source's properties.+func Update(id string, params *stripe.SourceObjectParams) (*stripe.Source, error) {+ return getC().Update(id, params)+}++// Update updates a source's properties.+func (c Client) Update(id string, params *stripe.SourceObjectParams) (*stripe.Source, error) {+ path := stripe.FormatURLPath("/v1/sources/%s", id)+ source := &stripe.Source{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, source)+ return source, err+}++// Detach detaches the source from a customer.+func Detach(id string, params *stripe.SourceObjectDetachParams) (*stripe.Source, error) {+ return getC().Detach(id, params)+}++// Detach detaches the source from a customer.+func (c Client) Detach(id string, params *stripe.SourceObjectDetachParams) (*stripe.Source, error) {+ if params.Customer == nil {+ return nil, errors.New("Invalid source detach params: Customer needs to be set")+ }++ path := stripe.FormatURLPath("/v1/customers/%s/sources/%s",+ stripe.StringValue(params.Customer), id)+ source := &stripe.Source{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, source)+ return source, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/sourcetransaction.go b/vendor/github.com/stripe/stripe-go/sourcetransaction.gonew file mode 100644index 000000000..ea87590d0--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sourcetransaction.go@@ -0,0 +1,55 @@+package stripe++import "encoding/json"++// SourceTransactionListParams is the set of parameters that can be used when listing SourceTransactions.+type SourceTransactionListParams struct {+ ListParams `form:"*"`+ Source *string `form:"-"` // Sent in with the URL+}++// SourceTransactionList is a list object for SourceTransactions.+type SourceTransactionList struct {+ ListMeta+ Data []*SourceTransaction `json:"data"`+}++// SourceTransaction is the resource representing a Stripe source transaction.+type SourceTransaction struct {+ Amount int64 `json:"amount"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ CustomerData string `json:"customer_data"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Source string `json:"source"`+ Type string `json:"type"`+ TypeData map[string]interface{}+}++// UnmarshalJSON handles deserialization of a SourceTransaction. This custom+// unmarshaling is needed to extract the type specific data (accessible under+// `TypeData`) but stored in JSON under a hash named after the `type` of the+// source transaction.+func (t *SourceTransaction) UnmarshalJSON(data []byte) error {+ type sourceTransaction SourceTransaction+ var v sourceTransaction+ err := json.Unmarshal(data, &v)+ if err != nil {+ return err+ }+ *t = SourceTransaction(v)++ var raw map[string]interface{}+ err = json.Unmarshal(data, &raw)+ if err != nil {+ return err+ }+ if d, ok := raw[t.Type]; ok {+ if m, ok := d.(map[string]interface{}); ok {+ t.TypeData = m+ }+ }++ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/sourcetransaction/client.go b/vendor/github.com/stripe/stripe-go/sourcetransaction/client.gonew file mode 100644index 000000000..989cdce48--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sourcetransaction/client.go@@ -0,0 +1,65 @@+// Package sourcetransaction provides the /source/transactions APIs.+package sourcetransaction++import (+ "errors"+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /sources/:source_id/transactions APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// List returns a list of source transactions.+func List(params *stripe.SourceTransactionListParams) *Iter {+ return getC().List(params)+}++// List returns a list of source transactions.+func (c Client) List(listParams *stripe.SourceTransactionListParams) *Iter {+ var outerErr error+ var path string++ if listParams == nil || listParams.Source == nil {+ outerErr = errors.New("Invalid source transaction params: Source needs to be set")+ } else {+ path = stripe.FormatURLPath("/v1/sources/%s/source_transactions",+ stripe.StringValue(listParams.Source))+ }++ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SourceTransactionList{}++ if outerErr != nil {+ return nil, list.ListMeta, outerErr+ }++ err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for source transactions.+type Iter struct {+ *stripe.Iter+}++// SourceTransaction returns the source transaction which the iterator is currently pointing to.+func (i *Iter) SourceTransaction() *stripe.SourceTransaction {+ return i.Current().(*stripe.SourceTransaction)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/stripe.go b/vendor/github.com/stripe/stripe-go/stripe.gonew file mode 100644index 000000000..b45e8e264--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/stripe.go@@ -0,0 +1,904 @@+// Package stripe provides the binding for Stripe REST APIs.+package stripe++import (+ "bytes"+ "encoding/json"+ "errors"+ "fmt"+ "io"+ "io/ioutil"+ "log"+ "math/rand"+ "net/http"+ "net/url"+ "os"+ "os/exec"+ "reflect"+ "runtime"+ "strings"+ "sync"+ "time"++ "github.com/stripe/stripe-go/form"+)++//+// Public constants+//++const (+ // APIBackend is a constant representing the API service backend.+ APIBackend SupportedBackend = "api"++ // APIURL is the URL of the API service backend.+ APIURL string = "https://api.stripe.com"++ // UnknownPlatform is the string returned as the system name if we couldn't get+ // one from `uname`.+ UnknownPlatform string = "unknown platform"++ // UploadsBackend is a constant representing the uploads service backend.+ UploadsBackend SupportedBackend = "uploads"++ // UploadsURL is the URL of the uploads service backend.+ UploadsURL string = "https://files.stripe.com"+)++//+// Public variables+//++// Key is the Stripe API key used globally in the binding.+var Key string++// LogLevel is the logging level for this library.+// 0: no logging+// 1: errors only+// 2: errors + informational (default)+// 3: errors + informational + debug+var LogLevel = 2++// Logger controls how stripe performs logging at a package level. It is useful+// to customise if you need it prefixed for your application to meet other+// requirements.+//+// This Logger will be inherited by any backends created by default, but will+// be overridden if a backend is created with GetBackendWithConfig.+var Logger Printfer++//+// Public types+//++// AppInfo contains information about the "app" which this integration belongs+// to. This should be reserved for plugins that wish to identify themselves+// with Stripe.+type AppInfo struct {+ Name string `json:"name"`+ PartnerID string `json:"partner_id"`+ URL string `json:"url"`+ Version string `json:"version"`+}++// formatUserAgent formats an AppInfo in a way that's suitable to be appended+// to a User-Agent string. Note that this format is shared between all+// libraries so if it's changed, it should be changed everywhere.+func (a *AppInfo) formatUserAgent() string {+ str := a.Name+ if a.Version != "" {+ str += "/" + a.Version+ }+ if a.URL != "" {+ str += " (" + a.URL + ")"+ }+ return str+}++// Backend is an interface for making calls against a Stripe service.+// This interface exists to enable mocking for during testing if needed.+type Backend interface {+ Call(method, path, key string, params ParamsContainer, v interface{}) error+ CallRaw(method, path, key string, body *form.Values, params *Params, v interface{}) error+ CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v interface{}) error+ SetMaxNetworkRetries(maxNetworkRetries int)+}++// BackendConfig is used to configure a new Stripe backend.+type BackendConfig struct {+ // HTTPClient is an HTTP client instance to use when making API requests.+ //+ // If left unset, it'll be set to a default HTTP client for the package.+ HTTPClient *http.Client++ // LogLevel is the logging level of the library and defined by:+ //+ // 0: no logging+ // 1: errors only+ // 2: errors + informational (default)+ // 3: errors + informational + debug+ //+ // Defaults to 0 (no logging), so please make sure to set this if you want+ // to see logging output in your custom configuration.+ LogLevel int++ // Logger is where this backend will write its logs.+ //+ // If left unset, it'll be set to Logger.+ Logger Printfer++ // MaxNetworkRetries sets maximum number of times that the library will+ // retry requests that appear to have failed due to an intermittent+ // problem.+ //+ // Defaults to 0.+ MaxNetworkRetries int++ // URL is the base URL to use for API paths.+ //+ // If left empty, it'll be set to the default for the SupportedBackend.+ URL string+}++// BackendImplementation is the internal implementation for making HTTP calls+// to Stripe.+//+// The public use of this struct is deprecated. It will be unexported in a+// future version.+type BackendImplementation struct {+ Type SupportedBackend+ URL string+ HTTPClient *http.Client+ MaxNetworkRetries int+ LogLevel int+ Logger Printfer++ // networkRetriesSleep indicates whether the backend should use the normal+ // sleep between retries.+ //+ // See also SetNetworkRetriesSleep.+ networkRetriesSleep bool+}++// Call is the Backend.Call implementation for invoking Stripe APIs.+func (s *BackendImplementation) Call(method, path, key string, params ParamsContainer, v interface{}) error {+ var body *form.Values+ var commonParams *Params++ if params != nil {+ // This is a little unfortunate, but Go makes it impossible to compare+ // an interface value to nil without the use of the reflect package and+ // its true disciples insist that this is a feature and not a bug.+ //+ // Here we do invoke reflect because (1) we have to reflect anyway to+ // use encode with the form package, and (2) the corresponding removal+ // of boilerplate that this enables makes the small performance penalty+ // worth it.+ reflectValue := reflect.ValueOf(params)++ if reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil() {+ commonParams = params.GetParams()+ body = &form.Values{}+ form.AppendTo(body, params)+ }+ }++ return s.CallRaw(method, path, key, body, commonParams, v)+}++// CallMultipart is the Backend.CallMultipart implementation for invoking Stripe APIs.+func (s *BackendImplementation) CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v interface{}) error {+ contentType := "multipart/form-data; boundary=" + boundary++ req, err := s.NewRequest(method, path, key, contentType, params)+ if err != nil {+ return err+ }++ if err := s.Do(req, body, v); err != nil {+ return err+ }++ return nil+}++// CallRaw is the implementation for invoking Stripe APIs internally without a backend.+func (s *BackendImplementation) CallRaw(method, path, key string, form *form.Values, params *Params, v interface{}) error {+ var body string+ if form != nil && !form.Empty() {+ body = form.Encode()++ // On `GET`, move the payload into the URL+ if method == http.MethodGet {+ path += "?" + body+ body = ""+ }+ }+ bodyBuffer := bytes.NewBufferString(body)++ req, err := s.NewRequest(method, path, key, "application/x-www-form-urlencoded", params)+ if err != nil {+ return err+ }++ if err := s.Do(req, bodyBuffer, v); err != nil {+ return err+ }++ return nil+}++// NewRequest is used by Call to generate an http.Request. It handles encoding+// parameters and attaching the appropriate headers.+func (s *BackendImplementation) NewRequest(method, path, key, contentType string, params *Params) (*http.Request, error) {+ if !strings.HasPrefix(path, "/") {+ path = "/" + path+ }++ path = s.URL + path++ // Body is set later by `Do`.+ req, err := http.NewRequest(method, path, nil)+ if err != nil {+ if s.LogLevel > 0 {+ s.Logger.Printf("Cannot create Stripe request: %v\n", err)+ }+ return nil, err+ }++ authorization := "Bearer " + key++ req.Header.Add("Authorization", authorization)+ req.Header.Add("Stripe-Version", apiversion)+ req.Header.Add("User-Agent", encodedUserAgent)+ req.Header.Add("Content-Type", contentType)+ req.Header.Add("X-Stripe-Client-User-Agent", encodedStripeUserAgent)++ if params != nil {+ if params.Context != nil {+ req = req.WithContext(params.Context)+ }++ if params.IdempotencyKey != nil {+ idempotencyKey := strings.TrimSpace(*params.IdempotencyKey)+ if len(idempotencyKey) > 255 {+ return nil, errors.New("cannot use an idempotency key longer than 255 characters")+ }++ req.Header.Add("Idempotency-Key", idempotencyKey)+ } else if isHTTPWriteMethod(method) {+ req.Header.Add("Idempotency-Key", NewIdempotencyKey())+ }++ if params.StripeAccount != nil {+ req.Header.Add("Stripe-Account", strings.TrimSpace(*params.StripeAccount))+ }++ for k, v := range params.Headers {+ for _, line := range v {+ req.Header.Add(k, line)+ }+ }+ }++ return req, nil+}++// Do is used by Call to execute an API request and parse the response. It uses+// the backend's HTTP client to execute the request and unmarshals the response+// into v. It also handles unmarshaling errors returned by the API.+func (s *BackendImplementation) Do(req *http.Request, body *bytes.Buffer, v interface{}) error {+ if s.LogLevel > 1 {+ s.Logger.Printf("Requesting %v %v%v\n", req.Method, req.URL.Host, req.URL.Path)+ }++ var res *http.Response+ var err error+ for retry := 0; ; {+ start := time.Now()++ // This might look a little strange, but we set the request's body+ // outside of `NewRequest` so that we can get a fresh version every+ // time.+ //+ // The background is that back in the era of old style HTTP, it was+ // safe to reuse `Request` objects, but with the addition of HTTP/2,+ // it's now only sometimes safe. Reusing a `Request` with a body will+ // break.+ //+ // See some details here:+ //+ // https://github.com/golang/go/issues/19653#issuecomment-341539160+ //+ // And our original bug report here:+ //+ // https://github.com/stripe/stripe-go/issues/642+ //+ // To workaround the problem, we put a fresh `Body` onto the `Request`+ // every time we execute it, and this seems to empirically resolve the+ // problem.+ if body != nil {+ // We can safely reuse the same buffer that we used to encode our body,+ // but return a new reader to it everytime so that each read is from+ // the beginning.+ reader := bytes.NewReader(body.Bytes())++ req.Body = nopReadCloser{reader}++ // And also add the same thing to `Request.GetBody`, which allows+ // `net/http` to get a new body in cases like a redirect. This is+ // usually not used, but it doesn't hurt to set it in case it's+ // needed. See:+ //+ // https://github.com/stripe/stripe-go/issues/710+ //+ req.GetBody = func() (io.ReadCloser, error) {+ reader := bytes.NewReader(body.Bytes())+ return nopReadCloser{reader}, nil+ }+ }++ res, err = s.HTTPClient.Do(req)++ if s.LogLevel > 2 {+ s.Logger.Printf("Request completed in %v (retry: %v)\n",+ time.Since(start), retry)+ }++ // If the response was okay, we're done, and it's safe to break out of+ // the retry loop.+ if !s.shouldRetry(err, res, retry) {+ break+ }++ if err != nil {+ if s.LogLevel > 0 {+ s.Logger.Printf("Request failed with error: %v\n", err)+ }+ } else {+ resBody, err := ioutil.ReadAll(res.Body)+ res.Body.Close()+ if err != nil {+ if s.LogLevel > 0 {+ s.Logger.Printf("Cannot read response: %v\n", err)+ }+ } else {+ if s.LogLevel > 0 {+ s.Logger.Printf("Request failed with body: %s (status: %v)\n", string(resBody), res.StatusCode)+ }+ }+ }++ sleepDuration := s.sleepTime(retry)+ retry++++ if s.LogLevel > 1 {+ s.Logger.Printf("Initiating retry %v for request %v %v%v after sleeping %v\n",+ retry, req.Method, req.URL.Host, req.URL.Path, sleepDuration)+ }++ time.Sleep(sleepDuration)+ }++ if err != nil {+ if s.LogLevel > 0 {+ s.Logger.Printf("Request failed: %v\n", err)+ }+ return err+ }++ defer res.Body.Close()++ resBody, err := ioutil.ReadAll(res.Body)+ if err != nil {+ if s.LogLevel > 0 {+ s.Logger.Printf("Cannot read response: %v\n", err)+ }+ return err+ }++ if res.StatusCode >= 400 {+ return s.ResponseToError(res, resBody)+ }++ if s.LogLevel > 2 {+ s.Logger.Printf("Response: %s\n", string(resBody))+ }++ if v != nil {+ return json.Unmarshal(resBody, v)+ }++ return nil+}++// ResponseToError converts a stripe response to an Error.+func (s *BackendImplementation) ResponseToError(res *http.Response, resBody []byte) error {+ var raw rawError+ if err := json.Unmarshal(resBody, &raw); err != nil {+ return err+ }+ // no error in resBody+ if raw.E == nil {+ err := errors.New(string(resBody))+ if s.LogLevel > 0 {+ s.Logger.Printf("Unparsable error returned from Stripe: %v\n", err)+ }+ return err+ }+ raw.E.HTTPStatusCode = res.StatusCode+ raw.E.RequestID = res.Header.Get("Request-Id")++ var typedError error+ switch raw.E.Type {+ case ErrorTypeAPI:+ typedError = &APIError{stripeErr: raw.E.Error}+ case ErrorTypeAPIConnection:+ typedError = &APIConnectionError{stripeErr: raw.E.Error}+ case ErrorTypeAuthentication:+ typedError = &AuthenticationError{stripeErr: raw.E.Error}+ case ErrorTypeCard:+ cardErr := &CardError{stripeErr: raw.E.Error}+ if raw.E.DeclineCode != nil {+ cardErr.DeclineCode = *raw.E.DeclineCode+ }+ typedError = cardErr+ case ErrorTypeInvalidRequest:+ typedError = &InvalidRequestError{stripeErr: raw.E.Error}+ case ErrorTypePermission:+ typedError = &PermissionError{stripeErr: raw.E.Error}+ case ErrorTypeRateLimit:+ typedError = &RateLimitError{stripeErr: raw.E.Error}+ }+ raw.E.Err = typedError++ if s.LogLevel > 0 {+ s.Logger.Printf("Error encountered from Stripe: %v\n", raw.E.Error)+ }+ return raw.E.Error+}++// SetMaxNetworkRetries sets max number of retries on failed requests+//+// This function is deprecated. Please use GetBackendWithConfig instead.+func (s *BackendImplementation) SetMaxNetworkRetries(maxNetworkRetries int) {+ s.MaxNetworkRetries = maxNetworkRetries+}++// SetNetworkRetriesSleep allows the normal sleep between network retries to be+// enabled or disabled.+//+// This function is available for internal testing only and should never be+// used in production.+func (s *BackendImplementation) SetNetworkRetriesSleep(sleep bool) {+ s.networkRetriesSleep = sleep+}++// Checks if an error is a problem that we should retry on. This includes both+// socket errors that may represent an intermittent problem and some special+// HTTP statuses.+func (s *BackendImplementation) shouldRetry(err error, resp *http.Response, numRetries int) bool {+ if numRetries >= s.MaxNetworkRetries {+ return false+ }++ if err != nil {+ return true+ }++ if resp.StatusCode == http.StatusConflict {+ return true+ }+ return false+}++// sleepTime calculates sleeping/delay time in milliseconds between failure and a new one request.+func (s *BackendImplementation) sleepTime(numRetries int) time.Duration {+ // We disable sleeping in some cases for tests.+ if !s.networkRetriesSleep {+ return 0 * time.Second+ }++ // Apply exponential backoff with minNetworkRetriesDelay on the+ // number of num_retries so far as inputs.+ delay := minNetworkRetriesDelay + minNetworkRetriesDelay*time.Duration(numRetries*numRetries)++ // Do not allow the number to exceed maxNetworkRetriesDelay.+ if delay > maxNetworkRetriesDelay {+ delay = maxNetworkRetriesDelay+ }++ // Apply some jitter by randomizing the value in the range of 75%-100%.+ jitter := rand.Int63n(int64(delay / 4))+ delay -= time.Duration(jitter)++ // But never sleep less than the base sleep seconds.+ if delay < minNetworkRetriesDelay {+ delay = minNetworkRetriesDelay+ }++ return delay+}++// Backends are the currently supported endpoints.+type Backends struct {+ API, Uploads Backend+ mu sync.RWMutex+}++// Printfer is an interface to be implemented by Logger.+type Printfer interface {+ Printf(format string, v ...interface{})+}++// SupportedBackend is an enumeration of supported Stripe endpoints.+// Currently supported values are "api" and "uploads".+type SupportedBackend string++//+// Public functions+//++// Bool returns a pointer to the bool value passed in.+func Bool(v bool) *bool {+ return &v+}++// BoolValue returns the value of the bool pointer passed in or+// false if the pointer is nil.+func BoolValue(v *bool) bool {+ if v != nil {+ return *v+ }+ return false+}++// Float64 returns a pointer to the float64 value passed in.+func Float64(v float64) *float64 {+ return &v+}++// Float64Value returns the value of the float64 pointer passed in or+// 0 if the pointer is nil.+func Float64Value(v *float64) float64 {+ if v != nil {+ return *v+ }+ return 0+}++// FormatURLPath takes a format string (of the kind used in the fmt package)+// representing a URL path with a number of parameters that belong in the path+// and returns a formatted string.+//+// This is mostly a pass through to Sprintf. It exists to make it+// it impossible to accidentally provide a parameter type that would be+// formatted improperly; for example, a string pointer instead of a string.+//+// It also URL-escapes every given parameter. This usually isn't necessary for+// a standard Stripe ID, but is needed in places where user-provided IDs are+// allowed, like in coupons or plans. We apply it broadly for extra safety.+func FormatURLPath(format string, params ...string) string {+ // Convert parameters to interface{} and URL-escape them+ untypedParams := make([]interface{}, len(params))+ for i, param := range params {+ untypedParams[i] = interface{}(url.QueryEscape(param))+ }++ return fmt.Sprintf(format, untypedParams...)+}++// GetBackend returns one of the library's supported backends based off of the+// given argument.+//+// It returns an existing default backend if one's already been created.+func GetBackend(backendType SupportedBackend) Backend {+ var backend Backend++ backends.mu.RLock()+ switch backendType {+ case APIBackend:+ backend = backends.API+ case UploadsBackend:+ backend = backends.Uploads+ }+ backends.mu.RUnlock()+ if backend != nil {+ return backend+ }++ backend = GetBackendWithConfig(+ backendType,+ &BackendConfig{+ HTTPClient: httpClient,+ LogLevel: LogLevel,+ Logger: Logger,+ MaxNetworkRetries: 0,+ URL: "", // Set by GetBackendWithConfiguation when empty+ },+ )++ backends.mu.Lock()+ defer backends.mu.Unlock()++ switch backendType {+ case APIBackend:+ backends.API = backend+ case UploadsBackend:+ backends.Uploads = backend+ }++ return backend+}++// GetBackendWithConfig is the same as GetBackend except that it can be given a+// configuration struct that will configure certain aspects of the backend+// that's return.+func GetBackendWithConfig(backendType SupportedBackend, config *BackendConfig) Backend {+ if config.HTTPClient == nil {+ config.HTTPClient = httpClient+ }++ if config.Logger == nil {+ config.Logger = Logger+ }++ switch backendType {+ case APIBackend:+ if config.URL == "" {+ config.URL = apiURL+ }++ config.URL = normalizeURL(config.URL)++ return newBackendImplementation(backendType, config)++ case UploadsBackend:+ if config.URL == "" {+ config.URL = uploadsURL+ }++ config.URL = normalizeURL(config.URL)++ return newBackendImplementation(backendType, config)+ }++ return nil+}++// Int64 returns a pointer to the int64 value passed in.+func Int64(v int64) *int64 {+ return &v+}++// Int64Value returns the value of the int64 pointer passed in or+// 0 if the pointer is nil.+func Int64Value(v *int64) int64 {+ if v != nil {+ return *v+ }+ return 0+}++// NewBackends creates a new set of backends with the given HTTP client. You+// should only need to use this for testing purposes or on App Engine.+func NewBackends(httpClient *http.Client) *Backends {+ apiConfig := &BackendConfig{HTTPClient: httpClient}+ uploadConfig := &BackendConfig{HTTPClient: httpClient}+ return &Backends{+ API: GetBackendWithConfig(APIBackend, apiConfig),+ Uploads: GetBackendWithConfig(UploadsBackend, uploadConfig),+ }+}++// ParseID attempts to parse a string scalar from a given JSON value which is+// still encoded as []byte. If the value was a string, it returns the string+// along with true as the second return value. If not, false is returned as the+// second return value.+//+// The purpose of this function is to detect whether a given value in a+// response from the Stripe API is a string ID or an expanded object.+func ParseID(data []byte) (string, bool) {+ s := string(data)++ if !strings.HasPrefix(s, "\"") {+ return "", false+ }++ if !strings.HasSuffix(s, "\"") {+ return "", false+ }++ return s[1 : len(s)-1], true+}++// SetAppInfo sets app information. See AppInfo.+func SetAppInfo(info *AppInfo) {+ if info != nil && info.Name == "" {+ panic(fmt.Errorf("App info name cannot be empty"))+ }+ appInfo = info++ // This is run in init, but we need to reinitialize it now that we have+ // some app info.+ initUserAgent()+}++// SetBackend sets the backend used in the binding.+func SetBackend(backend SupportedBackend, b Backend) {+ switch backend {+ case APIBackend:+ backends.API = b+ case UploadsBackend:+ backends.Uploads = b+ }+}++// SetHTTPClient overrides the default HTTP client.+// This is useful if you're running in a Google AppEngine environment+// where the http.DefaultClient is not available.+func SetHTTPClient(client *http.Client) {+ httpClient = client+}++// String returns a pointer to the string value passed in.+func String(v string) *string {+ return &v+}++// StringValue returns the value of the string pointer passed in or+// "" if the pointer is nil.+func StringValue(v *string) string {+ if v != nil {+ return *v+ }+ return ""+}++//+// Private constants+//++const apiURL = "https://api.stripe.com"++// apiversion is the currently supported API version+const apiversion = "2018-11-08"++// clientversion is the binding version+const clientversion = "55.3.0"++// defaultHTTPTimeout is the default timeout on the http.Client used by the library.+// This is chosen to be consistent with the other Stripe language libraries and+// to coordinate with other timeouts configured in the Stripe infrastructure.+const defaultHTTPTimeout = 80 * time.Second++// maxNetworkRetriesDelay and minNetworkRetriesDelay defines sleep time in milliseconds between+// tries to send HTTP request again after network failure.+const maxNetworkRetriesDelay = 5000 * time.Millisecond+const minNetworkRetriesDelay = 500 * time.Millisecond++const uploadsURL = "https://uploads.stripe.com"++//+// Private types+//++// nopReadCloser's sole purpose is to give us a way to turn an `io.Reader` into+// an `io.ReadCloser` by adding a no-op implementation of the `Closer`+// interface. We need this because `http.Request`'s `Body` takes an+// `io.ReadCloser` instead of a `io.Reader`.+type nopReadCloser struct {+ io.Reader+}++func (nopReadCloser) Close() error { return nil }++// stripeClientUserAgent contains information about the current runtime which+// is serialized and sent in the `X-Stripe-Client-User-Agent` as additional+// debugging information.+type stripeClientUserAgent struct {+ Application *AppInfo `json:"application"`+ BindingsVersion string `json:"bindings_version"`+ Language string `json:"lang"`+ LanguageVersion string `json:"lang_version"`+ Publisher string `json:"publisher"`+ Uname string `json:"uname"`+}++//+// Private variables+//++var appInfo *AppInfo+var backends Backends+var encodedStripeUserAgent string+var encodedUserAgent string+var httpClient = &http.Client{Timeout: defaultHTTPTimeout}++//+// Private functions+//++// getUname tries to get a uname from the system, but not that hard. It tries+// to execute `uname -a`, but swallows any errors in case that didn't work+// (i.e. non-Unix non-Mac system or some other reason).+func getUname() string {+ path, err := exec.LookPath("uname")+ if err != nil {+ return UnknownPlatform+ }++ cmd := exec.Command(path, "-a")+ var out bytes.Buffer+ cmd.Stderr = nil // goes to os.DevNull+ cmd.Stdout = &out+ err = cmd.Run()+ if err != nil {+ return UnknownPlatform+ }++ return out.String()+}++func init() {+ Logger = log.New(os.Stderr, "", log.LstdFlags)+ initUserAgent()+}++func initUserAgent() {+ encodedUserAgent = "Stripe/v1 GoBindings/" + clientversion+ if appInfo != nil {+ encodedUserAgent += " " + appInfo.formatUserAgent()+ }++ stripeUserAgent := &stripeClientUserAgent{+ Application: appInfo,+ BindingsVersion: clientversion,+ Language: "go",+ LanguageVersion: runtime.Version(),+ Publisher: "stripe",+ Uname: getUname(),+ }+ marshaled, err := json.Marshal(stripeUserAgent)+ // Encoding this struct should never be a problem, so we're okay to panic+ // in case it is for some reason.+ if err != nil {+ panic(err)+ }+ encodedStripeUserAgent = string(marshaled)+}++func isHTTPWriteMethod(method string) bool {+ return method == http.MethodPost || method == http.MethodPut || method == http.MethodPatch || method == http.MethodDelete+}++// newBackendImplementation returns a new Backend based off a given type and+// fully initialized BackendConfig struct.+//+// The vast majority of the time you should be calling GetBackendWithConfig+// instead of this function.+func newBackendImplementation(backendType SupportedBackend, config *BackendConfig) Backend {+ return &BackendImplementation{+ HTTPClient: config.HTTPClient,+ LogLevel: config.LogLevel,+ Logger: config.Logger,+ MaxNetworkRetries: config.MaxNetworkRetries,+ Type: backendType,+ URL: config.URL,+ networkRetriesSleep: true,+ }+}++func normalizeURL(url string) string {+ // All paths include a leading slash, so to keep logs pretty, trim a+ // trailing slash on the URL.+ url = strings.TrimSuffix(url, "/")++ // For a long time we had the `/v1` suffix as part of a configured URL+ // rather than in the per-package URLs throughout the library. Continue+ // to support this for the time being by stripping one that's been+ // passed for better backwards compatibility.+ url = strings.TrimSuffix(url, "/v1")++ return url+}diff --git a/vendor/github.com/stripe/stripe-go/sub.go b/vendor/github.com/stripe/stripe-go/sub.gonew file mode 100644index 000000000..cbad026f4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sub.go@@ -0,0 +1,159 @@+package stripe++import (+ "encoding/json"++ "github.com/stripe/stripe-go/form"+)++// SubscriptionStatus is the list of allowed values for the subscription's status.+type SubscriptionStatus string++// List of values that SubscriptionStatus can take.+const (+ SubscriptionStatusActive SubscriptionStatus = "active"+ SubscriptionStatusAll SubscriptionStatus = "all"+ SubscriptionStatusCanceled SubscriptionStatus = "canceled"+ SubscriptionStatusPastDue SubscriptionStatus = "past_due"+ SubscriptionStatusTrialing SubscriptionStatus = "trialing"+ SubscriptionStatusUnpaid SubscriptionStatus = "unpaid"+)++// SubscriptionBilling is the type of billing method for this subscription's invoices.+type SubscriptionBilling string++// List of values that SubscriptionBilling can take.+const (+ SubscriptionBillingChargeAutomatically SubscriptionBilling = "charge_automatically"+ SubscriptionBillingSendInvoice SubscriptionBilling = "send_invoice"+)++// SubscriptionParams is the set of parameters that can be used when creating or updating a subscription.+// For more details see https://stripe.com/docs/api#create_subscription and https://stripe.com/docs/api#update_subscription.+type SubscriptionParams struct {+ Params `form:"*"`+ ApplicationFeePercent *float64 `form:"application_fee_percent"`+ Billing *string `form:"billing"`+ BillingCycleAnchor *int64 `form:"billing_cycle_anchor"`+ BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo+ BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo+ CancelAtPeriodEnd *bool `form:"cancel_at_period_end"`+ Card *CardParams `form:"card"`+ Coupon *string `form:"coupon"`+ Customer *string `form:"customer"`+ DaysUntilDue *int64 `form:"days_until_due"`+ DefaultSource *string `form:"default_source"`+ Items []*SubscriptionItemsParams `form:"items"`+ OnBehalfOf *string `form:"on_behalf_of"`+ Plan *string `form:"plan"`+ Prorate *bool `form:"prorate"`+ ProrationDate *int64 `form:"proration_date"`+ Quantity *int64 `form:"quantity"`+ TaxPercent *float64 `form:"tax_percent"`+ TrialEnd *int64 `form:"trial_end"`+ TrialEndNow *bool `form:"-"` // See custom AppendTo+ TrialFromPlan *bool `form:"trial_from_plan"`+ TrialPeriodDays *int64 `form:"trial_period_days"`+}++// SubscriptionCancelParams is the set of parameters that can be used when canceling a subscription.+// For more details see https://stripe.com/docs/api#cancel_subscription+type SubscriptionCancelParams struct {+ Params `form:"*"`+ InvoiceNow *bool `form:"invoice_now"`+ Prorate *bool `form:"prorate"`+}++// AppendTo implements custom encoding logic for SubscriptionParams so that the special+// "now" value for billing_cycle_anchor and trial_end can be implemented+// (they're otherwise timestamps rather than strings).+func (p *SubscriptionParams) AppendTo(body *form.Values, keyParts []string) {+ if BoolValue(p.BillingCycleAnchorNow) {+ body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "now")+ }++ if BoolValue(p.BillingCycleAnchorUnchanged) {+ body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "unchanged")+ }++ if BoolValue(p.TrialEndNow) {+ body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")+ }+}++// SubscriptionItemsParams is the set of parameters that can be used when creating or updating a subscription item on a subscription+// For more details see https://stripe.com/docs/api#create_subscription and https://stripe.com/docs/api#update_subscription.+type SubscriptionItemsParams struct {+ Params `form:"*"`+ ClearUsage *bool `form:"clear_usage"`+ Deleted *bool `form:"deleted"`+ ID *string `form:"id"`+ Plan *string `form:"plan"`+ Quantity *int64 `form:"quantity"`+}++// SubscriptionListParams is the set of parameters that can be used when listing active subscriptions.+// For more details see https://stripe.com/docs/api#list_subscriptions.+type SubscriptionListParams struct {+ ListParams `form:"*"`+ Billing string `form:"billing"`+ Created int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Customer string `form:"customer"`+ Plan string `form:"plan"`+ Status string `form:"status"`+}++// Subscription is the resource representing a Stripe subscription.+// For more details see https://stripe.com/docs/api#subscriptions.+type Subscription struct {+ ApplicationFeePercent float64 `json:"application_fee_percent"`+ Billing SubscriptionBilling `json:"billing"`+ BillingCycleAnchor int64 `json:"billing_cycle_anchor"`+ CanceledAt int64 `json:"canceled_at"`+ Created int64 `json:"created"`+ CurrentPeriodEnd int64 `json:"current_period_end"`+ CurrentPeriodStart int64 `json:"current_period_start"`+ Customer *Customer `json:"customer"`+ DaysUntilDue int64 `json:"days_until_due"`+ DefaultSource *PaymentSource `json:"default_source"`+ Discount *Discount `json:"discount"`+ CancelAtPeriodEnd bool `json:"cancel_at_period_end"`+ EndedAt int64 `json:"ended_at"`+ ID string `json:"id"`+ Items *SubscriptionItemList `json:"items"`+ Metadata map[string]string `json:"metadata"`+ OnBehalfOf *Account `json:"on_behalf_of"`+ Plan *Plan `json:"plan"`+ Quantity int64 `json:"quantity"`+ Start int64 `json:"start"`+ Status SubscriptionStatus `json:"status"`+ TaxPercent float64 `json:"tax_percent"`+ TrialEnd int64 `json:"trial_end"`+ TrialStart int64 `json:"trial_start"`+}++// SubscriptionList is a list object for subscriptions.+type SubscriptionList struct {+ ListMeta+ Data []*Subscription `json:"data"`+}++// UnmarshalJSON handles deserialization of a Subscription.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (s *Subscription) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ s.ID = id+ return nil+ }++ type subscription Subscription+ var v subscription+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *s = Subscription(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/sub/client.go b/vendor/github.com/stripe/stripe-go/sub/client.gonew file mode 100644index 000000000..a27dd7460--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/sub/client.go@@ -0,0 +1,101 @@+// Package sub provides the /subscriptions APIs+package sub++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /subscriptions APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new subscription.+func New(params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ return getC().New(params)+}++// New creates a new subscription.+func (c Client) New(params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ sub := &stripe.Subscription{}+ err := c.B.Call(http.MethodPost, "/v1/subscriptions", c.Key, params, sub)+ return sub, err+}++// Get returns the details of a subscription.+func Get(id string, params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ return getC().Get(id, params)+}++// Get returns the details of a subscription.+func (c Client) Get(id string, params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ path := stripe.FormatURLPath("/v1/subscriptions/%s", id)+ sub := &stripe.Subscription{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, sub)+ return sub, err+}++// Update updates a subscription's properties.+func Update(id string, params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ return getC().Update(id, params)+}++// Update updates a subscription's properties.+func (c Client) Update(id string, params *stripe.SubscriptionParams) (*stripe.Subscription, error) {+ path := stripe.FormatURLPath("/v1/subscriptions/%s", id)+ sub := &stripe.Subscription{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, sub)++ return sub, err+}++// Cancel removes a subscription.+func Cancel(id string, params *stripe.SubscriptionCancelParams) (*stripe.Subscription, error) {+ return getC().Cancel(id, params)+}++// Cancel removes a subscription.+func (c Client) Cancel(id string, params *stripe.SubscriptionCancelParams) (*stripe.Subscription, error) {+ path := stripe.FormatURLPath("/v1/subscriptions/%s", id)+ sub := &stripe.Subscription{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, sub)+ return sub, err+}++// List returns a list of subscriptions.+func List(params *stripe.SubscriptionListParams) *Iter {+ return getC().List(params)+}++// List returns a list of subscriptions.+func (c Client) List(listParams *stripe.SubscriptionListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SubscriptionList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/subscriptions", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for subscriptions.+type Iter struct {+ *stripe.Iter+}++// Subscription returns the subscription which the iterator is currently pointing to.+func (i *Iter) Subscription() *stripe.Subscription {+ return i.Current().(*stripe.Subscription)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/subitem.go b/vendor/github.com/stripe/stripe-go/subitem.gonew file mode 100644index 000000000..6b91d6eac--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/subitem.go@@ -0,0 +1,39 @@+package stripe++// SubscriptionItemParams is the set of parameters that can be used when creating or updating a subscription item.+// For more details see https://stripe.com/docs/api#create_subscription_item and https://stripe.com/docs/api#update_subscription_item.+type SubscriptionItemParams struct {+ Params `form:"*"`+ ID *string `form:"-"` // Handled in URL+ Plan *string `form:"plan"`+ ClearUsage *bool `form:"clear_usage"`+ Prorate *bool `form:"prorate"`+ ProrationDate *int64 `form:"proration_date"`+ Quantity *int64 `form:"quantity"`+ Subscription *string `form:"subscription"`+}++// SubscriptionItemListParams is the set of parameters that can be used when listing invoice items.+// For more details see https://stripe.com/docs/api#list_invoiceitems.+type SubscriptionItemListParams struct {+ ListParams `form:"*"`+ Subscription *string `form:"subscription"`+}++// SubscriptionItem is the resource representing a Stripe subscription item.+// For more details see https://stripe.com/docs/api#subscription_items.+type SubscriptionItem struct {+ Created int64 `json:"created"`+ Deleted bool `json:"deleted"`+ ID string `json:"id"`+ Metadata map[string]string `json:"metadata"`+ Plan *Plan `json:"plan"`+ Quantity int64 `json:"quantity"`+ Subscription string `json:"subscription"`+}++// SubscriptionItemList is a list of invoice items as retrieved from a list endpoint.+type SubscriptionItemList struct {+ ListMeta+ Data []*SubscriptionItem `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/subitem/client.go b/vendor/github.com/stripe/stripe-go/subitem/client.gonew file mode 100644index 000000000..ac4f3c3cb--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/subitem/client.go@@ -0,0 +1,101 @@+// Package subitem provides the /subscription_items APIs+package subitem++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /subscriptions APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new subscription item.+func New(params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ return getC().New(params)+}++// New creates a new subscription item.+func (c Client) New(params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ item := &stripe.SubscriptionItem{}+ err := c.B.Call(http.MethodPost, "/v1/subscription_items", c.Key, params, item)+ return item, err+}++// Get returns the details of a subscription item.+func Get(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ return getC().Get(id, params)+}++// Get returns the details of a subscription item.+func (c Client) Get(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ path := stripe.FormatURLPath("/v1/subscription_items/%s", id)+ item := &stripe.SubscriptionItem{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, item)+ return item, err+}++// Update updates a subscription item's properties.+func Update(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ return getC().Update(id, params)+}++// Update updates a subscription item's properties.+func (c Client) Update(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ path := stripe.FormatURLPath("/v1/subscription_items/%s", id)+ subi := &stripe.SubscriptionItem{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, subi)+ return subi, err+}++// Del removes a subscription item.+func Del(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ return getC().Del(id, params)+}++// Del removes a subscription item.+func (c Client) Del(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {+ path := stripe.FormatURLPath("/v1/subscription_items/%s", id)+ item := &stripe.SubscriptionItem{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, item)++ return item, err+}++// List returns a list of subscription items.+func List(params *stripe.SubscriptionItemListParams) *Iter {+ return getC().List(params)+}++// List returns a list of subscription items.+func (c Client) List(listParams *stripe.SubscriptionItemListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.SubscriptionItemList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/subscription_items", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for subscription items.+type Iter struct {+ *stripe.Iter+}++// SubscriptionItem returns the subscription item which the iterator is currently pointing to.+func (i *Iter) SubscriptionItem() *stripe.SubscriptionItem {+ return i.Current().(*stripe.SubscriptionItem)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/terminal/connectiontoken/client.go b/vendor/github.com/stripe/stripe-go/terminal/connectiontoken/client.gonew file mode 100644index 000000000..d4862212f--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal/connectiontoken/client.go@@ -0,0 +1,30 @@+// Package connectiontoken provides API functions related to terminal connection tokens+package connectiontoken++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke /terminal/connection_tokens APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new terminal connection token.+func New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {+ return getC().New(params)+}++// New creates a new terminal connection token.+func (c Client) New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {+ connectiontoken := &stripe.TerminalConnectionToken{}+ err := c.B.Call(http.MethodPost, "/v1/terminal/connection_tokens", c.Key, params, connectiontoken)+ return connectiontoken, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/terminal/location/client.go b/vendor/github.com/stripe/stripe-go/terminal/location/client.gonew file mode 100644index 000000000..3d51c4d12--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal/location/client.go@@ -0,0 +1,87 @@+// Package location provides API functions related to terminal locations+package location++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invokte /terminal/locations APIs+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new terminal location.+func New(params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ return getC().New(params)+}++// New creates a new terminal location.+func (c Client) New(params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ location := &stripe.TerminalLocation{}+ err := c.B.Call(http.MethodPost, "/v1/terminal/locations", c.Key, params, location)+ return location, err+}++// Get returns the details of a terminal location.+func Get(id string, params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ return getC().Get(id, params)+}++// Get returns the details of a terminal location.+func (c Client) Get(id string, params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ path := stripe.FormatURLPath("/v1/terminal/locations/%s", id)+ location := &stripe.TerminalLocation{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, location)+ return location, err+}++// Update updates a terminal location.+func Update(id string, params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ return getC().Update(id, params)+}++// Update updates a terminal location.+func (c Client) Update(id string, params *stripe.TerminalLocationParams) (*stripe.TerminalLocation, error) {+ path := stripe.FormatURLPath("/v1/terminal/locations/%s", id)+ location := &stripe.TerminalLocation{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, location)+ return location, err+}++// List returns a list of terminal location.+func List(params *stripe.TerminalLocationListParams) *Iter {+ return getC().List(params)+}++// List returns a list of terminal location.+func (c Client) List(listParams *stripe.TerminalLocationListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.TerminalLocationList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/terminal/locations", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for terminal locations.+type Iter struct {+ *stripe.Iter+}++// TerminalLocation returns the terminal location which the iterator is currently pointing to.+func (i *Iter) TerminalLocation() *stripe.TerminalLocation {+ return i.Current().(*stripe.TerminalLocation)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/terminal/reader/client.go b/vendor/github.com/stripe/stripe-go/terminal/reader/client.gonew file mode 100644index 000000000..b8c17db38--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal/reader/client.go@@ -0,0 +1,87 @@+// Package reader provides API functions related to terminal readers+package reader++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /terminal/readers APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new terminal reader.+func New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) {+ return getC().New(params)+}++// New creates a new terminal reader.+func (c Client) New(params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) {+ reader := &stripe.TerminalReader{}+ err := c.B.Call(http.MethodPost, "/v1/terminal/readers", c.Key, params, reader)+ return reader, err+}++// Get returns the details of a terminal reader.+func Get(id string, params *stripe.TerminalReaderGetParams) (*stripe.TerminalReader, error) {+ return getC().Get(id, params)+}++// Get returns the details of a terminal reader.+func (c Client) Get(id string, params *stripe.TerminalReaderGetParams) (*stripe.TerminalReader, error) {+ path := stripe.FormatURLPath("/v1/terminal/readers/%s", id)+ reader := &stripe.TerminalReader{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, reader)+ return reader, err+}++// Update updates a terminal reader.+func Update(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) {+ return getC().Update(id, params)+}++// Update updates a terminal reader.+func (c Client) Update(id string, params *stripe.TerminalReaderParams) (*stripe.TerminalReader, error) {+ path := stripe.FormatURLPath("/v1/terminal/readers/%s", id)+ reader := &stripe.TerminalReader{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, reader)+ return reader, err+}++// List returns a list of terminal readers.+func List(params *stripe.TerminalReaderListParams) *Iter {+ return getC().List(params)+}++// List returns a list of terminal readers.+func (c Client) List(listParams *stripe.TerminalReaderListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.TerminalReaderList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/terminal/readers", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for terminal readers.+type Iter struct {+ *stripe.Iter+}++// TerminalReader returns the terminal reader which the iterator is currently pointing to.+func (i *Iter) TerminalReader() *stripe.TerminalReader {+ return i.Current().(*stripe.TerminalReader)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/terminal_connectiontoken.go b/vendor/github.com/stripe/stripe-go/terminal_connectiontoken.gonew file mode 100644index 000000000..e4b4462eb--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal_connectiontoken.go@@ -0,0 +1,13 @@+package stripe++// TerminalConnectionTokenParams is the set of parameters that can be used when creating a terminal connection token.+type TerminalConnectionTokenParams struct {+ Params `form:"*"`+ OperatorAccount *string `form:"operator_account"`+}++// TerminalConnectionToken is the resource representing a Stripe terminal connection token.+type TerminalConnectionToken struct {+ Object string `json:"object"`+ Secret string `json:"secret"`+}diff --git a/vendor/github.com/stripe/stripe-go/terminal_location.go b/vendor/github.com/stripe/stripe-go/terminal_location.gonew file mode 100644index 000000000..4e45a7359--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal_location.go@@ -0,0 +1,28 @@+package stripe++// TerminalLocationParams is the set of parameters that can be used when creating or updating a terminal location.+type TerminalLocationParams struct {+ Params `form:"*"`+ Address *AccountAddressParams `form:"address"`+ DisplayName *string `form:"display_name"`+ OperatorAccount *string `form:"operator_account"`+}++// TerminalLocationListParams is the set of parameters that can be used when listing temrinal locations.+type TerminalLocationListParams struct {+ ListParams `form:"*"`+ OperatorAccount *string `form:"operator_account"`+}++// TerminalLocation is the resource representing a Stripe terminal location.+type TerminalLocation struct {+ ID string `json:"id"`+ Address *AccountAddressParams `json:"address"`+ Object string `json:"object"`+}++// TerminalLocationList is a list of terminal readers as retrieved from a list endpoint.+type TerminalLocationList struct {+ ListMeta+ Data []*TerminalLocation `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/terminal_reader.go b/vendor/github.com/stripe/stripe-go/terminal_reader.gonew file mode 100644index 000000000..6dd64dccb--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/terminal_reader.go@@ -0,0 +1,42 @@+package stripe++// TerminalReaderParams is the set of parameters that can be used for creating or updating a terminal reader.+type TerminalReaderParams struct {+ Params `form:"*"`+ Label *string `form:"label"`+ Location *string `form:"location"`+ OperatorAccount *string `form:"operator_account"`+ RegistrationCode *string `form:"registration_code"`+}++// TerminalReaderGetParams is the set of parameters that can be used to get a terminal reader.+type TerminalReaderGetParams struct {+ Params `form:"*"`+ OperatorAccount *string `form:"operator_account"`+}++// TerminalReaderListParams is the set of parameters that can be used when listing temrinal readers.+type TerminalReaderListParams struct {+ ListParams `form:"*"`+ Location *string `form:"location"`+ OperatorAccount *string `form:"operator_account"`+ Status *string `form:"status"`+}++// TerminalReader is the resource representing a Stripe terminal reader.+type TerminalReader struct {+ DeviceType string `json:"device_type"`+ ID string `json:"id"`+ IPAddress string `json:"ip_address"`+ Label string `json:"label"`+ Location string `json:"location"`+ Object string `json:"object"`+ SerialNumber string `json:"serial_number"`+ Status string `json:"status"`+}++// TerminalReaderList is a list of terminal readers as retrieved from a list endpoint.+type TerminalReaderList struct {+ ListMeta+ Data []*TerminalReader `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/threedsecure.go b/vendor/github.com/stripe/stripe-go/threedsecure.gonew file mode 100644index 000000000..db02779b4--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/threedsecure.go@@ -0,0 +1,29 @@+package stripe++// ThreeDSecureStatus represents the possible statuses of a ThreeDSecure object.+type ThreeDSecureStatus string++// ThreeDSecureParams is the set of parameters that can be used when creating a 3DS object.+type ThreeDSecureParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Card *string `form:"card"`+ Currency *string `form:"currency"`+ Customer *string `form:"customer"`+ ReturnURL *string `form:"return_url"`+}++// ThreeDSecure is the resource representing a Stripe 3DS object+// For more details see https://stripe.com/docs/api#three_d_secure.+type ThreeDSecure struct {+ Amount int64 `json:"amount"`+ Authenticated bool `json:"authenticated"`+ Card *Card `json:"card"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ RedirectURL string `json:"redirect_url"`+ Status ThreeDSecureStatus `json:"status"`+ Supported string `json:"supported"`+}diff --git a/vendor/github.com/stripe/stripe-go/token.go b/vendor/github.com/stripe/stripe-go/token.gonew file mode 100644index 000000000..3cfc77342--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/token.go@@ -0,0 +1,51 @@+package stripe++// TokenType is the list of allowed values for a token's type.+type TokenType string++// List of values that TokenType can take.+const (+ TokenTypeAccount TokenType = "account"+ TokenTypeCard TokenType = "card"+ TokenTypeBankAccount TokenType = "bank_account"+ TokenTypePII TokenType = "pii"+)++// TokenParams is the set of parameters that can be used when creating a token.+// For more details see https://stripe.com/docs/api#create_card_token and https://stripe.com/docs/api#create_bank_account_token.+type TokenParams struct {+ Params `form:"*"`+ BankAccount *BankAccountParams `form:"bank_account"`+ Card *CardParams `form:"card"`+ Customer *string `form:"customer"`++ // Email is an undocumented parameter used by Stripe Checkout+ // It may be removed from the API without notice.+ Email *string `form:"email"`++ PII *PIIParams `form:"pii"`+}++// Token is the resource representing a Stripe token.+// For more details see https://stripe.com/docs/api#tokens.+type Token struct {+ BankAccount *BankAccount `json:"bank_account"`+ Card *Card `json:"card"`+ ClientIP string `json:"client_ip"`+ Created int64 `json:"created"`++ // Email is an undocumented field but included for all tokens created+ // with Stripe Checkout.+ Email string `json:"email"`++ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Type TokenType `json:"type"`+ Used bool `json:"used"`+}++// PIIParams are parameters for personal identifiable information (PII).+type PIIParams struct {+ Params `form:"*"`+ PersonalIDNumber *string `form:"personal_id_number"`+}diff --git a/vendor/github.com/stripe/stripe-go/token/client.go b/vendor/github.com/stripe/stripe-go/token/client.gonew file mode 100644index 000000000..9382373b2--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/token/client.go@@ -0,0 +1,44 @@+// Package token provides the /tokens APIs+package token++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke /tokens APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new token.+func New(params *stripe.TokenParams) (*stripe.Token, error) {+ return getC().New(params)+}++// New creates a new token.+func (c Client) New(params *stripe.TokenParams) (*stripe.Token, error) {+ tok := &stripe.Token{}+ err := c.B.Call(http.MethodPost, "/v1/tokens", c.Key, params, tok)+ return tok, err+}++// Get returns the details of a token.+func Get(id string, params *stripe.TokenParams) (*stripe.Token, error) {+ return getC().Get(id, params)+}++// Get returns the details of a token.+func (c Client) Get(id string, params *stripe.TokenParams) (*stripe.Token, error) {+ path := stripe.FormatURLPath("/v1/tokens/%s", id)+ token := &stripe.Token{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, token)++ return token, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/topup.go b/vendor/github.com/stripe/stripe-go/topup.gonew file mode 100644index 000000000..2ac8092dc--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/topup.go@@ -0,0 +1,53 @@+package stripe++// TopupParams is the set of parameters that can be used when creating or updating a top-up.+// For more details see https://stripe.com/docs/api#create_topup and https://stripe.com/docs/api#update_topup.+type TopupParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Description *string `form:"description"`+ Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*"+ StatementDescriptor *string `form:"statement_descriptor"`+}++// SetSource adds valid sources to a TopupParams object,+// returning an error for unsupported sources.+func (p *TopupParams) SetSource(sp interface{}) error {+ source, err := SourceParamsFor(sp)+ p.Source = source+ return err+}++// TopupListParams is the set of parameters that can be used when listing top-ups.+// For more details see https://stripe.com/docs/api#list_topups.+type TopupListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// TopupList is a list of top-ups as retrieved from a list endpoint.+type TopupList struct {+ ListMeta+ Data []*Topup `json:"data"`+}++// Topup is the resource representing a Stripe top-up.+// For more details see https://stripe.com/docs/api#topups.+type Topup struct {+ Amount int64 `json:"amount"`+ ArrivalDate int64 `json:"arrival_date"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Description string `json:"description"`+ ExpectedAvailabilityDate int64 `json:"expected_availability_date"`+ FailureCode string `json:"failure_code"`+ FailureMessage string `json:"failure_message"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Source *PaymentSource `json:"source"`+ StatementDescriptor string `json:"statement_descriptor"`+ Status string `json:"status"`+}diff --git a/vendor/github.com/stripe/stripe-go/topup/client.go b/vendor/github.com/stripe/stripe-go/topup/client.gonew file mode 100644index 000000000..f71a420ed--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/topup/client.go@@ -0,0 +1,99 @@+package topup++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /topups APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// Cancel cancels a topup.+func Cancel(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ return getC().Cancel(id, params)+}++// Cancel cancels a topup.+func (c Client) Cancel(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ path := stripe.FormatURLPath("/v1/topups/%s/cancel", id)+ topup := &stripe.Topup{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, topup)+ return topup, err+}++// New creates a new topup.+func New(params *stripe.TopupParams) (*stripe.Topup, error) {+ return getC().New(params)+}++// New creates a new topup.+func (c Client) New(params *stripe.TopupParams) (*stripe.Topup, error) {+ topup := &stripe.Topup{}+ err := c.B.Call(http.MethodPost, "/v1/topups", c.Key, params, topup)+ return topup, err+}++// Get returns the details of a topup.+func Get(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ return getC().Get(id, params)+}++// Get returns the details of a topup.+func (c Client) Get(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ path := stripe.FormatURLPath("/v1/topups/%s", id)+ topup := &stripe.Topup{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, topup)+ return topup, err+}++// Update updates a topup's properties.+func Update(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ return getC().Update(id, params)+}++// Update updates a topup's properties.+func (c Client) Update(id string, params *stripe.TopupParams) (*stripe.Topup, error) {+ path := stripe.FormatURLPath("/v1/topups/%s", id)+ topup := &stripe.Topup{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, topup)+ return topup, err+}++// List returns a list of topups.+func List(params *stripe.TopupListParams) *Iter {+ return getC().List(params)+}++// List returns a list of topups.+func (c Client) List(listParams *stripe.TopupListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.TopupList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/topups", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for topups.+type Iter struct {+ *stripe.Iter+}++// Topup returns the topup item which the iterator is currently pointing to.+func (i *Iter) Topup() *stripe.Topup {+ return i.Current().(*stripe.Topup)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/transfer.go b/vendor/github.com/stripe/stripe-go/transfer.gonew file mode 100644index 000000000..3b2b332ec--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/transfer.go@@ -0,0 +1,116 @@+package stripe++import "encoding/json"++// TransferSourceType is the list of allowed values for the transfer's source_type field.+type TransferSourceType string++// List of values that TransferSourceType can take.+const (+ TransferSourceTypeAlipayAccount TransferSourceType = "alipay_account"+ TransferSourceTypeBankAccount TransferSourceType = "bank_account"+ TransferSourceTypeBitcoinReceiver TransferSourceType = "bitcoin_receiver"+ TransferSourceTypeCard TransferSourceType = "card"+)++// TransferDestination describes the destination of a Transfer.+// The Type should indicate which object is fleshed out+// For more details see https://stripe.com/docs/api/go#transfer_object+type TransferDestination struct {+ Account *Account `json:"-"`+ ID string `json:"id"`+}++// TransferParams is the set of parameters that can be used when creating or updating a transfer.+// For more details see https://stripe.com/docs/api#create_transfer and https://stripe.com/docs/api#update_transfer.+type TransferParams struct {+ Params `form:"*"`+ Amount *int64 `form:"amount"`+ Currency *string `form:"currency"`+ Destination *string `form:"destination"`+ SourceTransaction *string `form:"source_transaction"`+ SourceType *string `form:"source_type"`+ TransferGroup *string `form:"transfer_group"`+}++// TransferListParams is the set of parameters that can be used when listing transfers.+// For more details see https://stripe.com/docs/api#list_transfers.+type TransferListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+ Destination *string `form:"destination"`+ TransferGroup *string `form:"transfer_group"`+}++// Transfer is the resource representing a Stripe transfer.+// For more details see https://stripe.com/docs/api#transfers.+type Transfer struct {+ Amount int64 `json:"amount"`+ AmountReversed int64 `json:"amount_reversed"`+ BalanceTransaction *BalanceTransaction `json:"balance_transaction"`+ Created int64 `json:"created"`+ Currency Currency `json:"currency"`+ Destination *TransferDestination `json:"destination"`+ DestinationPayment *Charge `json:"destination_payment"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Metadata map[string]string `json:"metadata"`+ Reversals *ReversalList `json:"reversals"`+ Reversed bool `json:"reversed"`+ SourceTransaction *BalanceTransactionSource `json:"source_transaction"`+ SourceType TransferSourceType `json:"source_type"`+ TransferGroup string `json:"transfer_group"`+}++// TransferList is a list of transfers as retrieved from a list endpoint.+type TransferList struct {+ ListMeta+ Data []*Transfer `json:"data"`+}++// UnmarshalJSON handles deserialization of a Transfer.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (t *Transfer) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ t.ID = id+ return nil+ }++ type transfer Transfer+ var v transfer+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *t = Transfer(v)+ return nil+}++// UnmarshalJSON handles deserialization of a TransferDestination.+// This custom unmarshaling is needed because the specific+// type of destination it refers to is specified in the JSON+func (d *TransferDestination) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ d.ID = id+ return nil+ }++ type transferDestination TransferDestination+ var v transferDestination+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *d = TransferDestination(v)+ return json.Unmarshal(data, &d.Account)+}++// MarshalJSON handles serialization of a TransferDestination.+// This custom marshaling is needed because we can only send a string+// ID as a destination, even though it can be expanded to a full+// object when retrieving+func (d *TransferDestination) MarshalJSON() ([]byte, error) {+ return json.Marshal(d.ID)+}diff --git a/vendor/github.com/stripe/stripe-go/transfer/client.go b/vendor/github.com/stripe/stripe-go/transfer/client.gonew file mode 100644index 000000000..e9ae0303e--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/transfer/client.go@@ -0,0 +1,87 @@+// Package transfer provides the /transfers APIs+package transfer++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /transfers APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new transfer.+func New(params *stripe.TransferParams) (*stripe.Transfer, error) {+ return getC().New(params)+}++// New creates a new transfer.+func (c Client) New(params *stripe.TransferParams) (*stripe.Transfer, error) {+ transfer := &stripe.Transfer{}+ err := c.B.Call(http.MethodPost, "/v1/transfers", c.Key, params, transfer)+ return transfer, err+}++// Get returns the details of a transfer.+func Get(id string, params *stripe.TransferParams) (*stripe.Transfer, error) {+ return getC().Get(id, params)+}++// Get returns the details of a transfer.+func (c Client) Get(id string, params *stripe.TransferParams) (*stripe.Transfer, error) {+ path := stripe.FormatURLPath("/v1/transfers/%s", id)+ transfer := &stripe.Transfer{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, transfer)+ return transfer, err+}++// Update updates a transfer's properties.+func Update(id string, params *stripe.TransferParams) (*stripe.Transfer, error) {+ return getC().Update(id, params)+}++// Update updates a transfer's properties.+func (c Client) Update(id string, params *stripe.TransferParams) (*stripe.Transfer, error) {+ path := stripe.FormatURLPath("/v1/transfers/%s", id)+ transfer := &stripe.Transfer{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, transfer)+ return transfer, err+}++// List returns a list of transfers.+func List(params *stripe.TransferListParams) *Iter {+ return getC().List(params)+}++// List returns a list of transfers.+func (c Client) List(listParams *stripe.TransferListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.TransferList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/transfers", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for transfers.+type Iter struct {+ *stripe.Iter+}++// Transfer returns the transfer which the iterator is currently pointing to.+func (i *Iter) Transfer() *stripe.Transfer {+ return i.Current().(*stripe.Transfer)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/usagerecord.go b/vendor/github.com/stripe/stripe-go/usagerecord.gonew file mode 100644index 000000000..69b5f0bcd--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/usagerecord.go@@ -0,0 +1,27 @@+package stripe++// Possible values for the action parameter on usage record creation.+const (+ UsageRecordActionIncrement string = "increment"+ UsageRecordActionSet string = "set"+)++// UsageRecord represents a usage record.+// See https://stripe.com/docs/api#usage_records+type UsageRecord struct {+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Quantity int64 `json:"quantity"`+ SubscriptionItem string `json:"subscription_item"`+ Timestamp int64 `json:"timestamp"`+}++// UsageRecordParams create a usage record for a specified subscription item+// and date, and fills it with a quantity.+type UsageRecordParams struct {+ Params `form:"*"`+ Action *string `form:"action"`+ Quantity *int64 `form:"quantity"`+ SubscriptionItem *string `form:"-"` // passed in the URL+ Timestamp *int64 `form:"timestamp"`+}diff --git a/vendor/github.com/stripe/stripe-go/usagerecord/client.go b/vendor/github.com/stripe/stripe-go/usagerecord/client.gonew file mode 100644index 000000000..f06208bad--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/usagerecord/client.go@@ -0,0 +1,31 @@+// Package usagerecord provides the /subscription_items/{SUBSCRIPTION_ITEM_ID}/usage_records APIs+package usagerecord++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+)++// Client is used to invoke APIs related to usage records.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new usage record.+func New(params *stripe.UsageRecordParams) (*stripe.UsageRecord, error) {+ return getC().New(params)+}++// New creates a new usage record.+func (c Client) New(params *stripe.UsageRecordParams) (*stripe.UsageRecord, error) {+ path := stripe.FormatURLPath("/v1/subscription_items/%s/usage_records", stripe.StringValue(params.SubscriptionItem))+ record := &stripe.UsageRecord{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, record)+ return record, err+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/vendor/github.com/stripe/stripe-go/usagerecordsummary.go b/vendor/github.com/stripe/stripe-go/usagerecordsummary.gonew file mode 100644index 000000000..51afd5e8c--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/usagerecordsummary.go@@ -0,0 +1,25 @@+package stripe++// UsageRecordSummary represents a usage record summary.+// See https://stripe.com/docs/api#usage_records+type UsageRecordSummary struct {+ ID string `json:"id"`+ Invoice string `json:"invoice"`+ Livemode bool `json:"livemode"`+ Object string `json:"object"`+ Period *Period `json:"period"`+ SubscriptionItem string `json:"subscription_item"`+ TotalUsage int64 `json:"total_usage"`+}++// UsageRecordSummaryListParams is the set of parameters that can be used when listing charges.+type UsageRecordSummaryListParams struct {+ ListParams `form:"*"`+ SubscriptionItem *string `form:"-"` // Sent in with the URL+}++// UsageRecordSummaryList is a list of usage record summaries as retrieved from a list endpoint.+type UsageRecordSummaryList struct {+ ListMeta+ Data []*UsageRecordSummary `json:"data"`+}diff --git a/vendor/github.com/stripe/stripe-go/v32_migration_guide.md b/vendor/github.com/stripe/stripe-go/v32_migration_guide.mdnew file mode 100644index 000000000..7f09d20c6--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/v32_migration_guide.md@@ -0,0 +1,146 @@+# V32 Migration Guide++Version 32 of stripe-go contains some very sizable breaking changes.++The major reason that we moved forward on them is that it was previously+impossible when encoding a parameter struct for an API call to make a+distinction between a field that a user had left unset versus a field that had+been set explicitly, but to an empty value. So if we had a parameter struct+like this:++``` go+type UsageRecordParams struct {+ Quantity uint64 `form:"quantity"`+}+```++We were unable to differentiate these two cases:++``` go+// Initialized with no quantity+UsageRecord {}++// Initialized with an explicitly zero+UsageRecord {+ Quantity: 0,+}+```++This is because any uninitialized fields on a struct in Go are set to their+type's "zero value", which for an integer is `0`.++Working around the problem required a secondary field to help explicitly state+that the zero value was intended, which was quite unintuitive for users:++``` go+type UsageRecordParams struct {+ Quantity uint64 `form:"quantity"`+ QuantityZero bool `form:"quantity,zero"`+}++UsageRecord {+ QuantityZero: true,+}+```++To address the problem, we moved every parameter struct over to use pointers+instead. So the above becomes:++``` go+type UsageRecordParams struct {+ Quantity *int64 `form:"quantity"`+}+```++Because in Go you can't take the address of an inline value (`&0`), we provide+a set of helper functions like `stripe.Int64` specifically for initializing+these structs:++``` go+UsageRecord {+ Quantity: stripe.Int64(0),+}+```++The zero value for pointers is `nil`, so we can now easily determine which+values on a struct were never set, and which ones were explicitly set to a zero+value, thus eliminating the need for the secondary fields like `QuantityZero`.++Because this is a large change, we also took the opportunity to do some+housekeeping throughout the library. Most of this involves renaming fields and+some resources to be more accurate according to how they're named in Stripe's+REST API, but it also involves some smaller changes like moving some types and+constants around.++Please see the list below for the complete set of changes.++## Major changes++* All fields on parameter structs (those that end with `*Params`) are now+ pointers. Please use the new helper functions to set them:+ * `stripe.Bool`+ * `stripe.Float64`+ * `stripe.Int64`+ * `stripe.String`++ This also means that extra fields that used to be solely used for tracking+ meaningful zero values like `CouponEmpty` and `QuantityZero` have been+ dropped. Use their corresponding field (e.g., `Coupon`, `Quantity`) with an+ explicit empty value instead (`stripe.String("")`, `stripe.Int64(0)`).+* Many fields have been renamed so that they're more consistent with their name+ in Stripe's REST API. Most of the time, this changes abbreviations to a more+ fully expanded form. For example:+ * `Desc` becomes `Description`.+ * `Live` becomes `Livemode`.+* A few names of API resources (and their corresponding parameter and list+ classes) have changed:+ * `Fee` becomes `ApplicationFee`.+ * `FeeRefund` becomes `ApplicationFeeRefund`.+ * `Owner` becomes `AdditionalOwner`.+ * `Sub` becomes `Subscription`.+ * `SubItem` becomes `SubscriptionItem`.+ * `Transaction` becomes `BalanceTransaction`.+ * `TxFee` becomes `BalanceTransactionFee`.+* Some sets of constants have been renamed and migrated to the top-level+ `stripe` package. All constants now have a prefix according to what they+ describe (for example, card brands all start with `CardBrand*` like+ `CardBrandVisa`) and all now reside in the `stripe` package (for example+ `dispute.Duplicate` is now `stripe.DisputeReasonDuplicate`).+* Some structs that used to be shared between requests and responses are now+ broken apart. All API calls should be using only structs that end with a+ `*Params` suffix. So for example, if you were using `Address` or `DOB`+ before, you should now use `AddressParams` and `DOBParams`.++## Other changes++* All integer values now use `int64` as their type. This means that the+ `stripe.Int64` helper function is appropriate for setting all integer values.+ This usually doesn't require a change because just setting these fields to a+ numerical literal didn't require that the type be explicitly stated.+* `Event.GetObjValue` becomes `Event.GetObjectValue`+* `Params.AddMeta` becomes `Params.AddMetadata`+* `Params.End` and `ListParams.End` become `EndingBefore`, and become a pointer+ (use `stripe.String` to set them as with other parameters).+* `Params.Expand` and `ListParams.Expand` (the fields) becomes a slice of+ pointers (instead of a slice of strings).+* `Params.Expand` and `ListParams.Expand` (the functions) become `AddExpand`.+* `Params.IdempotencyKey` becomes a pointer.+* `Params.Limit` becomes a pointer.+* `Params.Meta` becomes `Params.Metadata`+* `Params.Start` and `ListParams.Start` become `StartingAfter`+* `Params.StripeAccount` and `ListParams.StripeAccount` become pointers.+* List object data is now accessed with `object.Data` instead of `object.List`.+ Nothing changes if you were using iterators and `Next`.+* The previously deprecated `FileUploadParams.File` has been removed. Please+ use `FileUploadParams.FileReader` instead.+* The previously deprecated `Params.Account` has been removed. Please use+ `Params.StripeAccount` instead.++As usual, if you find bugs, please [open them on the repository][issues], or+reach out to `[email protected]` if you have any other questions.++[issues]: https://github.com/stripe/stripe-go/issues/new++<!--+# vim: set tw=79:+-->diff --git a/vendor/github.com/stripe/stripe-go/webhookendpoint.go b/vendor/github.com/stripe/stripe-go/webhookendpoint.gonew file mode 100644index 000000000..e083bdb01--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/webhookendpoint.go@@ -0,0 +1,62 @@+package stripe++import "encoding/json"++// WebhookEndpointParams is the set of parameters that can be used when creating a webhook endpoint.+// For more details see https://stripe.com/docs/api#create_webhook_endpoint.+type WebhookEndpointParams struct {+ Params `form:"*"`+ Connect *bool `form:"connect"`+ Disabled *bool `form:"disabled"`+ EnabledEvents []*string `form:"enabled_events"`+ URL *string `form:"url"`+}++// WebhookEndpointListParams is the set of parameters that can be used when listing webhook endpoints.+// For more detail see https://stripe.com/docs/api#list_webhook_endpoints.+type WebhookEndpointListParams struct {+ ListParams `form:"*"`+ Created *int64 `form:"created"`+ CreatedRange *RangeQueryParams `form:"created"`+}++// WebhookEndpoint is the resource representing a Stripe webhook endpoint.+// For more details see https://stripe.com/docs/api#webhook_endpoints.+type WebhookEndpoint struct {+ Application string `json:"application"`+ Connect bool `json:"connect"`+ Created int64 `json:"created"`+ Deleted bool `json:"deleted"`+ EnabledEvents []string `json:"enabled_events"`+ ID string `json:"id"`+ Livemode bool `json:"livemode"`+ Object string `json:"object"`+ Secret string `json:"secret"`+ Status string `json:"status"`+ URL string `json:"url"`+}++// WebhookEndpointList is a list of webhook endpoints as retrieved from a list endpoint.+type WebhookEndpointList struct {+ ListMeta+ Data []*WebhookEndpoint `json:"data"`+}++// UnmarshalJSON handles deserialization of a WebhookEndpoint.+// This custom unmarshaling is needed because the resulting+// property may be an id or the full struct if it was expanded.+func (c *WebhookEndpoint) UnmarshalJSON(data []byte) error {+ if id, ok := ParseID(data); ok {+ c.ID = id+ return nil+ }++ type endpoint WebhookEndpoint+ var v endpoint+ if err := json.Unmarshal(data, &v); err != nil {+ return err+ }++ *c = WebhookEndpoint(v)+ return nil+}diff --git a/vendor/github.com/stripe/stripe-go/webhookendpoint/client.go b/vendor/github.com/stripe/stripe-go/webhookendpoint/client.gonew file mode 100644index 000000000..a808dc947--- /dev/null+++ b/vendor/github.com/stripe/stripe-go/webhookendpoint/client.go@@ -0,0 +1,100 @@+// Package webhookendpoint provides the /webhook_endpoints APIs+package webhookendpoint++import (+ "net/http"++ stripe "github.com/stripe/stripe-go"+ "github.com/stripe/stripe-go/form"+)++// Client is used to invoke /webhook_endpoints APIs.+type Client struct {+ B stripe.Backend+ Key string+}++// New creates a new webhook_endpoint.+func New(params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ return getC().New(params)+}++// New creates a new webhook_endpoint.+func (c Client) New(params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ endpoint := &stripe.WebhookEndpoint{}+ err := c.B.Call(http.MethodPost, "/v1/webhook_endpoints", c.Key, params, endpoint)+ return endpoint, err+}++// Get returns the details of a webhook endpoint.+func Get(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ return getC().Get(id, params)+}++// Get returns the details of a webhook endpoint.+func (c Client) Get(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ path := stripe.FormatURLPath("/v1/webhook_endpoints/%s", id)+ endpoint := &stripe.WebhookEndpoint{}+ err := c.B.Call(http.MethodGet, path, c.Key, params, endpoint)+ return endpoint, err+}++// Update updates a webhook endpoint's properties.+func Update(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ return getC().Update(id, params)+}++// Update updates a webhook endpoint's properties.+func (c Client) Update(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ path := stripe.FormatURLPath("/v1/webhook_endpoints/%s", id)+ endpoint := &stripe.WebhookEndpoint{}+ err := c.B.Call(http.MethodPost, path, c.Key, params, endpoint)+ return endpoint, err+}++// Del removes a webhook endpoint.+func Del(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ return getC().Del(id, params)+}++// Del removes a webhook endpoint.+func (c Client) Del(id string, params *stripe.WebhookEndpointParams) (*stripe.WebhookEndpoint, error) {+ path := stripe.FormatURLPath("/v1/webhook_endpoints/%s", id)+ endpoint := &stripe.WebhookEndpoint{}+ err := c.B.Call(http.MethodDelete, path, c.Key, params, endpoint)+ return endpoint, err+}++// List returns a list of webhook_endpoints.+func List(params *stripe.WebhookEndpointListParams) *Iter {+ return getC().List(params)+}++// List returns a list of webhook_endpoints.+func (c Client) List(listParams *stripe.WebhookEndpointListParams) *Iter {+ return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {+ list := &stripe.WebhookEndpointList{}+ err := c.B.CallRaw(http.MethodGet, "/v1/webhook_endpoints", c.Key, b, p, list)++ ret := make([]interface{}, len(list.Data))+ for i, v := range list.Data {+ ret[i] = v+ }++ return ret, list.ListMeta, err+ })}+}++// Iter is an iterator for webhook_endpoints.+type Iter struct {+ *stripe.Iter+}++// WebhookEndpoint returns the endpoint which the iterator is currently pointing to.+func (i *Iter) WebhookEndpoint() *stripe.WebhookEndpoint {+ return i.Current().(*stripe.WebhookEndpoint)+}++func getC() Client {+ return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}+}diff --git a/webpack.config.js b/webpack.config.jsindex 3224d8b12..9e8c55253 100755--- a/webpack.config.js+++ b/webpack.config.js@@ -83,6 +83,11 @@ module.exports = {options: {transpileOnly: true}+ },+ {+ test: /\.(svg?)(\?[a-z0-9=&.]+)?$/,+ include: publicFolder,+ loader: "file-loader?name=images/[name].[hash].[ext]"}]},