@@ -45,18 +45,24 @@ public function __construct()
4545
4646
4747 /**
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
5251 * @return $this
5352 */
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+ }
5957
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 ;
6066 return $ this ;
6167 }
6268
@@ -72,16 +78,6 @@ public function metadata($data)
7278 return $ this ;
7379 }
7480
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-
8581 /**
8682 * Create customer and return customer data
8783 *
@@ -111,9 +107,9 @@ public function create()
111107 }
112108
113109 /**
114- * Retrive customer with $cusIdid .
110+ * Retrive customer with $id .
115111 *
116- * @param string $id
112+ * @param string $id
117113 * @return object
118114 */
119115 public function retrieve ($ id )
@@ -127,6 +123,12 @@ public function retrieve($id)
127123
128124 }
129125
126+ /**
127+ * Delete customer with $id
128+ *
129+ * @param string|integer $id
130+ * @return object
131+ */
130132 public function delete ($ id ) {
131133 try {
132134 $ customer = $ this ->stripe ->customers ->delete ($ id );
@@ -136,6 +138,11 @@ public function delete($id) {
136138 }
137139 }
138140
141+ /**
142+ * Retrieve all customers.
143+ *
144+ * @return array
145+ */
139146 public function lists () {
140147 try {
141148 $ customers = $ this ->stripe ->customers ->all ();
@@ -145,6 +152,12 @@ public function lists() {
145152 }
146153 }
147154
155+ /**
156+ * Retrieve customer all cards.
157+ *
158+ * @param string|integer $id customer id.
159+ * @return array
160+ */
148161 public function cards ($ id )
149162 {
150163 try {
@@ -167,6 +180,13 @@ public function cards($id)
167180 }
168181 }
169182
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+ */
170190 public function addCard ($ cusId , $ cardToken , $ max = 3 )
171191 {
172192 try {
@@ -184,11 +204,17 @@ public function addCard($cusId, $cardToken, $max = 3)
184204 }
185205 }
186206
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 )
188214 {
189215 try {
190216 if (count ($ this ->cards ($ cusId )) > 1 ) {
191- $ customerSource = $ this ->stripe ->customers ->deleteSource ($ cusId , $ cardToken );
217+ $ customerSource = $ this ->stripe ->customers ->deleteSource ($ cusId , $ cardId );
192218 return $ customerSource ;
193219 }
194220
0 commit comments