From b1aa3488064aa00e580f43144480c1807d79cf6d Mon Sep 17 00:00:00 2001 From: Abdul Awal Date: Wed, 9 Aug 2023 04:24:25 +0600 Subject: [PATCH] Added create, charges, charge, cancel methods to RecurringApplicationCharge to be compatible with latest shopify API --- lib/RecurringApplicationCharge.php | 62 ++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/lib/RecurringApplicationCharge.php b/lib/RecurringApplicationCharge.php index 4ec74a9..4fd4c08 100644 --- a/lib/RecurringApplicationCharge.php +++ b/lib/RecurringApplicationCharge.php @@ -50,6 +50,68 @@ class RecurringApplicationCharge extends ShopifyResource 'activate', ); + /* + * Create a recurring application charge + * + * @param array $data + * + * @return array + * + */ + public function create($dataArray) + { + $dataArray = $this->wrapData($dataArray); + + $url = $this->generateUrl($dataArray); + + $response = $this->post(array(), $url); + + return $response; + } + + /** + * Get list of all charges + * + * @return array + */ + public function charges(){ + $url = $this->generateUrl(); + + $response = $this->get(array(), $url); + + return $response; + } + + /** + * Get details of a single charge + * + * @param $charge_id + * + * @return array + */ + public function charge( $charge_id ){ + $url = $this->generateUrl(array(), $charge_id); + + $response = $this->get(array(), $url); + + return $response; + } + + /** + * Cancel a recurring charge + * + * @param $charge_id + * + * @return array + */ + public function cancel($charge_id){ + $url = $this->generateUrl(array(), $charge_id); + + $response = $this->delete(array(), $url); + + return $response; + } + /* * Customize a recurring application charge *