-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient_update.go
73 lines (64 loc) · 3.67 KB
/
client_update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package whmcs
import (
"errors"
)
// Various errors returned
var (
ErrNoClientDetails = errors.New("Client must have either ClientEmail or ClientID")
)
type ExistingClient struct {
ClientID string `"json:clientid,omitempty"`
ClientEmail string `json:"clientemail,omitempty"`
Firstname string `json:"firstname,omitempty"`
Lastname string `json:"lastname,omitempty"`
CompanyName string `json:"companyname,omitempty"`
Email string `json:"email,omitempty"`
Address1 string `json:"address1,omitempty"`
Address2 string `json:"address2,omitempty"`
City string `json:"city,omitempty"` //
State string `json:"state,omitempty"` //
Postcode string `json:"postcode,omitempty"` //
Country string `json:"country,omitempty"` // - two letter ISO country code
PhoneNumber string `json:"phonenumber,omitempty"` //
Password2 string `json:"password2,omitempty"` //
Credit float64 `json:"credit,string,omitempty"` // - credit balance
TaxExempt bool `json:"taxexempt,omitempty"` // - true to enable
Notes string `json:"notes,omitempty"` //
CardType string `json:"cardtype,omitempty"` // - visa, mastercard, etc...
CardNum string `json:"cardnum,omitempty"` // - cc number
ExpDate string `json:"expdate,omitempty"` // - cc expiry date
StartDate Date `json:"startdate,omitempty"` // - cc start date
IssueNumber string `json:"issuenumber,omitempty"` // - cc issue number
BankName string `json:"bankname,omitempty"` // - for use with direct debit gateway
BankType string `json:"banktype,omitempty"` // - for use with direct debit gateway
BankCode string `json:"bankcode,omitempty"` // - for use with direct debit gateway
BankAcct string `json:"bankacct,omitempty"` // - for use with direct debit gateway
Language string `json:"language,omitempty"` // - default language
ClearCreditCard bool `json:"clearcreditcard,omitempty"` // - set to true to remove stored card data (V5.3.7+ only)
PaymentMethod string `json:"paymentmethod,omitempty"` // - paypal, authorize, etc...
CustomFiels CustomFields `json:"customfields,omitempty"` // - a base64 encoded serialized array of custom field values
Status string `json:"status,omitempty"` // - active or inactive
LateFeeOverride bool `json:"latefeeoveride,omitempty"` // - true/false
OverrideDueInvoices bool `json:"overideduenotices,omitempty"` // - true/false
SeparateInvoices bool `json:"separateinvoices,omitempty"` // - true/false
DisableAutoCC bool `json:"disableautocc,omitempty"` // - true/false
}
// UpdateClientResult is the WHMCS response when updating a client.
type UpdateClientResult struct {
Result string `json:"result"`
ClientID int64 `json:"clientid,string"`
}
func (c *ExistingClient) Error() error {
if c.ClientID == "" && c.ClientEmail == "" {
return ErrNoClientDetails
}
return nil
}
// ByEmail sets the clients email with the given email string
func (c *ExistingClient) ByEmail(email string) {
c.ClientEmail = email
}
// ByID sets the client's ID with the given id string
func (c *ExistingClient) ByID(id string) {
c.ClientID = id
}