digikraaft /
paystack-php
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Digikraaft\Paystack; |
||
| 4 | |||
| 5 | class BulkCharge extends ApiResource |
||
| 6 | { |
||
| 7 | const OBJECT_NAME = 'bulkcharge'; |
||
| 8 | |||
| 9 | use ApiOperations\All; |
||
| 10 | use ApiOperations\Fetch; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param string $reference A reference for this batch. |
||
| 14 | * @param array $params |
||
| 15 | * |
||
| 16 | * @throws Exceptions\InvalidArgumentException |
||
| 17 | * @throws Exceptions\IsNullException |
||
| 18 | * |
||
| 19 | * @return array | Object |
||
| 20 | * |
||
| 21 | * @link https://paystack.com/docs/api/#bulk-charge-initiate |
||
| 22 | */ |
||
| 23 | public static function initiate($reference, $params) |
||
| 24 | { |
||
| 25 | self::validateParams($params, true); |
||
| 26 | $url = static::buildQueryString($reference, $params); |
||
| 27 | |||
| 28 | return static::staticRequest('POST', $url); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $id_or_code |
||
| 33 | * @param null $params |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 34 | * @return array|object |
||
| 35 | * @throws Exceptions\InvalidArgumentException |
||
| 36 | * @throws Exceptions\IsNullException |
||
| 37 | * @link https://paystack.com/docs/api/#bulk-charge-fetch-batch |
||
| 38 | */ |
||
| 39 | public static function fetchBulkChargeBatch($id_or_code, $params = null) |
||
| 40 | { |
||
| 41 | self::validateParams($params); |
||
| 42 | $url = "{$id_or_code}"; |
||
| 43 | $url = static::buildQueryString($url, $params); |
||
| 44 | |||
| 45 | return static::staticRequest('GET', $url); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $batch_id_or_code An ID or code for the batch whose charges you want to retrieve. |
||
| 50 | * @param array $params |
||
| 51 | * |
||
| 52 | * @link https://paystack.com/docs/api/#bulk-charge-fetch-charge |
||
| 53 | * |
||
| 54 | * @return array | Object |
||
| 55 | */ |
||
| 56 | public static function fetchChargesInABatch($batch_id_or_code, $params = null) |
||
| 57 | { |
||
| 58 | self::validateParams($params); |
||
| 59 | $url = "{$batch_id_or_code}/charges"; |
||
| 60 | $url = static::buildQueryString($url, $params); |
||
| 61 | |||
| 62 | return static::staticRequest('GET', $url); |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param string $batch_code |
||
| 67 | * |
||
| 68 | * @link https://paystack.com/docs/api/#bulk-charge-pause |
||
| 69 | * |
||
| 70 | * @return array | Object |
||
| 71 | */ |
||
| 72 | public static function pause($batch_code) |
||
| 73 | { |
||
| 74 | $url = "pause/{$batch_code}"; |
||
| 75 | $url = static::endPointUrl($url); |
||
| 76 | |||
| 77 | return static::staticRequest('GET', $url); |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @param string $batch_code |
||
| 82 | * |
||
| 83 | * @link https://paystack.com/docs/api/#bulk-charge-resume |
||
| 84 | * |
||
| 85 | * @return array|object |
||
| 86 | */ |
||
| 87 | public static function resume($batch_code) |
||
| 88 | { |
||
| 89 | $url = "resume/{$batch_code}"; |
||
| 90 | $url = static::endPointUrl($url); |
||
| 91 | |||
| 92 | return static::staticRequest('GET', $url); |
||
| 93 | } |
||
| 94 | } |
||
| 95 |