diff --git a/README.md b/README.md index 991ac44..d441ae5 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,14 @@ Update your application configuration to register the package in `config/app.php ], ~~~ -### 3 - Update ZOOP Laravel configuration -Rename config.example.php to config.php in `zoop/src/resources/config/` and change the following lines: +### 3 - Publish ZOOP Laravel configuration +Use the following command to publish the configuration settings from config.example.php in `zoop/src/resources/config/`: + +~~~ +php artisan vendor:publish --provider "Zoop\ZoopServiceProvider" --tag="config" +~~~ + +This will create the `config/zoopconfig.php` configuration file. Now, change the following lines: ~~~ 'defaults' => [ @@ -128,9 +134,11 @@ class HomeController extends Controller{ 'description' => 'Venda de teste, somente!', 'statement_descriptor' => 'Descrição de testes', 'on_behalf_of' => 'bb2a51f1c22a4c30b6bf6819be87ac52', - 'installment_plan[mode]' => 'interest_free', - 'installment_plan[number_installments]' => '1', - 'customer' => 'bb2a51f1c22a4c30b6bf6819be87ac52', //buyer ud + 'installment_plan' => [ + 'mode' => 'interest_free', + 'number_installments' => '1' + ], + 'customer' => 'bb2a51f1c22a4c30b6bf6819be87ac52', //buyer id ]); dd($cnp); diff --git a/src/Contracts/ZoopBuyers.php b/src/Contracts/ZoopBuyers.php index f157ec1..cf02d52 100644 --- a/src/Contracts/ZoopBuyers.php +++ b/src/Contracts/ZoopBuyers.php @@ -20,6 +20,14 @@ public function __construct(APIResource $APIResource); */ public function create($post); + /** + * Update a created Buyer + * + * @param $buyerID string + * @param $post array + */ + public function update($buyerID, $post); + /** * Delete a Buyer by id * @@ -34,6 +42,13 @@ public function delete($buyerID); */ public function get($buyerID); + /** + * Retrieve the details of a Buyer by taxpayer_id + * + * @param $taxpayerID string + */ + public function getByTaxpayerId($taxpayerID); + /** * Returns a JSON object with a list of buyers accounts. */ diff --git a/src/Contracts/ZoopSubscriptions.php b/src/Contracts/ZoopSubscriptions.php index e3cfbbc..5cd4559 100644 --- a/src/Contracts/ZoopSubscriptions.php +++ b/src/Contracts/ZoopSubscriptions.php @@ -20,7 +20,7 @@ public function __construct(APIResource $APIResource); */ public function create($post); - /** + /** * Update a created Subscription * * @param $subscriptionID string diff --git a/src/Exceptions/ZoopException.php b/src/Exceptions/ZoopException.php index 71ea19c..a0180ed 100644 --- a/src/Exceptions/ZoopException.php +++ b/src/Exceptions/ZoopException.php @@ -1,5 +1,5 @@ getClientMimeType(), $mimeTypes)) throw new ZoopException('You can only send files of types "jpg, png, pdf"!'); return $this->APIRequest->request('FILE', $url, $this->zoopBase->getHeaders(), [ 'file' => new \CURLFile($files ,'' , uniqid()), diff --git a/src/Lib/ZoopBuyers.php b/src/Lib/ZoopBuyers.php index 149b309..8defac8 100644 --- a/src/Lib/ZoopBuyers.php +++ b/src/Lib/ZoopBuyers.php @@ -29,6 +29,16 @@ public function create($post = []){ return $this->APIResource->createAPI($api, $post); } + /** + * @param string $buyerID + * @param array $post + * @return mixed + */ + public function update($buyerID, $post){ + $api = 'buyers/' . $buyerID; + return $this->APIResource->updateAPI($api, $post); + } + /** * @param string $buyerID * @return mixed @@ -47,6 +57,15 @@ public function get($buyerID){ return $this->APIResource->searchAPI($api); } + /** + * @param string $taxpayerID + * @return mixed + */ + public function getByTaxpayerId($taxpayerID){ + $api = 'buyers/search?taxpayer_id='.$taxpayerID; + return $this->APIResource->searchAPI($api); + } + /** * @return mixed */