@@ -209,172 +209,6 @@ API2Client\Entities\Order\CustomerPortal Object
209
209
)
210
210
```
211
211
212
- TemplateMonster API2 Client
213
- ===========================
214
-
215
- Installation
216
- ------------
217
-
218
- Using Composer (recommended)
219
-
220
- Add the dependency in your ` composer.json `
221
-
222
- ``` json
223
- {
224
- "repositories" : [
225
- {
226
- "type" : " vcs" ,
227
- "url" : " https://github.com/M0nsterLabs/api2client.git"
228
- }
229
- ],
230
- "require" : {
231
- "templatemonster/api2-client" :" dev-master"
232
- }
233
- }
234
-
235
- ```
236
- Usage
237
- -----
238
-
239
- # Templates
240
-
241
- ``` php
242
- // Create API instance
243
- $api = new \API2Client\Api ('api2.templatemonster.com', 'myUserName', 'myUserToken');
244
-
245
-
246
- // Receive a count of all Templates
247
- $templatesCount = $api->getTemplatesCount ()
248
-
249
- // Receive a list of Templates
250
- $offset = 0;
251
- $limit = 20;
252
-
253
- $templates = $api->getTemplatesList ($offset, $limit);
254
-
255
- /** @var API2Client\Entities\Template $template */
256
- foreach ($templates as $template)
257
- {
258
- // Template pages
259
- $templatePages = $template->getPages ();
260
- }
261
-
262
-
263
- // Receive a single Template
264
- $template_id = 30506;
265
-
266
- /** @var API2Client\Entities\Template $template */
267
- $template = $api->getTemplate ($template_id);
268
-
269
-
270
- ```
271
-
272
- # Orders
273
-
274
- ## Receive a status of Order
275
-
276
- ``` php
277
-
278
- /** @var \API2Client\Entities\Order\Status $status */
279
- $status = $api->getOrderStatus ('rgRvuzZQP9OoALyEKGKA');
280
-
281
- // print status title
282
- echo $status->getStatusName ();
283
-
284
- ```
285
-
286
- ## Get all Statuses
287
-
288
- ``` php
289
-
290
- $statuses = $api->getOrderStatuses ();
291
-
292
- /** @var \API2Client\Entities\Order\Status $status */
293
- foreach ($statuses as $status)
294
- {
295
- echo $status->getStatusCode ();
296
- echo $status->getStatusName ();
297
- }
298
-
299
- ```
300
-
301
- ## Create an Order
302
-
303
- ``` php
304
-
305
- $order = new \API2Client\Entities\Order ();
306
-
307
- $order->setProjectId (0);
308
- $order->setAmount (174);
309
- $order->setBonusesAmount (0);
310
-
311
- $billingInfo = new \API2Client\Entities\Order\BillingInfo ();
312
-
313
- $billingInfo->setAccountSId ('u03e9b361c607ju37707iyo8s273sibh9z8lka2e6kt3276e41g11e7f6ozjm0cv7c4a40piorf408bb203of6wnbx2v24xfo61nwr4o7960tu898w50u4bu51zn2fa1');
314
- $billingInfo->setAddress ('Torenplein Str');
315
- $billingInfo->setCityName ('Hasselt');
316
- $billingInfo->setContactPhone (74933242323);
317
- $billingInfo->setEmail ('
[email protected] ');
318
- $billingInfo->setCountryISO2 ('BE');
319
- $billingInfo->setFullName ('Mark Twain');
320
- $billingInfo->setPhone (74933242323);
321
- $billingInfo->setPostalCode (12123);
322
- $billingInfo->setStateISO2 ('XX');
323
-
324
- $order->setBillingInfo ($billingInfo);
325
-
326
- $productInfo1 = new \API2Client\Entities\Order\ProductInfo ();
327
-
328
- $productInfo1->setProductId (49334);
329
- $productInfo1->setPrice (69);
330
- $productInfo1->setType ('template');
331
-
332
- $order->addProductInfo ($productInfo1);
333
-
334
- $productInfo2 = new \API2Client\Entities\Order\ProductInfo ();
335
-
336
- $productInfo2->setProductId (49334);
337
- $productInfo2->setPrice (75);
338
- $productInfo2->setType ('template');
339
-
340
- $order->addProductInfo ($productInfo2);
341
-
342
-
343
- $externalProduct = new \API2Client\Entities\Order\ProductInfo ();
344
-
345
- $externalProduct->setProductId (0);
346
- $externalProduct->setPrice (33);
347
- $externalProduct->setFinalPrice (30);
348
- $externalProduct->setName ('Headspace Journey Subscription');
349
- $externalProduct->setType ('external');
350
-
351
- $order->addProductInfo ($externalProduct);
352
-
353
- $trackingInfo = new \API2Client\Entities\Order\TrackingInfo ();
354
-
355
- $trackingInfo->setRmsLocale ('EN');
356
- $trackingInfo->setRefererUrl ('http://localhost:8081/');
357
- $trackingInfo->setUserAgent ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36');
358
- $trackingInfo->setUserIPAddress ('10.0.2.2');
359
- $trackingInfo->setUserLanguage ('en-US,en;q=0.8,uk;q=0.6,ru;q=0.4');
360
- $trackingInfo->setUserLocalTime ('Tue May 27 2014 10:31:05 GMT+0300 (EEST)');
361
-
362
- $order->setTrackingInfo ($trackingInfo);
363
-
364
- $paymentInfo = new \API2Client\Entities\Order\PaymentInfo ();
365
-
366
- $paymentInfo->setCurrencyId (0);
367
- $paymentInfo->setCurrencyRate (1);
368
- $paymentInfo->setPaymentId (2);
369
-
370
- $order->setPaymentInfo ($paymentInfo);
371
-
372
- /** @var \API2Client\Entities\OrderCreated $result */
373
- $result = $api->createOrder ($order);
374
-
375
-
376
- ```
377
-
378
212
## Get url on invoice url by transaction
379
213
380
214
``` php
0 commit comments