@@ -45,18 +45,24 @@ public function __construct()
45
45
46
46
47
47
/**
48
- * set customer source (card) , email
49
- * https://stripe.com/docs/api/customers/create
50
- *
51
- * @param array $datas
48
+ * Set customer name.
49
+ *
50
+ * @param string $data customer name
52
51
* @return $this
53
52
*/
54
- public function createl ($ datas )
55
- {
56
- foreach ($ datas as $ key => $ data ) {
57
- $ this ->createCustomerData [$ key ] = $ data ;
58
- }
53
+ public function name ($ data ) {
54
+ $ this ->name = $ data ;
55
+ return $ this ;
56
+ }
59
57
58
+ /**
59
+ * Set customer email.
60
+ *
61
+ * @param string $data customer email
62
+ * @return $this
63
+ */
64
+ public function email ($ data ) {
65
+ $ this ->email = $ data ;
60
66
return $ this ;
61
67
}
62
68
@@ -72,16 +78,6 @@ public function metadata($data)
72
78
return $ this ;
73
79
}
74
80
75
- public function name ($ data ) {
76
- $ this ->name = $ data ;
77
- return $ this ;
78
- }
79
-
80
- public function email ($ data ) {
81
- $ this ->email = $ data ;
82
- return $ this ;
83
- }
84
-
85
81
/**
86
82
* Create customer and return customer data
87
83
*
@@ -111,9 +107,9 @@ public function create()
111
107
}
112
108
113
109
/**
114
- * Retrive customer with $cusIdid .
110
+ * Retrive customer with $id .
115
111
*
116
- * @param string $id
112
+ * @param string $id
117
113
* @return object
118
114
*/
119
115
public function retrieve ($ id )
@@ -127,6 +123,12 @@ public function retrieve($id)
127
123
128
124
}
129
125
126
+ /**
127
+ * Delete customer with $id
128
+ *
129
+ * @param string|integer $id
130
+ * @return object
131
+ */
130
132
public function delete ($ id ) {
131
133
try {
132
134
$ customer = $ this ->stripe ->customers ->delete ($ id );
@@ -136,6 +138,11 @@ public function delete($id) {
136
138
}
137
139
}
138
140
141
+ /**
142
+ * Retrieve all customers.
143
+ *
144
+ * @return array
145
+ */
139
146
public function lists () {
140
147
try {
141
148
$ customers = $ this ->stripe ->customers ->all ();
@@ -145,6 +152,12 @@ public function lists() {
145
152
}
146
153
}
147
154
155
+ /**
156
+ * Retrieve customer all cards.
157
+ *
158
+ * @param string|integer $id customer id.
159
+ * @return array
160
+ */
148
161
public function cards ($ id )
149
162
{
150
163
try {
@@ -167,6 +180,13 @@ public function cards($id)
167
180
}
168
181
}
169
182
183
+ /**
184
+ * Add new card for customer with customer id.
185
+ *
186
+ * @param string|integer $cusId
187
+ * @param string $cardToken genearte by stripe.js ui side.
188
+ * @param integer $max how many card can add for a customer.
189
+ */
170
190
public function addCard ($ cusId , $ cardToken , $ max = 3 )
171
191
{
172
192
try {
@@ -184,11 +204,17 @@ public function addCard($cusId, $cardToken, $max = 3)
184
204
}
185
205
}
186
206
187
- public function deleteCard ($ cusId , $ cardToken )
207
+ /**
208
+ * Delete a card
209
+ *
210
+ * @param string|integer $cusId
211
+ * @param string $cardId card id
212
+ */
213
+ public function deleteCard ($ cusId , $ cardId )
188
214
{
189
215
try {
190
216
if (count ($ this ->cards ($ cusId )) > 1 ) {
191
- $ customerSource = $ this ->stripe ->customers ->deleteSource ($ cusId , $ cardToken );
217
+ $ customerSource = $ this ->stripe ->customers ->deleteSource ($ cusId , $ cardId );
192
218
return $ customerSource ;
193
219
}
194
220
0 commit comments