github.com/stripe/stripe-go/v76@v76.25.0/account/client_test.go (about) 1 package account 2 3 import ( 4 "testing" 5 6 assert "github.com/stretchr/testify/require" 7 stripe "github.com/stripe/stripe-go/v76" 8 _ "github.com/stripe/stripe-go/v76/testing" 9 ) 10 11 func TestAccountDel(t *testing.T) { 12 account, err := Del("acct_123", nil) 13 assert.Nil(t, err) 14 assert.NotNil(t, account) 15 } 16 17 func TestAccountGet(t *testing.T) { 18 account, err := Get() 19 assert.Nil(t, err) 20 assert.NotNil(t, account) 21 } 22 23 func TestAccountGetByID(t *testing.T) { 24 account, err := GetByID("acct_123", nil) 25 assert.Nil(t, err) 26 assert.NotNil(t, account) 27 } 28 29 func TestAccountList(t *testing.T) { 30 i := List(&stripe.AccountListParams{}) 31 32 // Verify that we can get at least one account 33 assert.True(t, i.Next()) 34 assert.Nil(t, i.Err()) 35 assert.NotNil(t, i.Account()) 36 assert.NotNil(t, i.AccountList()) 37 } 38 39 func TestAccountNew(t *testing.T) { 40 account, err := New(&stripe.AccountParams{ 41 BusinessProfile: &stripe.AccountBusinessProfileParams{ 42 Name: stripe.String("name"), 43 SupportEmail: stripe.String("foo@bar.com"), 44 SupportURL: stripe.String("www.stripe.com"), 45 SupportPhone: stripe.String("4151234567"), 46 }, 47 BusinessType: stripe.String(string(stripe.AccountBusinessTypeCompany)), 48 Capabilities: &stripe.AccountCapabilitiesParams{ 49 CardPayments: &stripe.AccountCapabilitiesCardPaymentsParams{ 50 Requested: stripe.Bool(true), 51 }, 52 Transfers: &stripe.AccountCapabilitiesTransfersParams{ 53 Requested: stripe.Bool(true), 54 }, 55 }, 56 Company: &stripe.AccountCompanyParams{ 57 DirectorsProvided: stripe.Bool(true), 58 Name: stripe.String("company_name"), 59 Verification: &stripe.AccountCompanyVerificationParams{ 60 Document: &stripe.AccountCompanyVerificationDocumentParams{ 61 Back: stripe.String("file_123"), 62 Front: stripe.String("file_abc"), 63 }, 64 }, 65 }, 66 Documents: &stripe.AccountDocumentsParams{ 67 CompanyLicense: &stripe.AccountDocumentsCompanyLicenseParams{ 68 Files: []*string{stripe.String("file_xyz")}, 69 }, 70 }, 71 Country: stripe.String("CA"), 72 ExternalAccount: &stripe.AccountExternalAccountParams{ 73 Token: stripe.String("tok_123"), 74 }, 75 Settings: &stripe.AccountSettingsParams{ 76 Branding: &stripe.AccountSettingsBrandingParams{ 77 Icon: stripe.String("file_123"), 78 Logo: stripe.String("file_234"), 79 }, 80 CardPayments: &stripe.AccountSettingsCardPaymentsParams{ 81 DeclineOn: &stripe.AccountSettingsCardPaymentsDeclineOnParams{ 82 AVSFailure: stripe.Bool(true), 83 CVCFailure: stripe.Bool(true), 84 }, 85 StatementDescriptorPrefix: stripe.String("prefix"), 86 }, 87 Payments: &stripe.AccountSettingsPaymentsParams{ 88 StatementDescriptor: stripe.String("descriptor"), 89 }, 90 Payouts: &stripe.AccountSettingsPayoutsParams{ 91 DebitNegativeBalances: stripe.Bool(true), 92 Schedule: &stripe.AccountSettingsPayoutsScheduleParams{ 93 DelayDaysMinimum: stripe.Bool(true), 94 Interval: stripe.String(string(stripe.AccountSettingsPayoutsScheduleIntervalManual)), 95 }, 96 StatementDescriptor: stripe.String("payout_descriptor"), 97 }, 98 }, 99 Type: stripe.String(string(stripe.AccountTypeCustom)), 100 }) 101 assert.Nil(t, err) 102 assert.NotNil(t, account) 103 } 104 105 func TestAccountReject(t *testing.T) { 106 account, err := Reject("acct_123", &stripe.AccountRejectParams{ 107 Reason: stripe.String("fraud"), 108 }) 109 assert.Nil(t, err) 110 assert.NotNil(t, account) 111 } 112 113 func TestAccountUpdate(t *testing.T) { 114 account, err := Update("acct_123", &stripe.AccountParams{ 115 Company: &stripe.AccountCompanyParams{ 116 Address: &stripe.AddressParams{ 117 Country: stripe.String("CA"), 118 City: stripe.String("Montreal"), 119 PostalCode: stripe.String("H2Y 1C6"), 120 Line1: stripe.String("275, rue Notre-Dame Est"), 121 State: stripe.String("QC"), 122 }, 123 }, 124 }) 125 assert.Nil(t, err) 126 assert.NotNil(t, account) 127 }