Skip to content

Commit

Permalink
Merge pull request ayman-elmalah#2 from ousid/master
Browse files Browse the repository at this point in the history
Updates & Refactoring.
  • Loading branch information
ayman-elmalah authored Apr 2, 2021
2 parents 8d3e306 + 639641e commit f08c922
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
25 changes: 18 additions & 7 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ and modify the config file with your own information. File is located in `/confi
MYFATOORAH_MODE=test
MYFATOORAH_TOKEN=token
```
or you can add it using setAccessToken()->setMode()
or you can add it using `setAccessToken($token?)->setMode($mode?)`

You are now ready to use the package

Expand Down Expand Up @@ -63,15 +63,15 @@ At the controller, you can get the data from payment page at [DOCS](https://myfa
'ErrorUrl' => 'https://yourdomain.test/error',
];
// This one if you need to set credentials on the fly
// If you want to set the credentials and the mode manually.
// $myfatoorah = MyFatoorah::setAccessToken($token)->setMode('test')->createInvoice($data);
// And this one if you need to access token from config
$myfatoorah = MyFatoorah::createInvoice($data);
/ Here you will be response with invoice id and invoice url, you can redirect user to this page
return response()->json($myfatoorah);
}
// when you got a response from myFatoorah API, you can redirect the user to the myfatoorah portal
return response()->json($myfatoorah);
}
```
## Get callback to check if success payment
```
Expand All @@ -95,5 +95,16 @@ At the controller, you can get the data from payment page at [DOCS](https://myfa
}
```

# If you have any question, issue Or request, i'll be happy if hear any thing from you

## Authors

* **Ayman Elmalah** - *Initial work* - [ayman-elmalah](https://github.com/ayman-elmalah)

See also the list of [contributors](https://github.com/ayman-elmalah/laravel-myfatoorah/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* If yo have any questions, issues or PRs feel free to contact me.
6 changes: 3 additions & 3 deletions src/MyFatoorah.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function createInvoice($data = [])

/** @var Illuminate\Http\Client\Response $response */

$response = $this->getClient()->post($this->getFullIUrl(), $data);

$response = $this->getClient()->post($this->getFullUrl(), $data);
} catch(\Exception $exception) {
throw new \Exception($exception->getMessage());
}
Expand All @@ -51,7 +51,7 @@ public function payment($payment_id)
try {
$this->endpoint = 'GetPaymentStatus';

$this->payment = $this->getClient()->post($this->getFullIUrl(), [
$this->payment = $this->getClient()->post($this->getFullUrl(), [
'KeyType' => 'PaymentId',
'Key' => $payment_id,
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function setAccessToken($token = null)
* @return string
* @throws \Exception
*/
public function getFullIUrl() {
public function getFullUrl() {
return $this->getBasePath() . $this->getEndPoint();
}
}

0 comments on commit f08c922

Please sign in to comment.