Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
15
vendor/kingflamez/laravelrave/.editorconfig
vendored
Normal file
15
vendor/kingflamez/laravelrave/.editorconfig
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
; This file is for unifying the coding style for different editors and IDEs.
|
||||
; More information at http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
20
vendor/kingflamez/laravelrave/.gitignore
vendored
Normal file
20
vendor/kingflamez/laravelrave/.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
build
|
||||
vendor
|
||||
.DS_Store
|
||||
composer.lock
|
||||
.idea
|
||||
src/Rave3.php
|
||||
clover.xml
|
||||
.phpunit.result.cache
|
||||
pids
|
||||
logs
|
||||
node_modules
|
||||
npm-debug.log
|
||||
coverage/
|
||||
run
|
||||
dist
|
||||
.DS_Store
|
||||
.nyc_output
|
||||
.basement
|
||||
config.local.js
|
||||
basement_dist
|
||||
18
vendor/kingflamez/laravelrave/.prettierrc
vendored
Normal file
18
vendor/kingflamez/laravelrave/.prettierrc
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSpacing": false,
|
||||
"htmlWhitespaceSensitivity": "ignore",
|
||||
"insertPragma": false,
|
||||
"jsxBracketSameLine": false,
|
||||
"vetur.format.defaultFormatter.html": "prettier",
|
||||
"jsxSingleQuote": false,
|
||||
"printWidth": 210,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "none",
|
||||
"useTabs": false
|
||||
}
|
||||
17
vendor/kingflamez/laravelrave/.scrutinizer.yml
vendored
Normal file
17
vendor/kingflamez/laravelrave/.scrutinizer.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
checks:
|
||||
php: true
|
||||
filter:
|
||||
paths: ["src/*"]
|
||||
excluded_paths:
|
||||
- tests/*
|
||||
- resources/*
|
||||
- vendors/*
|
||||
|
||||
build:
|
||||
tests:
|
||||
override:
|
||||
-
|
||||
command: 'vendor/bin/phpunit --coverage-clover=clover.yml'
|
||||
coverage:
|
||||
file: 'clover.yml'
|
||||
format: 'clover'
|
||||
10
vendor/kingflamez/laravelrave/.travis.yml
vendored
Normal file
10
vendor/kingflamez/laravelrave/.travis.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
language: php
|
||||
php:
|
||||
- '5.6'
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
|
||||
install: composer install
|
||||
|
||||
script: composer run tests
|
||||
|
||||
21
vendor/kingflamez/laravelrave/LICENSE.md
vendored
Normal file
21
vendor/kingflamez/laravelrave/LICENSE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Oluwole Adebiyi (Flamez) <flamekeed@gmail.com>
|
||||
|
||||
> 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.
|
||||
71
vendor/kingflamez/laravelrave/README.md
vendored
Normal file
71
vendor/kingflamez/laravelrave/README.md
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# Flutterwave 🦄🦄 (Laravel 5,7,8 Package)
|
||||
|
||||
[![Latest Version on Packagist][ico-version]][link-packagist]
|
||||
[![Software License][ico-license]](LICENSE.md)
|
||||
[![Total Downloads][ico-downloads]][link-downloads]
|
||||
|
||||
|
||||
> Implement Flutterwave Rave payment gateway easily with Laravel
|
||||
|
||||
- Go to [Flutterwave](https://dashboard.flutterwave.com/dashboard/settings/apis) to get your public and private key
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
A friendly documentation can be found [here](https://laravelrave.netlify.com/)
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
- [Oluwole Adebiyi (Flamez)][link-author]
|
||||
- [Emmanuel Okeke](https://github.com/emmanix2002)
|
||||
- [Adebayo Mustafa](https://github.com/AdebsAlert)
|
||||
- [Tunde Aromire](https://github.com/toondaey)
|
||||
- [Ifunanya Ikemma](https://github.com/Iphytech)
|
||||
- [Abhishek Prakash](https://github.com/abhishek6262)
|
||||
- [Wallace Myem Aboiyar](https://github.com/wallacemyem)
|
||||
- [Chigozie Ekwonu](https://github.com/chygoz2)
|
||||
- [Emmanuel Towoju](https://github.com/towoju5)
|
||||
|
||||
## Contributing
|
||||
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. I will appreciate that a lot. Also please add your name to the credits.
|
||||
|
||||
Kindly [follow me on twitter](https://twitter.com/mrflamez_)!
|
||||
|
||||
## Features
|
||||
|
||||
The current features have been implemented
|
||||
|
||||
- Payment
|
||||
- Verification
|
||||
- Transfers
|
||||
- Banks
|
||||
- Beneficiaries
|
||||
|
||||
I will be working on this next
|
||||
- Tokenized Charge
|
||||
- Pre Auth Charge
|
||||
|
||||
> If there are features you need urgently, I will be willing to prioritize them, please reach out to my twitter account
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||
|
||||
[ico-version]: https://img.shields.io/packagist/v/kingflamez/laravelrave.svg?style=flat-square
|
||||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
|
||||
<!-- [ico-travis]: https://travis-ci.org/toondaey/laravelrave.svg?branch=master -->
|
||||
<!-- [ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/kingflamez/laravelrave.svg?style=flat-square -->
|
||||
<!-- [ico-code-quality]: https://scrutinizer-ci.com/g/toondaey/laravelrave/badges/quality-score.png?b=master -->
|
||||
<!-- [ico-code-intelligence]: https://scrutinizer-ci.com/g/toondaey/laravelrave/badges/code-intelligence.svg?b=master -->
|
||||
<!-- [ico-coverage]: https://scrutinizer-ci.com/g/toondaey/laravelrave/badges/coverage.png?b=master -->
|
||||
[ico-downloads]: https://img.shields.io/packagist/dt/kingflamez/laravelrave.svg?style=flat-square
|
||||
|
||||
[link-packagist]: https://packagist.org/packages/kingflamez/laravelrave
|
||||
[link-travis]: https://travis-ci.org/toondaey/laravelrave
|
||||
[link-scrutinizer]: https://scrutinizer-ci.com/g/kingflamez/laravelrave/code-structure
|
||||
[link-code-quality]: https://scrutinizer-ci.com/g/toondaey/laravelrave/?branch=master
|
||||
[link-downloads]: https://packagist.org/packages/kingflamez/laravelrave
|
||||
[link-author]: https://github.com/kingflamez
|
||||
[link-contributors]: ../../contributors
|
||||
[link-coverage]: https://scrutinizer-ci.com/g/toondaey/laravelrave/?branch=master
|
||||
[link-code-intelligence]: https://scrutinizer-ci.com/code-intelligence
|
||||
50
vendor/kingflamez/laravelrave/composer.json
vendored
Normal file
50
vendor/kingflamez/laravelrave/composer.json
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "kingflamez/laravelrave",
|
||||
"description": "A Laravel 5 Package for Flutterwave Rave",
|
||||
"keywords": ["php","github", "laravel","Open Source","payments", "kingflamez", "Flutterwave Rave", "Flutterwave", "rave", "ravepay.co","laravel 5"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "kingflamez",
|
||||
"email": "flamekeed@gmail.com"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"php": "^7.2|^8.0|^8.3",
|
||||
"illuminate/support": "^5.0|^6.0|^7.0|^8.0|^9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit" : "^8.3",
|
||||
"scrutinizer/ocular": "^1.1",
|
||||
"satooshi/php-coveralls": ">0.7",
|
||||
"mockery/mockery": ">1.2",
|
||||
"orchestra/testbench": ">4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/Rave.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"KingFlamez\\Rave\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"tests": "vendor/bin/phpunit --coverage-clover=\"clover.xml\""
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"KingFlamez\\Rave\\RaveServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Rave": "KingFlamez\\Rave\\Facades\\Rave"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
vendor/kingflamez/laravelrave/docs/.vuepress/components/Foo/Bar.vue
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/.vuepress/components/Foo/Bar.vue
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<p class="demo">
|
||||
{{ msg }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
msg: 'Hello this is <Foo-Bar>'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
3
vendor/kingflamez/laravelrave/docs/.vuepress/components/OtherComponent.vue
vendored
Normal file
3
vendor/kingflamez/laravelrave/docs/.vuepress/components/OtherComponent.vue
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<p class="demo">This is another component</p>
|
||||
</template>
|
||||
15
vendor/kingflamez/laravelrave/docs/.vuepress/components/demo-component.vue
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/.vuepress/components/demo-component.vue
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<p class="demo">
|
||||
{{ msg }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
msg: 'Hello this is <demo-component>'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
191
vendor/kingflamez/laravelrave/docs/.vuepress/config.js
vendored
Normal file
191
vendor/kingflamez/laravelrave/docs/.vuepress/config.js
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
const {description} = require('../../package')
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Ref:https://v1.vuepress.vuejs.org/config/#title
|
||||
*/
|
||||
title: 'Laravel Flutterwave 🦄🦄',
|
||||
/**
|
||||
* Ref:https://v1.vuepress.vuejs.org/config/#description
|
||||
*/
|
||||
description: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly',
|
||||
|
||||
/**
|
||||
* Extra tags to be injected to the page HTML `<head>`
|
||||
*
|
||||
* ref:https://v1.vuepress.vuejs.org/config/#head
|
||||
*/
|
||||
head: [
|
||||
['link', {rel: 'icon', href: `https://flutterwave.com/images/FLW-icon.png`}],
|
||||
['meta', {name: 'theme-color', content: '#3eaf7c'}],
|
||||
['meta', {name: 'apple-mobile-web-app-capable', content: 'yes'}],
|
||||
['meta', {name: 'twitter:card', content: 'summary_large_image'}],
|
||||
['meta', {name: 'twitter:url', content: 'https://laravelrave.netlify.app/'}],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'twitter:image:src',
|
||||
content: 'https://flutterwave.com/images/graph/home.png'
|
||||
}
|
||||
],
|
||||
['meta', {name: 'twitter:site', content: '@mrflamez_'}],
|
||||
['meta', {name: 'twitter:creator', content: '@mrflamez_'}],
|
||||
['meta', {name: 'og:type', content: 'website'}],
|
||||
['meta', {name: 'og:url', content: 'https://laravelrave.netlify.app/'}],
|
||||
['meta', {name: 'og:locale', content: 'en_US'}],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'og:image',
|
||||
content: 'https://flutterwave.com/images/graph/home.png'
|
||||
}
|
||||
],
|
||||
['meta', {name: 'og:locale', content: 'en_US'}],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'keywords',
|
||||
content:
|
||||
'online payments Nigeria, pay online in Nigeria, payment platforms in Nigeria, payment gateways in Nigeria, top 10 online payment processing platforms, top online payment gateways in Nigeria, best online payment gateways in Nigeria, online payment gateways in nigeria for e-commerce, payment platforms in Nigeria, Nigeria online payment platforms, laravel payment package, flutterwave laravel'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'description',
|
||||
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'twitter:title',
|
||||
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'twitter:description',
|
||||
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'og:site_name',
|
||||
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'og:title',
|
||||
content: 'Laravel Flutterwave 🦄🦄 | Integrate Flutterwave APIs seamlessly'
|
||||
}
|
||||
],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
name: 'og:description',
|
||||
content: 'A flutterwave laravel package to integrate with Laravel APIs seamlessly'
|
||||
}
|
||||
],
|
||||
['meta', {name: 'apple-mobile-web-app-status-bar-style', content: 'black'}]
|
||||
],
|
||||
nav: [
|
||||
{text: 'Home', link: '/'},
|
||||
{
|
||||
text: 'Installation',
|
||||
link: '/getting-started/installation.html'
|
||||
},
|
||||
{
|
||||
text: 'Payment Implementation',
|
||||
link: '/getting-started/payment-implementation.html'
|
||||
}
|
||||
],
|
||||
|
||||
/**
|
||||
* Theme configuration, here is the default theme configuration for VuePress.
|
||||
*
|
||||
* ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
|
||||
*/
|
||||
themeConfig: {
|
||||
// Assumes GitHub. Can also be a full GitLab url.
|
||||
repo: 'kingflamez/laravelrave',
|
||||
docsRepo: 'kingflamez/laravelrave',
|
||||
docsDir: 'docs',
|
||||
// defaults to false, set to true to enable
|
||||
editLinks: true,
|
||||
// custom text for edit link. Defaults to "Edit this page"
|
||||
editLinkText: 'Help us improve this page!',
|
||||
nav: [
|
||||
{text: 'Home', link: '/'},
|
||||
{
|
||||
text: 'Installation',
|
||||
link: '/getting-started/installation.html'
|
||||
},
|
||||
{
|
||||
text: 'Payment Implementation',
|
||||
link: '/getting-started/payment-implementation.html'
|
||||
}
|
||||
],
|
||||
lastUpdated: true,
|
||||
sidebar: [
|
||||
{
|
||||
title: 'Getting Started',
|
||||
children: ['/getting-started/installation.html', '/getting-started/payment-implementation.html']
|
||||
},
|
||||
{
|
||||
title: ' Verification/Notification',
|
||||
children: ['/verification/introduction.html', '/verification/webhook.html', '/verification/callback.html']
|
||||
},
|
||||
{
|
||||
title: 'Payments using APIs',
|
||||
children: [
|
||||
'/payments/introduction.html',
|
||||
'/payments/ach-payments.html',
|
||||
'/payments/ngn-bank-transfer.html',
|
||||
'/payments/gh-mobile-money.html',
|
||||
'/payments/rw-mobile-money.html',
|
||||
'/payments/ug-mobile-money.html',
|
||||
'/payments/zambia-mobile-money.html',
|
||||
'/payments/mpesa-mobile-money.html',
|
||||
'/payments/voucher-payments.html',
|
||||
'/payments/francophone-mobile-money.html'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Transfers',
|
||||
children: [
|
||||
'/transfers/introduction.html',
|
||||
'/transfers/initiate-transfers.html',
|
||||
'/transfers/retry-transfer.html',
|
||||
'/transfers/bulk-transfer.html',
|
||||
'/transfers/fees.html',
|
||||
'/transfers/fetch-transfers.html',
|
||||
'/transfers/fetch-a-transfer.html',
|
||||
'/transfers/retry-transfer-status.html',
|
||||
'/transfers/transfer-rates.html'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Beneficiaries',
|
||||
children: ['/beneficiaries/create-beneficiary.html', '/beneficiaries/list-beneficiaries.html', '/beneficiaries/fetch-beneficiary.html', '/beneficiaries/delete-beneficiary.html']
|
||||
},
|
||||
{
|
||||
title: 'Banks',
|
||||
children: ['/banks/list-banks.html', '/banks/bank-branches.html']
|
||||
}
|
||||
],
|
||||
displayAllHeaders: true
|
||||
},
|
||||
markdown: {
|
||||
lineNumbers: true
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply plugins,ref:https://v1.vuepress.vuejs.org/zh/plugin/
|
||||
*/
|
||||
plugins: ['@vuepress/plugin-back-to-top', '@vuepress/plugin-medium-zoom']
|
||||
}
|
||||
14
vendor/kingflamez/laravelrave/docs/.vuepress/enhanceApp.js
vendored
Normal file
14
vendor/kingflamez/laravelrave/docs/.vuepress/enhanceApp.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Client app enhancement file.
|
||||
*
|
||||
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
|
||||
*/
|
||||
|
||||
export default ({
|
||||
Vue, // the version of Vue being used in the VuePress app
|
||||
options, // the options for the root Vue instance
|
||||
router, // the router instance for the app
|
||||
siteData // site metadata
|
||||
}) => {
|
||||
// ...apply enhancements for the site.
|
||||
}
|
||||
15
vendor/kingflamez/laravelrave/docs/.vuepress/styles/index.styl
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/.vuepress/styles/index.styl
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Custom Styles here.
|
||||
*
|
||||
* ref:https://v1.vuepress.vuejs.org/config/#index-styl
|
||||
*/
|
||||
|
||||
.home .hero img
|
||||
max-width 450px!important
|
||||
width 100%
|
||||
|
||||
.sidebar-group a.sidebar-link
|
||||
font-weight: bold;
|
||||
|
||||
.sidebar-sub-headers a.sidebar-link
|
||||
font-weight: normal;
|
||||
10
vendor/kingflamez/laravelrave/docs/.vuepress/styles/palette.styl
vendored
Normal file
10
vendor/kingflamez/laravelrave/docs/.vuepress/styles/palette.styl
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Custom palette here.
|
||||
*
|
||||
* ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl
|
||||
*/
|
||||
|
||||
$accentColor = #F5A623
|
||||
$textColor = #2c3e50
|
||||
$borderColor = #eaecef
|
||||
$codeBgColor = #282c34
|
||||
15
vendor/kingflamez/laravelrave/docs/banks/bank-branches.md
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/banks/bank-branches.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Get Bank Branches
|
||||
|
||||
This helps you get the bank branches, pass the id of the bank. Click [here](/banks/list-banks) to get bank ids
|
||||
|
||||
## Sample
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$bankId = 191;
|
||||
$branches = Flutterwave::banks()->branches($bankId);
|
||||
|
||||
dd($branches);
|
||||
|
||||
```
|
||||
69
vendor/kingflamez/laravelrave/docs/banks/list-banks.md
vendored
Normal file
69
vendor/kingflamez/laravelrave/docs/banks/list-banks.md
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# List Banks
|
||||
|
||||
This helps you fetch banks with their code
|
||||
|
||||
## Get Nigerian Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->nigeria();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
|
||||
## Get Ghanaian Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->ghana();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
|
||||
## Get Kenyan Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->kenya();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
|
||||
## Get Ugandan Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->uganda();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
|
||||
## Get South African Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->southAfrica();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
|
||||
## Get Tanzanian Banks
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$banks = Flutterwave::banks()->tanzania();
|
||||
|
||||
dd($banks);
|
||||
|
||||
```
|
||||
22
vendor/kingflamez/laravelrave/docs/beneficiaries/create-beneficiary.md
vendored
Normal file
22
vendor/kingflamez/laravelrave/docs/beneficiaries/create-beneficiary.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Create a beneficiary
|
||||
|
||||
> Create a transfer beneficiary
|
||||
|
||||
```php
|
||||
<?php
|
||||
$data = [
|
||||
'account_number' => '0690000034',
|
||||
'account_bank' => '044'
|
||||
];
|
||||
|
||||
$beneficiary = Flutterwave::beneficiaries()->create($data);
|
||||
|
||||
dd($beneficiary);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| account_number | True | The beneficiary's bank account number. When testing on staging, you can find a list of all the available test bank accounts [here](https://developer.flutterwave.com/docs/test-bank-accounts). |
|
||||
| account_bank | True | This is the beneficiary’s bank code, you can use the [List of Banks](/banks/list-banks) to retrieve a bank code. |
|
||||
13
vendor/kingflamez/laravelrave/docs/beneficiaries/delete-beneficiary.md
vendored
Normal file
13
vendor/kingflamez/laravelrave/docs/beneficiaries/delete-beneficiary.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Delete a beneficiary
|
||||
|
||||
> Delete a transfer beneficiary.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$beneficiaryId = 12596;
|
||||
|
||||
$beneficiary = Flutterwave::beneficiaries()->destroy($beneficiaryId);
|
||||
|
||||
dd($beneficiary);
|
||||
```
|
||||
13
vendor/kingflamez/laravelrave/docs/beneficiaries/fetch-beneficiary.md
vendored
Normal file
13
vendor/kingflamez/laravelrave/docs/beneficiaries/fetch-beneficiary.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Fetch a beneficiary
|
||||
|
||||
> Get a single transfer beneficiary details.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$beneficiaryId = 12596;
|
||||
|
||||
$beneficiary = Flutterwave::beneficiaries()->fetch($beneficiaryId);
|
||||
|
||||
dd($beneficiary);
|
||||
```
|
||||
24
vendor/kingflamez/laravelrave/docs/beneficiaries/list-beneficiaries.md
vendored
Normal file
24
vendor/kingflamez/laravelrave/docs/beneficiaries/list-beneficiaries.md
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# List all beneficiaries
|
||||
|
||||
> Fetch all beneficiaries on your account.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
'page' => 1
|
||||
];
|
||||
|
||||
// $data is optional
|
||||
$beneficiaries = Flutterwave::beneficiaries()->fetchAll($data);
|
||||
|
||||
dd($beneficiaries);
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| page | False | This allows you fetch from a specific page e.g. setting page to 1 fetches the first page. |
|
||||
| status | False | This allows you fetch only transfers with a specific status e.g. fetch all successful transactions. Possible values are failed, successful |
|
||||
15
vendor/kingflamez/laravelrave/docs/config/README.md
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/config/README.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar: auto
|
||||
---
|
||||
|
||||
# Config
|
||||
|
||||
## foo
|
||||
|
||||
- Type: `string`
|
||||
- Default: `/`
|
||||
|
||||
## bar
|
||||
|
||||
- Type: `string`
|
||||
- Default: `/`
|
||||
64
vendor/kingflamez/laravelrave/docs/getting-started/installation.md
vendored
Normal file
64
vendor/kingflamez/laravelrave/docs/getting-started/installation.md
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Installation
|
||||
|
||||
This will guide you in installing the package
|
||||
|
||||
## Prerequisite
|
||||
[PHP](https://php.net) 7.2+, [Laravel](https://laravel.com) and [Composer](https://getcomposer.org) are required.
|
||||
|
||||
To get the latest version of Flutterwave, simply use composer
|
||||
|
||||
```bash
|
||||
composer require kingflamez/laravelrave
|
||||
```
|
||||
For **`Laravel => 5.5`**, skip this step and go to [**`configuration`**](#configuration)
|
||||
|
||||
Once Flutterwave is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.
|
||||
|
||||
```php
|
||||
'providers' => [
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
...
|
||||
KingFlamez\Rave\RaveServiceProvider::class,
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
Also add this to the `aliases`
|
||||
|
||||
```php
|
||||
'aliases' => [
|
||||
...
|
||||
'Rave' => KingFlamez\Rave\Facades\Rave::class,
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Publish the configuration file using this command:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --provider="KingFlamez\Rave\RaveServiceProvider"
|
||||
```
|
||||
|
||||
A configuration-file named **`flutterwave.php`** will be placed in your **`config`** directory
|
||||
|
||||
## Usage
|
||||
|
||||
Open your .env file and add your public key, secret key, environment variable and logo url like so:
|
||||
|
||||
Get your keys form [here](https://dashboard.flutterwave.com/dashboard/settings/apis)
|
||||
|
||||
```php
|
||||
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X
|
||||
FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X
|
||||
FLW_SECRET_HASH='My_lovelysite123'
|
||||
```
|
||||
|
||||
* **FLW_PUBLIC_KEY -** This is the api public key gotten from your dashboard (compulsory)
|
||||
|
||||
* **FLW_SECRET_KEY -** This is the api secret key gotten from your dashboard (compulsory)
|
||||
|
||||
* **FLW_SECRET_HASH -** This is the secret hash for your webhook
|
||||
169
vendor/kingflamez/laravelrave/docs/getting-started/payment-implementation.md
vendored
Normal file
169
vendor/kingflamez/laravelrave/docs/getting-started/payment-implementation.md
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
# Payment Modal Implementation
|
||||
|
||||
Initiating Flutterwave Payment Modal is simple using this package:
|
||||
|
||||
## 1. Setup Routes
|
||||
|
||||
```php
|
||||
// The page that displays the payment form
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
// The route that the button calls to initialize payment
|
||||
Route::post('/pay', [FlutterwaveController::class, 'initialize'])->name('pay');
|
||||
// The callback url after a payment
|
||||
Route::get('/rave/callback', [FlutterwaveController::class, 'callback'])->name('callback');
|
||||
```
|
||||
|
||||
## 2. Setup the Payment Page
|
||||
|
||||
A sample payment button will look like so:
|
||||
|
||||
> welcome.blade.php
|
||||
|
||||
```html
|
||||
<h3>Buy Movie Tickets N500.00</h3>
|
||||
<form method="POST" action="{{ route('pay') }}" id="paymentForm">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<input name="name" placeholder="Name" />
|
||||
<input name="email" type="email" placeholder="Your Email" />
|
||||
<input name="phone" type="tel" placeholder="Phone number" />
|
||||
|
||||
<input type="submit" value="Buy" />
|
||||
</form>
|
||||
```
|
||||
|
||||
## 3. Setup your Controller
|
||||
|
||||
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Rave` as `Flutterwave`
|
||||
> facade.
|
||||
|
||||
### Example
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use KingFlamez\Rave\Facades\Rave as Flutterwave;
|
||||
|
||||
class FlutterwaveController extends Controller
|
||||
{
|
||||
/**
|
||||
* Initialize Rave payment process
|
||||
* @return void
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
//This generates a payment reference
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
// Enter the details of the payment
|
||||
$data = [
|
||||
'payment_options' => 'card,banktransfer',
|
||||
'amount' => 500,
|
||||
'email' => request()->email,
|
||||
'tx_ref' => $reference,
|
||||
'currency' => "NGN",
|
||||
'redirect_url' => route('callback'),
|
||||
'customer' => [
|
||||
'email' => request()->email,
|
||||
"phonenumber" => request()->phone,
|
||||
"name" => request()->name
|
||||
],
|
||||
|
||||
"customizations" => [
|
||||
"title" => 'Movie Ticket',
|
||||
"description" => "20th October"
|
||||
]
|
||||
];
|
||||
|
||||
$payment = Flutterwave::initializePayment($data);
|
||||
|
||||
|
||||
if ($payment['status'] !== 'success') {
|
||||
// notify something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
return redirect($payment['data']['link']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain Rave callback information
|
||||
* @return void
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
|
||||
$transactionID = Flutterwave::getTransactionIDFromCallback();
|
||||
$data = Flutterwave::verifyTransaction($transactionID);
|
||||
|
||||
dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Once the initialize is called, you get redirected to a flutterwave payment page
|
||||
|
||||

|
||||
|
||||
> After a successful payment, the user is redirected to the call back page
|
||||
### Payment Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| tx_ref | True | Your transaction reference. This MUST be unique for every transaction |
|
||||
| amount | True | Amount to charge the customer. |
|
||||
| currency | False | currency to charge in. Defaults to NGN |
|
||||
| integrity_hash | False | This is a sha256 hash of your FlutterwaveCheckout values, it is used for passing secured values to the payment gateway. |
|
||||
| payment_options | True | This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on. |
|
||||
| payment_plan | False | This is the payment plan ID used for Recurring billing |
|
||||
| redirect_url | True | URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them. |
|
||||
| customer | True | This is an object that can contains your customer details: e.g - 'customer': `[ 'email' => 'example@example.com', 'phonenumber' => '08012345678', 'name' => 'Takeshi Kovacs' ]` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a']` |
|
||||
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments' 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a' ]` |
|
||||
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments', 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
|
||||
|
||||
#### Available payment options
|
||||
|
||||
To use custom options for your payment modal, you need to go to your [accounts](https://dashboard.flutterwave.com/dashboard/settings/accounts) page and uncheck `Enable Dashboard Payment Options`
|
||||
|
||||
Here are all the possible values for payment options available on Flutterwave:
|
||||
|
||||
- account
|
||||
- card
|
||||
- banktransfer
|
||||
- mpesa
|
||||
- mobilemoneyrwanda
|
||||
- mobilemoneyzambia
|
||||
- qr
|
||||
- mobilemoneyuganda
|
||||
- ussd
|
||||
- credit
|
||||
- barter
|
||||
- mobilemoneyghana
|
||||
- payattitude
|
||||
- mobilemoneyfranco
|
||||
- paga
|
||||
- 1voucher
|
||||
- mobilemoneytanzania
|
||||
|
||||
|
||||
### Alternate Confirmation
|
||||
|
||||
Apart from callback, you can also use Webhook to receive notifications for your transactions. Click [here](/verification/webhook.html) to set it up
|
||||
15
vendor/kingflamez/laravelrave/docs/index.md
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/index.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
home: true
|
||||
heroImage: https://flutterwave.com/images/graph/home.png
|
||||
tagline: A Laravel package that makes it easy to use Flutterwave APIs
|
||||
actionText: Get Started →
|
||||
actionLink: /getting-started/installation.html
|
||||
# features:
|
||||
# - title: Feature 1 Title
|
||||
# details: Feature 1 Description
|
||||
# - title: Feature 2 Title
|
||||
# details: Feature 2 Description
|
||||
# - title: Feature 3 Title
|
||||
# details: Feature 3 Description
|
||||
footer: Made by Oluwole Adebiyi (Kingflamez) with ❤️
|
||||
---
|
||||
40
vendor/kingflamez/laravelrave/docs/payments/ach-payments.md
vendored
Normal file
40
vendor/kingflamez/laravelrave/docs/payments/ach-payments.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# Charge via ACH payment
|
||||
|
||||
This helps you to accept South African ACH charges from your customers
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'currency' => 'ZAR',
|
||||
'tx_ref' => $reference,
|
||||
];
|
||||
|
||||
$response = Flutterwave::payments()->ach($data);
|
||||
|
||||
if ($response['status'] === 'success') {
|
||||
# code...
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| amount | True | This is the amount to be charged. Expected value is ZAR |
|
||||
| currency | True | ZAR or USD |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
| redirect_url | False | This is a url you provide, we redirect to it after the customer completes payment and append the response to it as query parameters. |
|
||||
| country | False | Pass your country as US for US ACH payments and ZA for SA ACH payments. |
|
||||
54
vendor/kingflamez/laravelrave/docs/payments/francophone-mobile-money.md
vendored
Normal file
54
vendor/kingflamez/laravelrave/docs/payments/francophone-mobile-money.md
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# Charge via Francophone mobile money
|
||||
|
||||
This document describes how to collect payments via Francophone mobile money.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$tx_ref = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 300,
|
||||
'currency' => 'XAF',
|
||||
'phone_number'=> '237******20',
|
||||
'email' => 'wole@email.co',
|
||||
'tx_ref' => $tx_ref
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->momoFranc($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
$data = Flutterwave::verifyTransaction($charge['data']['id']);
|
||||
return dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is ZMW |
|
||||
| currency | True | This is the specified currency to charge in. (expected value: XAF or XOF) ZMW |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| phone_number | True | This is the phone number linked to the customer's mobile money account |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| network | True | This is the customer's mobile money network. possible values are `MTN` `ZAMTEL` |
|
||||
| country | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
|
||||
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| redirect_url | False | URL to redirect to when a transaction is completed. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
42
vendor/kingflamez/laravelrave/docs/payments/gh-mobile-money.md
vendored
Normal file
42
vendor/kingflamez/laravelrave/docs/payments/gh-mobile-money.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# Charge via Ghana mobile money
|
||||
|
||||
This document describes how to collect payments via Ghana mobile money.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'redirect_url' => route('callback'),
|
||||
'tx_ref' => $reference,
|
||||
'phone_number' => '054709929220',
|
||||
'network' => 'MTN'
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->momoGH($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
// Redirect to the charge url
|
||||
return redirect($charge['data']['redirect']);
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is GHS |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| phone_number | True | This is the phone number linked to the customer's mobile money account. |
|
||||
| network | True | This is the customer's mobile money network provider (possible values: MTN, VODAFONE, TIGO) |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| redirect_url | False | URL to redirect to when a transaction is completed. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
3
vendor/kingflamez/laravelrave/docs/payments/introduction.md
vendored
Normal file
3
vendor/kingflamez/laravelrave/docs/payments/introduction.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Introduction
|
||||
|
||||
This is needed for merchants that do not want to use Flutterwave Payment Modal, and want to implement the APIs directly
|
||||
49
vendor/kingflamez/laravelrave/docs/payments/mpesa-mobile-money.md
vendored
Normal file
49
vendor/kingflamez/laravelrave/docs/payments/mpesa-mobile-money.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Charge via Mpesa
|
||||
|
||||
This document describes how to collect payments via Mpesa.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$tx_ref = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 1500,
|
||||
'email' => 'wole@email.co',
|
||||
'phone_number' => '054709929220',
|
||||
'tx_ref' => $tx_ref
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->mpesa($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
# code...
|
||||
// Redirect to the charge url
|
||||
$data = Flutterwave::verifyTransaction($charge['data']['id']);
|
||||
return dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is ZMW |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | True | This is the phone number linked to the customer's mobile money account. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
38
vendor/kingflamez/laravelrave/docs/payments/ngn-bank-transfer.md
vendored
Normal file
38
vendor/kingflamez/laravelrave/docs/payments/ngn-bank-transfer.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Charge via NGN bank transfer (One time Payment)
|
||||
|
||||
This allows your customer to pay via a NIP (NIBBS Instant Payment) transfer.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'tx_ref' => $reference,
|
||||
'narration' => 'Dstv - Bill Payment'
|
||||
];
|
||||
|
||||
$bankDetails = Flutterwave::payments()->nigeriaBankTransfer($data);
|
||||
|
||||
if ($bankDetails['status'] === 'success') {
|
||||
# show bank details to user
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| amount | True | This is the amount to be charged. Expected value is NGN |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg ```[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]```|
|
||||
|meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a']|
|
||||
91
vendor/kingflamez/laravelrave/docs/payments/payment-modal.md
vendored
Normal file
91
vendor/kingflamez/laravelrave/docs/payments/payment-modal.md
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
# Payment Modal
|
||||
|
||||
## 1. Initiating a Payment
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
//This generates a payment reference
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
// Enter the details of the payment
|
||||
$data = [
|
||||
'payment_options' => 'card,banktransfer',
|
||||
'amount' => 500,
|
||||
'email' => request()->email,
|
||||
'tx_ref' => $reference,
|
||||
'currency' => "NGN",
|
||||
'redirect_url' => route('callback'),
|
||||
'customer' => [
|
||||
'email' => request()->email,
|
||||
"phonenumber" => request()->phone,
|
||||
"name" => request()->name
|
||||
],
|
||||
|
||||
"customizations" => [
|
||||
"title" => 'Movie Ticket',
|
||||
"description" => "20th October"
|
||||
]
|
||||
];
|
||||
|
||||
$payment = Flutterwave::initializePayment($data);
|
||||
|
||||
if (!$payment) {
|
||||
// notify something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
return redirect($payment['link']);
|
||||
|
||||
```
|
||||
|
||||
### Payment Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| tx_ref | True | Your transaction reference. This MUST be unique for every transaction |
|
||||
| amount | True | Amount to charge the customer. |
|
||||
| currency | False | currency to charge in. Defaults to NGN |
|
||||
| integrity_hash | False | This is a sha256 hash of your FlutterwaveCheckout values, it is used for passing secured values to the payment gateway. |
|
||||
| payment_options | True | This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on. |
|
||||
| payment_plan | False | This is the payment plan ID used for Recurring billing |
|
||||
| redirect_url | True | URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them. |
|
||||
| customer | True | This is an object that can contains your customer details: e.g - 'customer': `[ 'email' => 'example@example.com', 'phonenumber' => '08012345678', 'name' => 'Takeshi Kovacs' ]` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a']` |
|
||||
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments' 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g `[ 'consumer_id' => 23, 'consumer_mac' => '92a3-912ba-1192a' ]` |
|
||||
| customizations | True | This is an object that contains title, logo, and description you want to display on the modal e.g `[ 'title' => 'Pied Piper Payments', 'description' => 'Middleout isn't free. Pay the price', 'logo' => 'https://assets.piedpiper.com/logo.png' ]` |
|
||||
|
||||
#### Available payment options
|
||||
|
||||
To use custom options for your payment modal, you need to go to your [accounts](https://dashboard.flutterwave.com/dashboard/settings/accounts) page and uncheck `Enable Dashboard Payment Options`
|
||||
|
||||
Here are all the possible values for payment options available on Flutterwave:
|
||||
|
||||
- account
|
||||
- card
|
||||
- banktransfer
|
||||
- mpesa
|
||||
- mobilemoneyrwanda
|
||||
- mobilemoneyzambia
|
||||
- qr
|
||||
- mobilemoneyuganda
|
||||
- ussd
|
||||
- credit
|
||||
- barter
|
||||
- mobilemoneyghana
|
||||
- payattitude
|
||||
- mobilemoneyfranco
|
||||
- paga
|
||||
- 1voucher
|
||||
- mobilemoneytanzania
|
||||
|
||||
## 2. Verifying a Payment:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$data = Flutterwave::verifyTransaction(request()->transaction_id);
|
||||
```
|
||||
44
vendor/kingflamez/laravelrave/docs/payments/rw-mobile-money.md
vendored
Normal file
44
vendor/kingflamez/laravelrave/docs/payments/rw-mobile-money.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# Charge via Rwanda mobile money
|
||||
|
||||
This document describes how to collect payments via Rwanda mobile money.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$tx_ref = Flutterwave::generateReference();
|
||||
$order_id = Flutterwave::generateReference('momo');
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'redirect_url' => route('callback'),
|
||||
'phone_number' => '054709929220',
|
||||
'tx_ref' => $tx_ref,
|
||||
'order_id' => $order_id
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->momoRW($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
# code...
|
||||
// Redirect to the charge url
|
||||
return redirect($charge['data']['redirect']);
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is RWF |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| order_id | True | Unique ref for the mobilemoney transaction to be provided by the merchant. |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| redirect_url | False | URL to redirect to when a transaction is completed. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
46
vendor/kingflamez/laravelrave/docs/payments/ug-mobile-money.md
vendored
Normal file
46
vendor/kingflamez/laravelrave/docs/payments/ug-mobile-money.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Charge via Uganda mobile money
|
||||
|
||||
This document describes how to collect payments via Uganda mobile money.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$tx_ref = Flutterwave::generateReference();
|
||||
$order_id = Flutterwave::generateReference('momo');
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'redirect_url' => route('callback'),
|
||||
'phone_number' => '054709929220',
|
||||
'tx_ref' => $tx_ref,
|
||||
'order_id' => $order_id
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->momoUG($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
# code...
|
||||
// Redirect to the charge url
|
||||
return redirect($charge['data']['redirect']);
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is RWF |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| order_id | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
|
||||
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
|
||||
| network | False | This is the customer's mobile money network provider |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| redirect_url | False | URL to redirect to when a transaction is completed. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
51
vendor/kingflamez/laravelrave/docs/payments/voucher-payments.md
vendored
Normal file
51
vendor/kingflamez/laravelrave/docs/payments/voucher-payments.md
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Charge via Voucher payment
|
||||
|
||||
This page describes how to collect ZAR payments offline using Vouchers
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'tx_ref' => $reference,
|
||||
'pin' => '19203804939000',
|
||||
];
|
||||
|
||||
$response = Flutterwave::payments()->voucher($data);
|
||||
|
||||
if ($response['status'] === 'success') {
|
||||
# code...
|
||||
$data = Flutterwave::verifyTransaction($response['data']['id']);
|
||||
return dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| amount | True | This is the amount to be charged. Expected value is ZAR |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| pin | True | This is the voucher pin given to the user after redemption at the agent location. They would provide this to you as the voucher code. |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
| redirect_url | False | This is a url you provide, we redirect to it after the customer completes payment and append the response to it as query parameters. |
|
||||
| country | False | Pass your country as US for US ACH payments and ZA for SA ACH payments. |
|
||||
47
vendor/kingflamez/laravelrave/docs/payments/zambia-mobile-money.md
vendored
Normal file
47
vendor/kingflamez/laravelrave/docs/payments/zambia-mobile-money.md
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Charge via Zambia mobile money
|
||||
|
||||
This document describes how to collect payments via Zambia mobile money.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$tx_ref = Flutterwave::generateReference();
|
||||
$order_id = Flutterwave::generateReference('momo');
|
||||
|
||||
$data = [
|
||||
'amount' => 100,
|
||||
'email' => 'wole@email.co',
|
||||
'redirect_url' => route('callback'),
|
||||
'phone_number' => '054709929220',
|
||||
'tx_ref' => $tx_ref,
|
||||
'network' => 'MTN',
|
||||
'order_id' => $order_id
|
||||
];
|
||||
|
||||
$charge = Flutterwave::payments()->momoZambia($data);
|
||||
|
||||
if ($charge['status'] === 'success') {
|
||||
# code...
|
||||
// Redirect to the charge url
|
||||
return redirect($charge['data']['redirect']);
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to be charged. Expected value is ZMW |
|
||||
| email | True | This is the email address of the customer. |
|
||||
| tx_ref | True | This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction. |
|
||||
| network | True | This is the customer's mobile money network. possible values are `MTN ` `ZAMTEL` |
|
||||
| order_id | False | Unique ref for the mobilemoney transaction to be provided by the merchant. |
|
||||
| voucher | False | This is the voucher code generated by the customer. It is meant to be passed in the initial charge request. (only for Vodafone cash) provider |
|
||||
| fullname | False | This is the customers full name. It should include first and last name of the customer. |
|
||||
| phone_number | False | This is the phone number linked to the customer's mobile money account. |
|
||||
| redirect_url | False | URL to redirect to when a transaction is completed. |
|
||||
| client_ip | False | IP - Internet Protocol. This represents the current IP address of the customer carrying out the transaction |
|
||||
| device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
|
||||
| meta | False | This is used to include additional payment information` |
|
||||
| subaccounts | False | This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info. eg `[ ["id" => "RS_D87A9EE339AE28BFA2AE86041C6DE70E"]]` |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
42
vendor/kingflamez/laravelrave/docs/transfers/bulk-transfer.md
vendored
Normal file
42
vendor/kingflamez/laravelrave/docs/transfers/bulk-transfer.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# Bulk Transfer
|
||||
|
||||
This document shows you how to initiate a bulk transfer.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"title" => "akhlm pstmn blktrnfr xx03",
|
||||
"bulk_data" => [
|
||||
[
|
||||
"bank_code" => "044",
|
||||
"account_number" => "0690000032",
|
||||
"amount" => 45000,
|
||||
"currency" => "NGN",
|
||||
"narration" => "akhlm blktrnsfr",
|
||||
"reference" => "akhlm-blktrnsfr-xx03"
|
||||
],
|
||||
[
|
||||
"bank_code" => "044",
|
||||
"account_number" => "0690000034",
|
||||
"amount" => 5000,
|
||||
"currency" => "NGN",
|
||||
"narration" => "akhlm blktrnsfr",
|
||||
"reference" => "akhlm-blktrnsfr-xy03"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->bulk($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
Please setup a [webhook](/verification/webhook) to get status on your transfers. When you initiate a transfer you get a queuing status, once the transfer is successful or failed, we hit your webhook to alert you, you can update the status of the transfer from there
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| bulk_data | True | An array of objects containing the transfer charge data. This array contains the same payload you would passed to create [a single transfer](/transfers/initiate-transfers) with multiple different values. |
|
||||
| title | False | Title of the bulk transfer |
|
||||
26
vendor/kingflamez/laravelrave/docs/transfers/fees.md
vendored
Normal file
26
vendor/kingflamez/laravelrave/docs/transfers/fees.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Transfer Fees
|
||||
|
||||
Get applicable transfer fee.
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
'amount' => '500',
|
||||
'currency' => 'USD'
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->fees($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the transfer amount to be fetched. |
|
||||
| currency | False | Pass this to specify the exact currency you want to fetch the fees for. Example: USD, NGN, etc |
|
||||
| type | False | This is the type of transfer you want to get the fee for. Usual values are `mobilemoney` or `account` |
|
||||
12
vendor/kingflamez/laravelrave/docs/transfers/fetch-a-transfer.md
vendored
Normal file
12
vendor/kingflamez/laravelrave/docs/transfers/fetch-a-transfer.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Get a transfer
|
||||
|
||||
Fetch a single transfer on your account
|
||||
|
||||
```php
|
||||
<?php
|
||||
$transferId = 187092;
|
||||
|
||||
$transfer = Flutterwave::transfers()->fetch($transferId);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
25
vendor/kingflamez/laravelrave/docs/transfers/fetch-transfers.md
vendored
Normal file
25
vendor/kingflamez/laravelrave/docs/transfers/fetch-transfers.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# Get all transfers
|
||||
|
||||
Fetch all transfers on your account.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
'page' => 1,
|
||||
'status' => 'SUCCESSFUL'
|
||||
];
|
||||
|
||||
// $data is optional
|
||||
$transfers = Flutterwave::transfers()->fetchAll($data);
|
||||
|
||||
dd($transfers);
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| page | False | This allows you fetch from a specific page e.g. setting page to 1 fetches the first page. |
|
||||
| status | False | This allows you fetch only transfers with a specific status e.g. fetch all successful transactions. Possible values are failed, successful |
|
||||
434
vendor/kingflamez/laravelrave/docs/transfers/initiate-transfers.md
vendored
Normal file
434
vendor/kingflamez/laravelrave/docs/transfers/initiate-transfers.md
vendored
Normal file
@@ -0,0 +1,434 @@
|
||||
# Initiate Transfer
|
||||
|
||||
This will show you how to initiate a transfer.
|
||||
|
||||
```php
|
||||
<?php
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
'account_bank'=> '044',
|
||||
'account_number'=> '0690000040',
|
||||
'amount' => 5500,
|
||||
'narration' => 'Payment for goods purchased',
|
||||
'currency' => 'NGN',
|
||||
'reference' => $reference
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
Please setup a [webhook](/verification/webhook) to get status on your transfers. When you initiate a transfer you get a queuing status, once the transfer is successful or failed, we hit your webhook to alert you, you can update the status of the transfer from there.
|
||||
|
||||
> You can also setup a cron job that checks all pending transfers status in your db and updates them accordingly
|
||||
|
||||
```php
|
||||
|
||||
$transferId = 187092; // get transfer ID from your DB
|
||||
$transfer = Flutterwave::transfers()->fetch($transferId);
|
||||
|
||||
if($transfer['data']['status'] === 'SUCCESSFUL') {
|
||||
// update transfer status to successful in your db
|
||||
} else if ($transfer['data']['status'] === 'FAILED') {
|
||||
// update transfer status to failed in your db
|
||||
// revert customer balance back
|
||||
} else if ($transfer['data']['status'] === 'PENDING') {
|
||||
// update transfer status to pending in your db
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| account_bank | True | This is the recipient bank code. You can see a list of all the available banks and their codes [here](/banks/list-banks). |
|
||||
| account_number | True | This is the recipient account number. When testing on staging, you can find a list of test bank accounts [here](https://developer.flutterwave.com/docs/test-bank-accounts).. |
|
||||
| amount | True | This is the amount to transfer to the recipient. |
|
||||
| currency | True | This can be `NGN`, `GHS`, `KES`, `UGX`, `TZS`, `USD` or `ZAR`. |
|
||||
| narration | False | This is the narration for the transfer e.g. payments for x services provided |
|
||||
| beneficiary_name | False | This is the name of the beneficiary.. |
|
||||
| destination_branch_code | False | This code uniquely identifies bank branches for disbursements into Ghana, Uganda and Tanzania. It is returned in the call to fetch bank branches here: [Click Here](/banks/bank-branches). It is only REQUIRED for GHS, UGX and TZS bank transfers. |
|
||||
| beneficiary | False | This is the beneficiary's id. It allows you to initiate a transfer to an existing beneficiary. You can pass this in place of `account_bank` & `account_number`. It is returned in the call to fetch a beneficiary as `data['id']`. [Click here to create a beneficiary](/beneficiaries/create-beneficiary) |
|
||||
| reference | False | This is a merchant's unique reference for the transfer, it can be used to query for the status of the transfer. |
|
||||
| debit_currency | False | You can pass this when you want to debit a currency balance and send money in another currency. |
|
||||
| meta | False | This is an object that helps you include additional payment information to your request e.g ['consumer_id'=>23, 'consumer_mac'=>'92a3-912ba-1192a'] |
|
||||
|
||||
|
||||
|
||||
## Transfer to Nigerian bank accounts
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
$data = [
|
||||
"account_bank"=>"044",
|
||||
"account_number"=>"0690000040",
|
||||
"amount"=>5500,
|
||||
"narration"=>"Akhlm Pstmn Trnsfr xx007",
|
||||
"currency"=>"NGN",
|
||||
"debit_currency"=>"NGN"
|
||||
'reference' => $reference
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
|
||||
// {
|
||||
// "status": "success",
|
||||
// "message": "Transfer Queued Successfully",
|
||||
// "data": {
|
||||
// "id": 26251,
|
||||
// "account_number": "0690000040",
|
||||
// "bank_code": "044",
|
||||
// "full_name": "Ekene Eze",
|
||||
// "created_at": "2020-01-20T16:09:34.000Z",
|
||||
// "currency": "NGN",
|
||||
// "debit_currency": "NGN",
|
||||
// "amount": 5500,
|
||||
// "fee": 45,
|
||||
// "status": "NEW",
|
||||
// "reference": "akhlm-pstmnpyt-rfxx007_PMCKDU_1",
|
||||
// "meta": null,
|
||||
// "narration": "Akhlm Pstmn Trnsfr xx007",
|
||||
// "complete_message": "",
|
||||
// "requires_approval": 0,
|
||||
// "is_approved": 1,
|
||||
// "bank_name": "ACCESS BANK NIGERIA"
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
## International Transfers (Other countries)
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"amount" => 50,
|
||||
"narration" => "Test Int'l bank transfers",
|
||||
"currency" => "USD",
|
||||
"reference" => "new-intl-test-transfer",
|
||||
"beneficiary_name" => "Mark Cuban ",
|
||||
"meta" => [
|
||||
[
|
||||
"AccountNumber" => "091820932BH",
|
||||
"RoutingNumber" => "0000002993",
|
||||
"SwiftCode" => "ABJG190",
|
||||
"BankName" => "BARCLAYS BANK (U) LIMITED",
|
||||
"BeneficiaryName" => "Mark Cuban",
|
||||
"BeneficiaryAddress" => "HANNINGTON ROAD, KAMPALA UGANDA",
|
||||
"BeneficiaryCountry" => "OT"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
|
||||
|
||||
```
|
||||
|
||||
## International Transfers (EUR & GBP)
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"amount" => 50,
|
||||
"narration" => "Test EU Int'l bank transfers",
|
||||
"currency" => "EUR",
|
||||
"reference" => "new-intl-eu-test-transfer",
|
||||
"beneficiary_name" => "John Twain",
|
||||
"meta" => [
|
||||
[
|
||||
"AccountNumber" => "DA091983888373BGH",
|
||||
"RoutingNumber" => "BECFDE7HKKX",
|
||||
"SwiftCode" => "BECFDE7HKKX",
|
||||
"BankName" => "LLOYDS BANK",
|
||||
"BeneficiaryName" => "John Twain",
|
||||
"BeneficiaryCountry" => "DE",
|
||||
"PostalCode" => "80489",
|
||||
"StreetNumber" => "31",
|
||||
"StreetName" => "Handelsbank Elsenheimer Str.",
|
||||
"City" => "München"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Transfer to Ghana bank account
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "GH280100",
|
||||
"account_number" => "0031625807099",
|
||||
"amount" => 50,
|
||||
"narration" => "Test GHS bank transfers",
|
||||
"currency" => "GHS",
|
||||
"reference" => "new-GHS-test-transfer1",
|
||||
"callback_url" => "https://webhook.site/b3e505b0-fe02-430e-a538-22bbbce8ce0d",
|
||||
"destination_branch_code" => "GH280103",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## International transfers (US)
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"amount" => 50,
|
||||
"narration" => "Test Int'l bank transfers",
|
||||
"currency" => "USD",
|
||||
"reference" => "new-intl-test-transfer1",
|
||||
"beneficiary_name" => "Mark Cuban ",
|
||||
"meta" => [
|
||||
[
|
||||
"AccountNumber" => "09182972BH",
|
||||
"RoutingNumber" => "0000000002993",
|
||||
"SwiftCode" => "ABJG190",
|
||||
"BankName" => "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
|
||||
"BeneficiaryName" => "Mark Cuban",
|
||||
"BeneficiaryAddress" => "San Francisco, 4 Newton",
|
||||
"BeneficiaryCountry" => "US"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Mpesa Mobile Money Transfer
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "MPS",
|
||||
"account_number" => "2540782773934",
|
||||
"amount" => 50,
|
||||
"narration" => "New transfer",
|
||||
"currency" => "KES",
|
||||
"reference" => "mk-902837-jk",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Ghana Mobile Money Transfer
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "MTN",
|
||||
"account_number" => "233542773934",
|
||||
"amount" => 50,
|
||||
"narration" => "New GHS momo transfer",
|
||||
"currency" => "GHS",
|
||||
"reference" => "mk-902837-jk",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Uganda Mobile Money Transfer
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "MPS",
|
||||
"account_number" => "233542773934",
|
||||
"amount" => 50,
|
||||
"narration" => "New UGX momo transfer",
|
||||
"currency" => "UGX",
|
||||
"reference" => "mk-902837-jk",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Rwanda Mobile Money Transfer
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "MPS",
|
||||
"account_number" => "233542773934",
|
||||
"amount" => 50,
|
||||
"narration" => "New RWF momo transfer",
|
||||
"currency" => "RWF",
|
||||
"reference" => "mk-902837-jk",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Francophone Mobile Money Transfer
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "FMM",
|
||||
"account_number" => "233542773934",
|
||||
"amount" => 50,
|
||||
"narration" => "New franco momo transfer",
|
||||
"currency" => "XAF",
|
||||
"reference" => "mk-902837-jk",
|
||||
"beneficiary_name" => "Kwame Adew"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Transfer to a FLW account
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "flutterwave",
|
||||
"account_number" => "00118468",
|
||||
"amount" => 5500,
|
||||
"narration" => "payment for x service provided",
|
||||
"currency" => "NGN",
|
||||
"reference" => "mk-902837-jk",
|
||||
"debit_currency" => "NGN"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Transfer USD to Nigerian DOM Accounts
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_number" => "0690000036",
|
||||
"account_bank" => "044",
|
||||
"narration" => "Nada",
|
||||
"amount" => 50,
|
||||
"reference" => "khlm-dom-065",
|
||||
"currency" => "USD",
|
||||
"debit_currency" => "USD",
|
||||
"beneficiary_name" => "Michale Lester",
|
||||
"meta" => [
|
||||
[
|
||||
"first_name" => "Michale",
|
||||
"last_name" => "Lester",
|
||||
"email" => "dump@kizito",
|
||||
"beneficiary_country" => "NG",
|
||||
"mobile_number" => "+2348131133933",
|
||||
"sender" => "Statik Selektah",
|
||||
"merchant_name" => "Spotify"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Transfer to SA Bank Account
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_bank" => "FNB",
|
||||
"account_number" => "0031625807099",
|
||||
"amount" => 500,
|
||||
"narration" => "Withdraw Fiat",
|
||||
"currency" => "ZAR",
|
||||
"reference" => "496_PMCKDU_1",
|
||||
"debit_currency":"USD",
|
||||
"callback_url" => "http://localhost:3000/deposits/banks/flutterwave_callback",
|
||||
"meta" => [
|
||||
[
|
||||
"first_name" => "Michale",
|
||||
"last_name" => "Lester",
|
||||
"email" => "dump@kizito",
|
||||
"mobile_number" => "+2348131133933"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Transfer to Barter account
|
||||
|
||||
```php
|
||||
|
||||
<?php
|
||||
|
||||
$data = [
|
||||
"account_number" => "+2348xxxxxxxx8",
|
||||
"account_bank" => "barter",
|
||||
"narration" => "Test",
|
||||
"amount" => 20,
|
||||
"reference" => "barter-transfer-2",
|
||||
"currency" => "NGN",
|
||||
"beneficiary_name" => "Ifunanya Ikemma"
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->initiate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
15
vendor/kingflamez/laravelrave/docs/transfers/introduction.md
vendored
Normal file
15
vendor/kingflamez/laravelrave/docs/transfers/introduction.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Introduction
|
||||
|
||||
Transfers are used to send money to bank accounts.
|
||||
|
||||
## How transfers work
|
||||
|
||||
When a transfer is initiated, it comes with a status `NEW` indicating that the transfer has been queued for processing, and you would need to use the transfer ID to call the Fetch a Transfer endpoint to retrieve the updated status of the transfer.
|
||||
|
||||
|
||||
## What happens when a transfer is completed?
|
||||
When a transfer is completed we would push a notification to you via your Webhook. You can use the information we sent to you to confirm the status of the transfer.
|
||||
|
||||
If a transfer is already being processed and it fails during processing, we would also push a hook notification to you on your specified hook URL.
|
||||
|
||||
Click [here](/verification/webhook) to setup the webhook
|
||||
13
vendor/kingflamez/laravelrave/docs/transfers/retry-transfer-status.md
vendored
Normal file
13
vendor/kingflamez/laravelrave/docs/transfers/retry-transfer-status.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Fetch transfer retry status
|
||||
|
||||
Fetch transfer retry attempts for a single transfer on your account.
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
$retryId = 187092;
|
||||
|
||||
$retries = Flutterwave::transfers()->fetchRetries($retryId);
|
||||
|
||||
dd($retries);
|
||||
```
|
||||
13
vendor/kingflamez/laravelrave/docs/transfers/retry-transfer.md
vendored
Normal file
13
vendor/kingflamez/laravelrave/docs/transfers/retry-transfer.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Retry Transfer
|
||||
|
||||
This helps you retry a previously failed transfer.
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
$transferId = 187092;
|
||||
|
||||
$transfer = Flutterwave::transfers()->retry($transferId);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
66
vendor/kingflamez/laravelrave/docs/transfers/transfer-rates.md
vendored
Normal file
66
vendor/kingflamez/laravelrave/docs/transfers/transfer-rates.md
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# Check transfer rates
|
||||
|
||||
This endpoint helps you understand transfer rates when making international transfers
|
||||
|
||||
```php
|
||||
<?php
|
||||
$data = [
|
||||
'amount' => 1000,
|
||||
'destination_currency' => 'USD',
|
||||
'source_currency' => 'NGN'
|
||||
];
|
||||
|
||||
$transfer = Flutterwave::transfers()->getTransferRate($data);
|
||||
|
||||
dd($transfer);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| amount | True | This is the amount to transfer to the recipient. |
|
||||
| destination_currency | True | This is the wallet / currency you are making a transfer to. |
|
||||
| source_currency | True | This is the wallet / currency to be debited for the transfer. |
|
||||
|
||||
|
||||
::: warning This endpoint helps you calculate rates when making international transfers
|
||||
John owes Paul $1000.
|
||||
John only has money in his Flutterwave NGN wallet.
|
||||
So he wants to send $1000 to Paul's but he wants Flutterwave to debit his NGN wallet for it.
|
||||
But first, John would like to know exactly how much in Naira is $1000.
|
||||
So he makes a request to this endpoint, with this object :
|
||||
|
||||
```php
|
||||
$data = [
|
||||
'amount' => 1000,
|
||||
'destination_currency' => 'USD',
|
||||
'source_currency' => 'NGN'
|
||||
];
|
||||
```
|
||||
Which basically means "How much will it cost me to send $1000 from my NGN wallet to Paul?" Here's the response:
|
||||
|
||||
```php
|
||||
[
|
||||
"status" => "success",
|
||||
"message" => "Transfer amount fetched",
|
||||
"data" => [
|
||||
"rate" => 415.264373,
|
||||
"source" => [
|
||||
"currency" => "NGN",
|
||||
"amount" => 415264.373
|
||||
],
|
||||
"destination" => [
|
||||
"currency" => "USD",
|
||||
"amount" => 1000
|
||||
]
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
The response tells John that "If you are sending $1000 from your NGN wallet to Paul, it will cost you NGN415,264.373"
|
||||
|
||||
This is one of the use cases for this endpoint. To help you understand the transfer rates when you are sending money across different currencies.
|
||||
|
||||
DISCLAIMER: This endpoint should NOT be used to determine FX rates from the central bank. Refer [here](https://www.abokifx.com/) for rates.
|
||||
:::
|
||||
134
vendor/kingflamez/laravelrave/docs/verification/callback.md
vendored
Normal file
134
vendor/kingflamez/laravelrave/docs/verification/callback.md
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# Callbacks
|
||||
|
||||
If the `redirect_url` is added to your payment data, Flutterwave redirects there after every payment request
|
||||
|
||||
|
||||
|
||||
|
||||
## 1. Setup your callback route
|
||||
|
||||
```php
|
||||
// The callback url after a payment
|
||||
Route::get('/rave/callback', [FlutterwaveController::class, 'callback'])->name('callback');
|
||||
```
|
||||
|
||||
|
||||
## 2. Setup your Controller
|
||||
|
||||
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Flutterwave`
|
||||
> facade.
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use KingFlamez\Rave\Facades\Rave as Flutterwave;
|
||||
|
||||
class FlutterwaveController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Obtain Flutterwave callback information
|
||||
* @return void
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
|
||||
$transactionID = Flutterwave::getTransactionIDFromCallback();
|
||||
$data = Flutterwave::verifyTransaction($transactionID);
|
||||
|
||||
dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## 3. Make sure to add `'redirect_url' => route('callback'),` to all your payment requests that will use the callback
|
||||
|
||||
eg
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use KingFlamez\Rave\Facades\Rave as Flutterwave;
|
||||
|
||||
class FlutterwaveController extends Controller
|
||||
{
|
||||
/**
|
||||
* Initialize Rave payment process
|
||||
* @return void
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
//This generates a payment reference
|
||||
$reference = Flutterwave::generateReference();
|
||||
|
||||
// Enter the details of the payment
|
||||
$data = [
|
||||
'payment_options' => 'card,banktransfer',
|
||||
'amount' => 500,
|
||||
'email' => request()->email,
|
||||
'tx_ref' => $reference,
|
||||
'currency' => "NGN",
|
||||
'redirect_url' => route('callback'),
|
||||
'customer' => [
|
||||
'email' => request()->email,
|
||||
"phonenumber" => request()->phone,
|
||||
"name" => request()->name
|
||||
],
|
||||
|
||||
"customizations" => [
|
||||
"title" => 'Movie Ticket',
|
||||
"description" => "20th October"
|
||||
]
|
||||
];
|
||||
|
||||
$payment = Flutterwave::initializePayment($data);
|
||||
|
||||
if (!$payment) {
|
||||
// notify something went wrong
|
||||
return;
|
||||
}
|
||||
|
||||
return redirect($payment['link']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain Rave callback information
|
||||
* @return void
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
|
||||
$transactionID = Flutterwave::getTransactionIDFromCallback();
|
||||
$data = Flutterwave::verifyTransaction($transactionID);
|
||||
|
||||
dd($data);
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Confirm that the $data['data']['status'] is 'successful'
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
9
vendor/kingflamez/laravelrave/docs/verification/introduction.md
vendored
Normal file
9
vendor/kingflamez/laravelrave/docs/verification/introduction.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Payment Verification
|
||||
|
||||
When a user is done with payment, Flutterwave would redirect to your redirect url if present or hit your webhook url:
|
||||
|
||||
Please make sure one of this is available as it is important to verify all transactions before giving value to it
|
||||
|
||||
## [Webhook Notification](/verification/webhook.html)
|
||||
|
||||
## [Callback Notification](/verification/callback.html)
|
||||
179
vendor/kingflamez/laravelrave/docs/verification/webhook.md
vendored
Normal file
179
vendor/kingflamez/laravelrave/docs/verification/webhook.md
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
# Webhooks
|
||||
|
||||
Click [here](https://developer.flutterwave.com/reference#webhook) to learn more about webhooks
|
||||
|
||||
For every transaction, Flutterwave will send a post request of the transaction to you, follow these steps to set it up
|
||||
|
||||
|
||||
|
||||
|
||||
## 1. Setup your webhook routes
|
||||
|
||||
```php
|
||||
Route::post('/webhook/flutterwave', [FlutterwaveController::class, 'webhook'])->name('webhook');
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 2. Add your webhook secret hash to your `.env`
|
||||
|
||||
```bash
|
||||
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X
|
||||
FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X
|
||||
FLW_SECRET_HASH='MY_POTTY_PATTY'
|
||||
```
|
||||
|
||||
## 3. Setup the webhook in your Flutterwave Dashboard
|
||||
|
||||
<img src="https://files.readme.io/6fc5add-Screenshot_2018-01-19_11.45.24.png" style="margin: 0 auto;" >
|
||||
|
||||
<p style="text-align: center">Login to you Flutterwave dashboard then click on settings , on the setting page navigate to webhooks to add a webhook.</p>
|
||||
|
||||
<img src="https://files.readme.io/fd1589b-webhook.png" style="margin: 0 auto;" >
|
||||
|
||||
<p style="text-align: center">Once on the webhook page, click the input text to add your webhook url and your secret hash and use the save action button to save it.</p>
|
||||
|
||||
## 4. Grant CSRF Access to Flutterwave Webhook
|
||||
|
||||
Go to `app/Http/Middleware/VerifyCsrfToken.php` and add your webhook url to the `$except` array
|
||||
|
||||
```php
|
||||
protected $except = [
|
||||
'/webhook/flutterwave',
|
||||
];
|
||||
```
|
||||
|
||||
### 4. Setup your Controller
|
||||
|
||||
> Setup your controller to handle the routes. I created the `FlutterwaveController`. Use the `Flutterwave`
|
||||
> facade.
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use KingFlamez\Rave\Facades\Rave as Flutterwave;
|
||||
|
||||
class FlutterwaveController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Receives Flutterwave webhook
|
||||
* @return void
|
||||
*/
|
||||
public function webhook(Request $request)
|
||||
{
|
||||
//This verifies the webhook is sent from Flutterwave
|
||||
$verified = Flutterwave::verifyWebhook();
|
||||
|
||||
// if it is a charge event, verify and confirm it is a successful transaction
|
||||
if ($verified && $request->event == 'charge.completed' && $request->data->status == 'successful') {
|
||||
$verificationData = Flutterwave::verifyPayment($request->data['id']);
|
||||
if ($verificationData['status'] === 'success') {
|
||||
// process for successful charge
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if it is a transfer event, verify and confirm it is a successful transfer
|
||||
if ($verified && $request->event == 'transfer.completed') {
|
||||
|
||||
$transfer = Flutterwave::transfers()->fetch($request->data['id']);
|
||||
|
||||
if($transfer['data']['status'] === 'SUCCESSFUL') {
|
||||
// update transfer status to successful in your db
|
||||
} else if ($transfer['data']['status'] === 'FAILED') {
|
||||
// update transfer status to failed in your db
|
||||
// revert customer balance back
|
||||
} else if ($transfer['data']['status'] === 'PENDING') {
|
||||
// update transfer status to pending in your db
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Webhook Samples
|
||||
|
||||
### Successful Payment
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "charge.completed",
|
||||
"data": {
|
||||
"id": 285959875,
|
||||
"tx_ref": "Links-616626414629",
|
||||
"flw_ref": "PeterEkene/FLW270177170",
|
||||
"device_fingerprint": "a42937f4a73ce8bb8b8df14e63a2df31",
|
||||
"amount": 100,
|
||||
"currency": "NGN",
|
||||
"charged_amount": 100,
|
||||
"app_fee": 1.4,
|
||||
"merchant_fee": 0,
|
||||
"processor_response": "Approved by Financial Institution",
|
||||
"auth_model": "PIN",
|
||||
"ip": "197.210.64.96",
|
||||
"narration": "CARD Transaction ",
|
||||
"status": "successful",
|
||||
"payment_type": "card",
|
||||
"created_at": "2020-07-06T19:17:04.000Z",
|
||||
"account_id": 17321,
|
||||
"customer": {
|
||||
"id": 215604089,
|
||||
"name": "Yemi Desola",
|
||||
"phone_number": null,
|
||||
"email": "user@gmail.com",
|
||||
"created_at": "2020-07-06T19:17:04.000Z"
|
||||
},
|
||||
"card": {
|
||||
"first_6digits": "123456",
|
||||
"last_4digits": "7889",
|
||||
"issuer": "VERVE FIRST CITY MONUMENT BANK PLC",
|
||||
"country": "NG",
|
||||
"type": "VERVE",
|
||||
"expiry": "02/23"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Successful Transfers
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "transfer.completed",
|
||||
"event.type": "Transfer",
|
||||
"data": {
|
||||
"id": 33286,
|
||||
"account_number": "0690000033",
|
||||
"bank_name": "ACCESS BANK NIGERIA",
|
||||
"bank_code": "044",
|
||||
"fullname": "Bale Gary",
|
||||
"created_at": "2020-04-14T16:39:17.000Z",
|
||||
"currency": "NGN",
|
||||
"debit_currency": "NGN",
|
||||
"amount": 30020,
|
||||
"fee": 26.875,
|
||||
"status": "SUCCESSFUL",
|
||||
"reference": "a0a827b1eca65311_PMCKDU_5",
|
||||
"meta": null,
|
||||
"narration": "lolololo",
|
||||
"approver": null,
|
||||
"complete_message": "Successful",
|
||||
"requires_approval": 0,
|
||||
"is_approved": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Best practices
|
||||
|
||||
If your webhook script performs complex logic, or makes network calls, it's possible that the script would time out before Flutterwave sees its complete execution. For that reason, you might want to have your webhook endpoint immediately acknowledge receipt by returning a 2xx HTTP status code, and then perform the rest of its duties.
|
||||
|
||||
Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing [idempotent](https://en.wikipedia.org/wiki/Idempotence). One way I do this is making the reference unique, so once it has hit the server more than once, it won't record for subsequent events
|
||||
21
vendor/kingflamez/laravelrave/package.json
vendored
Normal file
21
vendor/kingflamez/laravelrave/package.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "laravel-flutterwave-docs",
|
||||
"version": "0.0.1",
|
||||
"description": "A Laravel package that makes it easy to use Flutterwave APIs",
|
||||
"main": "index.js",
|
||||
"authors": {
|
||||
"name": "Oluwole Adebiyi (Kingflamez)",
|
||||
"email": "flamekeed@gmail.com"
|
||||
},
|
||||
"repository": "https://github.com/kingflamez/laravelrave/docs",
|
||||
"scripts": {
|
||||
"dev": "vuepress dev docs",
|
||||
"build": "vuepress build docs"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"vuepress": "^1.5.3",
|
||||
"is-svg": "^4.2.2",
|
||||
"ssri": "^8.0.1"
|
||||
}
|
||||
}
|
||||
25
vendor/kingflamez/laravelrave/phpunit.xml
vendored
Normal file
25
vendor/kingflamez/laravelrave/phpunit.xml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="true">
|
||||
<testsuites>
|
||||
<testsuite name="Feature Tests">
|
||||
<directory suffix="Tests.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Unit Tests">
|
||||
<directory suffix="Tests.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
31
vendor/kingflamez/laravelrave/resources/config/flutterwave.php
vendored
Normal file
31
vendor/kingflamez/laravelrave/resources/config/flutterwave.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Laravel Rave package.
|
||||
*
|
||||
* (c) Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/**
|
||||
* Public Key: Your Rave publicKey. Sign up on https://dashboard.flutterwave.com/ to get one from your settings page
|
||||
*
|
||||
*/
|
||||
'publicKey' => env('FLW_PUBLIC_KEY'),
|
||||
|
||||
/**
|
||||
* Secret Key: Your Rave secretKey. Sign up on https://dashboard.flutterwave.com/ to get one from your settings page
|
||||
*
|
||||
*/
|
||||
'secretKey' => env('FLW_SECRET_KEY'),
|
||||
|
||||
/**
|
||||
* Prefix: Secret hash for webhook
|
||||
*
|
||||
*/
|
||||
'secretHash' => env('FLW_SECRET_HASH', ''),
|
||||
];
|
||||
BIN
vendor/kingflamez/laravelrave/resources/img/RaveInterface.jpg
vendored
Normal file
BIN
vendor/kingflamez/laravelrave/resources/img/RaveInterface.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
BIN
vendor/kingflamez/laravelrave/resources/img/pay.jpg
vendored
Normal file
BIN
vendor/kingflamez/laravelrave/resources/img/pay.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
vendor/kingflamez/laravelrave/resources/img/rave.jpg
vendored
Normal file
BIN
vendor/kingflamez/laravelrave/resources/img/rave.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
vendor/kingflamez/laravelrave/resources/img/rave_logo.png
vendored
Normal file
BIN
vendor/kingflamez/laravelrave/resources/img/rave_logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
26
vendor/kingflamez/laravelrave/src/Facades/Rave.php
vendored
Normal file
26
vendor/kingflamez/laravelrave/src/Facades/Rave.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Laravel Rave package.
|
||||
*
|
||||
* (c) Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KingFlamez\Rave\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Rave extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'laravelrave';
|
||||
}
|
||||
}
|
||||
171
vendor/kingflamez/laravelrave/src/Helpers/Banks.php
vendored
Normal file
171
vendor/kingflamez/laravelrave/src/Helpers/Banks.php
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
* @version 3
|
||||
**/
|
||||
class Banks
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct(String $publicKey, String $secretKey, String $baseUrl)
|
||||
{
|
||||
|
||||
$this->publicKey = $publicKey;
|
||||
$this->secretKey = $secretKey;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Nigerian Banks
|
||||
* @return object
|
||||
*/
|
||||
public function nigeria()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/NG'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Ghanaian Banks
|
||||
* @return object
|
||||
*/
|
||||
public function ghana()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/GH'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Kenyan Banks
|
||||
* @return object
|
||||
*/
|
||||
public function kenya()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/KE'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Ugandan Banks
|
||||
* @return object
|
||||
*/
|
||||
public function uganda()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/UG'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get South African Banks
|
||||
* @return object
|
||||
*/
|
||||
public function southAfrica()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/ZA'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Tanzanian Banks
|
||||
* @return object
|
||||
*/
|
||||
public function tanzania()
|
||||
{
|
||||
$banks = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/TZ'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
usort($banks['data'], function ($a, $b) {
|
||||
return strcmp($a['name'], $b['name']);
|
||||
});
|
||||
|
||||
return $banks;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Tanzanian Banks
|
||||
* @param bankId
|
||||
* @return object
|
||||
*/
|
||||
public function branches($bankId)
|
||||
{
|
||||
$branches = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/banks/'.$bankId.'/branches'
|
||||
)->json();
|
||||
|
||||
|
||||
// sort banks by name
|
||||
// usort($banks['data'], function ($a, $b) {
|
||||
// return strcmp($a['name'], $b['name']);
|
||||
// });
|
||||
|
||||
return $branches;
|
||||
}
|
||||
}
|
||||
98
vendor/kingflamez/laravelrave/src/Helpers/Beneficiary.php
vendored
Normal file
98
vendor/kingflamez/laravelrave/src/Helpers/Beneficiary.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
* @version 3
|
||||
**/
|
||||
class Beneficiary
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct(String $publicKey, String $secretKey, String $baseUrl)
|
||||
{
|
||||
|
||||
$this->publicKey = $publicKey;
|
||||
$this->secretKey = $secretKey;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a beneficiary
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
$beneficiary = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/beneficiaries',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $beneficiary;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get All Beneficiaries
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function fetchAll(array $data = [])
|
||||
{
|
||||
$beneficiaries = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/beneficiaries',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $beneficiaries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get A Beneficiary
|
||||
* @param $id
|
||||
* @return object
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
$beneficiary = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/beneficiaries/' . $id
|
||||
)->json();
|
||||
|
||||
return $beneficiary;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Delete A Beneficiary
|
||||
* @param $id
|
||||
* @return object
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$beneficiary = Http::withToken($this->secretKey)->delete(
|
||||
$this->baseUrl . '/beneficiaries/' . $id
|
||||
)->json();
|
||||
|
||||
return $beneficiary;
|
||||
}
|
||||
}
|
||||
110
vendor/kingflamez/laravelrave/src/Helpers/Bills.php
vendored
Normal file
110
vendor/kingflamez/laravelrave/src/Helpers/Bills.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Emmanuel A Towoju - Towoju5 <info@towoju.com.ng>
|
||||
* @version 3
|
||||
**/
|
||||
class Bills
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct(String $publicKey, String $secretKey, String $baseUrl)
|
||||
{
|
||||
$this->publicKey = $publicKey;
|
||||
$this->secretKey = $secretKey;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate a Bill payment
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function initiate(array $data)
|
||||
{
|
||||
return $data;
|
||||
$bill = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/bills',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $bill;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate a bulk transfer
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function get_categories(array $data=[])
|
||||
{
|
||||
$bills_categories = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/bill-categories',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $bills_categories;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate bill payment
|
||||
* @param $item_code, array $data
|
||||
* @return object
|
||||
*/
|
||||
public function validate(string $item_code, array $data)
|
||||
{
|
||||
$validate = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . "/bill-items/$item_code/validate",
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $validate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get All bills payment history
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function fetchAll(array $data = [])
|
||||
{
|
||||
$bills = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/bills',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $bills;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get A Bill payment status
|
||||
* @param $reference
|
||||
* @return object
|
||||
*/
|
||||
public function fetch_status($reference)
|
||||
{
|
||||
$status = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/bills/'.$reference
|
||||
)->json();
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
221
vendor/kingflamez/laravelrave/src/Helpers/Payments.php
vendored
Normal file
221
vendor/kingflamez/laravelrave/src/Helpers/Payments.php
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
* @version 3
|
||||
**/
|
||||
class Payments
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct(String $publicKey, String $secretKey, String $baseUrl)
|
||||
{
|
||||
|
||||
$this->publicKey = $publicKey;
|
||||
$this->secretKey = $secretKey;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via ACH Payment
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function ACH(array $data)
|
||||
{
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=ach_payment',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Charge via NGN Bank Transfer
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function nigeriaBankTransfer(array $data)
|
||||
{
|
||||
$data['is_permanent'] = false;
|
||||
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/virtual-account-numbers',
|
||||
$data
|
||||
)->json();
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mobile Money Ghana
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function momoGH(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'GHS';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mobile_money_ghana',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
if ($payment['status'] === 'success') {
|
||||
return [
|
||||
'status' => $payment['status'],
|
||||
'message' => $payment['message'],
|
||||
'data' => $payment['meta']['authorization'],
|
||||
];
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mobile Money Rwanda
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function momoRW(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'RWF';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mobile_money_rwanda',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
if ($payment['status'] === 'success') {
|
||||
return [
|
||||
'status' => $payment['status'],
|
||||
'message' => $payment['message'],
|
||||
'data' => $payment['meta']['authorization'],
|
||||
];
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mobile Money Uganda
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function momoUG(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'UGX';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mobile_money_uganda',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
if ($payment['status'] === 'success') {
|
||||
return [
|
||||
'status' => $payment['status'],
|
||||
'message' => $payment['message'],
|
||||
'data' => $payment['meta']['authorization'],
|
||||
];
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mobile Money Zambia
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function momoZambia(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'ZMW';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mobile_money_zambia',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
if ($payment['status'] === 'success') {
|
||||
return [
|
||||
'status' => $payment['status'],
|
||||
'message' => $payment['message'],
|
||||
'data' => $payment['meta']['authorization'],
|
||||
];
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mpesa
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function mpesa(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'KES';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mpesa',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mpesa
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function voucher(array $data)
|
||||
{
|
||||
// add currency
|
||||
$data['currency'] = 'ZAR';
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=voucher_payment',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge via Mpesa
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function momoFranc(array $data)
|
||||
{
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/charges?type=mobile_money_franco',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $payment;
|
||||
}
|
||||
}
|
||||
159
vendor/kingflamez/laravelrave/src/Helpers/Transfers.php
vendored
Normal file
159
vendor/kingflamez/laravelrave/src/Helpers/Transfers.php
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave\Helpers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
* @version 3
|
||||
**/
|
||||
class Transfers
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct(String $publicKey, String $secretKey, String $baseUrl)
|
||||
{
|
||||
|
||||
$this->publicKey = $publicKey;
|
||||
$this->secretKey = $secretKey;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate a transfer
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function initiate(array $data)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/transfers',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate a bulk transfer
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function bulk(array $data)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/bulk-transfers',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retry a transfer
|
||||
* @param $transferId
|
||||
* @return object
|
||||
*/
|
||||
public function retry($transferId)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/transfers/' . $transferId . '/retries'
|
||||
)->json();
|
||||
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Fees
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function fees(array $data)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/transfers/fee',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
$transfer['data'] = $transfer['data'][0];
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get All Transfers
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function fetchAll(array $data = [])
|
||||
{
|
||||
$transfers = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/transfers',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $transfers;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get A Transfer
|
||||
* @param $id
|
||||
* @return object
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/transfers/' . $id
|
||||
)->json();
|
||||
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get A Transfer Retry
|
||||
* @param $id
|
||||
* @return object
|
||||
*/
|
||||
public function fetchRetries($id)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/transfers/' . $id .'/retries'
|
||||
)->json();
|
||||
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get Transfer Rates
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function getTransferRate(array $data)
|
||||
{
|
||||
$transfer = Http::withToken($this->secretKey)->get(
|
||||
$this->baseUrl . '/transfers/rates',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
$transfer['data'] = $transfer['data'][0];
|
||||
return $transfer;
|
||||
}
|
||||
|
||||
}
|
||||
164
vendor/kingflamez/laravelrave/src/Rave.php
vendored
Normal file
164
vendor/kingflamez/laravelrave/src/Rave.php
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use KingFlamez\Rave\Helpers\Banks;
|
||||
use KingFlamez\Rave\Helpers\Beneficiary;
|
||||
use KingFlamez\Rave\Helpers\Bills;
|
||||
use KingFlamez\Rave\Helpers\Payments;
|
||||
use KingFlamez\Rave\Helpers\Transfers;
|
||||
|
||||
/**
|
||||
* Flutterwave's Rave payment laravel package
|
||||
* @author Oluwole Adebiyi - Flamez <flamekeed@gmail.com>
|
||||
* @version 3
|
||||
**/
|
||||
class Rave
|
||||
{
|
||||
|
||||
protected $publicKey;
|
||||
protected $secretKey;
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
|
||||
$this->publicKey = config('flutterwave.publicKey');
|
||||
$this->secretKey = config('flutterwave.secretKey');
|
||||
$this->secretHash = config('flutterwave.secretHash');
|
||||
$this->baseUrl = 'https://api.flutterwave.com/v3';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates a unique reference
|
||||
* @param $transactionPrefix
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function generateReference(String $transactionPrefix = NULL)
|
||||
{
|
||||
if ($transactionPrefix) {
|
||||
return $transactionPrefix . '_' . uniqid(time());
|
||||
}
|
||||
return 'flw_' . uniqid(time());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reaches out to Flutterwave to initialize a payment
|
||||
* @param $data
|
||||
* @return object
|
||||
*/
|
||||
public function initializePayment(array $data)
|
||||
{
|
||||
|
||||
$payment = Http::withToken($this->secretKey)->post(
|
||||
$this->baseUrl . '/payments',
|
||||
$data
|
||||
)->json();
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a transaction ID depending on the redirect structure
|
||||
* @return string
|
||||
*/
|
||||
public function getTransactionIDFromCallback()
|
||||
{
|
||||
$transactionID = request()->transaction_id;
|
||||
|
||||
if (!$transactionID) {
|
||||
$transactionID = json_decode(request()->resp)->data->id;
|
||||
}
|
||||
|
||||
return $transactionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reaches out to Flutterwave to verify a transaction
|
||||
* @param $id
|
||||
* @return object
|
||||
*/
|
||||
public function verifyTransaction($id)
|
||||
{
|
||||
$data = Http::withToken($this->secretKey)->get($this->baseUrl . "/transactions/" . $id . '/verify')->json();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms webhook `verifi-hash` is the same as the environment variable
|
||||
* @param $data
|
||||
* @return boolean
|
||||
*/
|
||||
public function verifyWebhook()
|
||||
{
|
||||
// Process Paystack Webhook. https://developer.flutterwave.com/reference#webhook
|
||||
if (request()->header('verif-hash')) {
|
||||
// get input and verify paystack signature
|
||||
$flutterwaveSignature = request()->header('verif-hash');
|
||||
|
||||
// confirm the signature is right
|
||||
if ($flutterwaveSignature == $this->secretHash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payments
|
||||
* @return Payments
|
||||
*/
|
||||
public function payments()
|
||||
{
|
||||
$payments = new Payments($this->publicKey, $this->secretKey, $this->baseUrl);
|
||||
return $payments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Banks
|
||||
* @return Banks
|
||||
*/
|
||||
public function banks()
|
||||
{
|
||||
$banks = new Banks($this->publicKey, $this->secretKey, $this->baseUrl);
|
||||
return $banks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers
|
||||
* @return Transfers
|
||||
*/
|
||||
public function transfers()
|
||||
{
|
||||
$transfers = new Transfers($this->publicKey, $this->secretKey, $this->baseUrl);
|
||||
return $transfers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Beneficiary
|
||||
* @return Beneficiary
|
||||
*/
|
||||
public function beneficiaries()
|
||||
{
|
||||
$beneficiary = new Beneficiary($this->publicKey, $this->secretKey, $this->baseUrl);
|
||||
return $beneficiary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bill payments
|
||||
* @return Bills
|
||||
*/
|
||||
public function bill()
|
||||
{
|
||||
$bills = new Bills($this->publicKey, $this->secretKey, $this->baseUrl);
|
||||
return $bills;
|
||||
}
|
||||
}
|
||||
49
vendor/kingflamez/laravelrave/src/RaveServiceProvider.php
vendored
Normal file
49
vendor/kingflamez/laravelrave/src/RaveServiceProvider.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace KingFlamez\Rave;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class RaveServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Perform post-registration booting of services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$config = realpath(__DIR__.'/../resources/config/flutterwave.php');
|
||||
|
||||
$this->publishes([
|
||||
$config => config_path('flutterwave.php')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any package services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
|
||||
$this->app->singleton('laravelrave', function ($app) {
|
||||
return new Rave($app->make("request"));
|
||||
});
|
||||
|
||||
$this->app->alias('laravelrave', "KingFlamez\Rave\Rave");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['laravelrave'];
|
||||
}
|
||||
}
|
||||
46
vendor/kingflamez/laravelrave/tests/Concerns/ExtractProperties.php
vendored
Normal file
46
vendor/kingflamez/laravelrave/tests/Concerns/ExtractProperties.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Concerns;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
|
||||
trait ExtractProperties {
|
||||
|
||||
/**
|
||||
* Extract "a" property from a class.
|
||||
*
|
||||
* @param \stdClass $class
|
||||
* @param string $name Property name.
|
||||
* @return array Extracted name and value of property.
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function extractProperty($class, $name) {
|
||||
|
||||
$reflector = new ReflectionClass($class);
|
||||
$property = $reflector->getProperty($name);
|
||||
$property->setAccessible(true);
|
||||
|
||||
return [
|
||||
"name" => $property->getName(),
|
||||
"value" => $property->getValue($class),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set property of class.
|
||||
*
|
||||
* @param \stdClass $class
|
||||
* @param string $name Property name
|
||||
* @param mixed $value
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function setProperty($class, $name, $value = null) {
|
||||
|
||||
$reflector = new ReflectionClass($class);
|
||||
$property = $reflector->getProperty($name);
|
||||
$property->setAccessible(true);
|
||||
|
||||
$property->setValue($class, $value);
|
||||
}
|
||||
}
|
||||
225
vendor/kingflamez/laravelrave/tests/Feature/FeatureTests.php
vendored
Normal file
225
vendor/kingflamez/laravelrave/tests/Feature/FeatureTests.php
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Tests\Stubs\Request;
|
||||
use KingFlamez\Rave\Rave;
|
||||
use Tests\Stubs\PaymentEventHandler;
|
||||
use Tests\Concerns\ExtractProperties;
|
||||
|
||||
class FeatureTests extends TestCase {
|
||||
|
||||
use ExtractProperties;
|
||||
|
||||
/**
|
||||
* Test if parameters are set on setData.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
function getParams () {
|
||||
|
||||
$request = new Request();
|
||||
$request->subaccounts = [];
|
||||
$request->meta = [];
|
||||
$request->ref = false;
|
||||
$request->logo = false;
|
||||
$request->title = false;
|
||||
$request->paymentplan = false;
|
||||
$request->phonenumber = '080232382382';
|
||||
$request->payment_method = 'online';
|
||||
$request->pay_button_text = 'Pay Now';
|
||||
$rave = new Rave();
|
||||
$rave->initialize("http://localhost");
|
||||
|
||||
$this->assertTrue($rave instanceof Rave);
|
||||
|
||||
return $rave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if hash is created.
|
||||
*
|
||||
* @test
|
||||
* @depends getParams
|
||||
* @param Rave $rave
|
||||
* @return void
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function creatingCheckSum(Rave $rave) {
|
||||
|
||||
#$rave = $rave->createReferenceNumber();
|
||||
$publicKey = "FLWPUBK-MOCK-1cf610974690c2560cb4c36f4921244a-X";
|
||||
$rave->initialize("http://localhost");
|
||||
$rave = $rave->createCheckSum('http://localhost');
|
||||
|
||||
$hash = $this->extractProperty($rave, "integrityHash");
|
||||
|
||||
$this->assertEquals(64, strlen($hash["value"]));
|
||||
|
||||
return $rave;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing payment.
|
||||
*
|
||||
* @test
|
||||
* @depends creatingCheckSum
|
||||
* @param Rave $rave
|
||||
* @return void
|
||||
*/
|
||||
function paymentInitialize(Rave $rave) {
|
||||
|
||||
$response = $rave->eventHandler(new PaymentEventHandler)->initialize("http://localhost");
|
||||
|
||||
$values = json_decode($response, true);
|
||||
|
||||
$class = $this->data["class"];
|
||||
|
||||
$this->assertArrayHasKey("meta", $values);
|
||||
$this->assertArrayHasKey("txref", $values);
|
||||
$this->assertArrayHasKey("amount", $values);
|
||||
$this->assertArrayHasKey("country", $values);
|
||||
$this->assertArrayHasKey("currency", $values);
|
||||
$this->assertArrayHasKey("PBFPubKey", $values);
|
||||
$this->assertArrayHasKey("custom_logo", $values);
|
||||
$this->assertArrayHasKey("redirect_url", $values);
|
||||
$this->assertArrayHasKey("data-integrity_hash", $values);
|
||||
$this->assertArrayHasKey("payment_method", $values);
|
||||
$this->assertArrayHasKey("customer_phone", $values);
|
||||
$this->assertArrayHasKey("customer_email", $values);
|
||||
$this->assertArrayHasKey("pay_button_text", $values);
|
||||
$this->assertArrayHasKey("customer_lastname", $values);
|
||||
$this->assertArrayHasKey("custom_description", $values);
|
||||
$this->assertArrayHasKey("customer_firstname", $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if proper actions are taken when payment is cancelled.
|
||||
*
|
||||
* @test
|
||||
* @return void
|
||||
*/
|
||||
function paymentCancelledTest() {
|
||||
$request = new Request();
|
||||
$request->cancelled = true;
|
||||
$rave = new Rave();
|
||||
$rave = $rave->createReferenceNumber();
|
||||
$ref = $rave->getReferenceNumber();
|
||||
|
||||
// This section tests if json is returned when no handler is set.
|
||||
|
||||
$returned = $rave->paymentCanceled($ref);
|
||||
|
||||
$this->assertTrue( is_object($returned));
|
||||
|
||||
// Tests if json has certain keys when payment is cancelled.
|
||||
|
||||
$returned = json_decode(json_encode($returned), true);
|
||||
|
||||
$this->assertArrayHasKey("data", $returned);
|
||||
$this->assertArrayHasKey("txRef", $returned['data']);
|
||||
$this->assertArrayHasKey("status", $returned['data']);
|
||||
|
||||
// This section tests if instance of rave is returned when a handler is set.
|
||||
$rave->eventHandler(new PaymentEventHandler)->paymentCanceled($ref);
|
||||
|
||||
$this->assertEquals(Rave::class, get_class($rave));
|
||||
|
||||
return $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing requery transactions.
|
||||
*
|
||||
* @test
|
||||
* @depends paymentCancelledTest
|
||||
* @dataProvider providesResponse
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @param string $ref txref
|
||||
*/
|
||||
// function requeryTransactionTransactionTest($mResponse, $ref) {
|
||||
//
|
||||
// $data = [
|
||||
// 'txref' => $ref,
|
||||
// 'SECKEY' => $this->app->config->get("secretKey"),
|
||||
// 'last_attempt' => '1'
|
||||
// // 'only_successful' => '1'
|
||||
// ];
|
||||
//
|
||||
// $url = "https://rave-api-v2.herokuapp.com";
|
||||
// $headers = ['Content-Type' => 'application/json'];
|
||||
//
|
||||
// $data = Body::json($data);
|
||||
// $response = json_encode($mResponse);
|
||||
//
|
||||
// $decodedResponse = json_decode($response);
|
||||
//
|
||||
// $mRequest = $this->m->mock("alias:Unirest\Request");
|
||||
// $mRequest->shouldReceive("post")
|
||||
// ->andReturn($decodedResponse);
|
||||
//
|
||||
// $rave = new Rave(new Request(['cancelled' => true]), $mRequest, new Body);
|
||||
//
|
||||
// $raveResponse = $rave->verifyTransaction($ref);
|
||||
//
|
||||
// // Test if data is returned when no handler.
|
||||
// // $this->assertEquals($decodedResponse->body->status, $raveResponse->status);
|
||||
//
|
||||
// $this->setProperty($rave, "handler", new PaymentEventHandler);
|
||||
//
|
||||
// $raveResponse = $rave->verifyTransaction($ref);
|
||||
//
|
||||
// // Tests that an instance of rave is returned when a handler is set
|
||||
// $this->assertTrue(Rave::class, get_class($raveResponse));
|
||||
// }
|
||||
|
||||
/**
|
||||
* Provides data for all events of requery transaction.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function providesResponse () {
|
||||
|
||||
return [
|
||||
[
|
||||
[
|
||||
"body" => [
|
||||
"status" => "unknown",
|
||||
"data" => ["status", "unknown"]
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
"body" => [
|
||||
"status" => "success",
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"body" => [
|
||||
"status" => "success",
|
||||
"data" => [
|
||||
"status" => "failed"
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
"body" => [
|
||||
"status" => "success",
|
||||
"data" => [
|
||||
"status" => "successful"
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
77
vendor/kingflamez/laravelrave/tests/Stubs/PaymentEventHandler.php
vendored
Normal file
77
vendor/kingflamez/laravelrave/tests/Stubs/PaymentEventHandler.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Stubs;
|
||||
|
||||
use KingFlamez\Rave\RaveEventHandlerInterface;
|
||||
|
||||
class PaymentEventHandler implements RaveEventHandlerInterface {
|
||||
/**
|
||||
* This is called when the Rave class is initialized
|
||||
* */
|
||||
function onInit($initializationData){
|
||||
// Save the transaction to your DB.
|
||||
return 'Payment started......'.json_encode($initializationData).'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called only when a transaction is successful
|
||||
* */
|
||||
function onSuccessful($transactionData){
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
|
||||
// Comfirm that the transaction is successful
|
||||
// Confirm that the chargecode is 00 or 0
|
||||
// Confirm that the currency on your db transaction is equal to the returned currency
|
||||
// Confirm that the db transaction amount is equal to the returned amount
|
||||
// Update the db transaction record (includeing parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// Give value for the transaction
|
||||
// Update the transaction to note that you have given value for the transaction
|
||||
// You can also redirect to your success page from here
|
||||
return 'Payment Successful!'.json_encode($transactionData).'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called only when a transaction failed
|
||||
* */
|
||||
function onFailure($transactionData){
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Update the db transaction record (includeing parameters that didn't exist before the transaction is completed. for audit purpose)
|
||||
// You can also redirect to your failure page from here
|
||||
return 'Payment Failed!'.json_encode($transactionData).'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when a transaction is requeryed from the payment gateway
|
||||
* */
|
||||
function onRequery($transactionReference){
|
||||
// Do something, anything!
|
||||
return 'Payment requeried......'.$transactionReference.'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called a transaction requery returns with an error
|
||||
* */
|
||||
function onRequeryError($requeryResponse){
|
||||
// Do something, anything!
|
||||
return 'An error occured while requeying the transaction...'.json_encode($requeryResponse).'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when a transaction is canceled by the user
|
||||
* */
|
||||
function onCancel($transactionReference){
|
||||
// Do something, anything!
|
||||
// Note: Somethings a payment can be successful, before a user clicks the cancel button so proceed with caution
|
||||
return 'Payment canceled by user......'.$transactionReference.'<br />'; //Remember to delete this line
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when a transaction doesn't return with a success or a failure response. This can be a timedout transaction on the Rave server or an abandoned transaction by the customer.
|
||||
* */
|
||||
function onTimeout($transactionReference, $data){
|
||||
// Get the transaction from your DB using the transaction reference (txref)
|
||||
// Queue it for requery. Preferably using a queue system. The requery should be about 15 minutes after.
|
||||
// Ask the customer to contact your support and you should escalate this issue to the flutterwave support team. Send this as an email and as a notification on the page. just incase the page timesout or disconnects
|
||||
return 'Payment timeout......'.$transactionReference.' - '.json_encode($data).'<br />'; //Remember to delete this line
|
||||
}
|
||||
}
|
||||
29
vendor/kingflamez/laravelrave/tests/Stubs/Request.php
vendored
Normal file
29
vendor/kingflamez/laravelrave/tests/Stubs/Request.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Stubs;
|
||||
|
||||
use Illuminate\Http\Request as BaseRequest;
|
||||
|
||||
class Request extends BaseRequest {
|
||||
|
||||
public $email;
|
||||
public $amount;
|
||||
public $country;
|
||||
public $currency;
|
||||
public $lastname;
|
||||
public $firstname;
|
||||
public $phonenumber;
|
||||
public $description;
|
||||
public $payment_method;
|
||||
public $pay_button_text;
|
||||
|
||||
function __construct( ) {
|
||||
|
||||
$data = (array) include __DIR__ . "/request_data.php";
|
||||
|
||||
array_walk($data["form"], function($value, $key) {
|
||||
|
||||
$this->{$key} = $value;
|
||||
});
|
||||
}
|
||||
}
|
||||
15
vendor/kingflamez/laravelrave/tests/Stubs/env.php
vendored
Normal file
15
vendor/kingflamez/laravelrave/tests/Stubs/env.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stub required environment variables.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
return [
|
||||
"prefix" => "rave",
|
||||
"secretKey" => "FLWSECK-4127f15e63c9098402dcc7891798fb0f-X",
|
||||
"publicKey" => "FLWPUBK-1cf610974690c2560cb4c36f4921244a-X",
|
||||
"title" => "Rave Payment Gateway",
|
||||
"env" => "testing",
|
||||
"logo" => "https://files.readme.io/ee907a0-small-rave_by_flutterwave.png"
|
||||
];
|
||||
46
vendor/kingflamez/laravelrave/tests/Stubs/request_data.php
vendored
Normal file
46
vendor/kingflamez/laravelrave/tests/Stubs/request_data.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Sample request data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
return [
|
||||
/**
|
||||
* Request mocking data
|
||||
*/
|
||||
"form" => [
|
||||
"amount" => 30000,
|
||||
"title" => "A Title",
|
||||
"lastname" => "Last",
|
||||
"currency" => "naira",
|
||||
"country" => "Nigeria",
|
||||
"firstname" => "First",
|
||||
"payment_method" => "card",
|
||||
"phonenumber" => "08012345678",
|
||||
"email" => "email@example.org",
|
||||
"pay_button_text" => "Pay Now",
|
||||
"metadata" => "[{ flightid:3849 }]",
|
||||
"description" => "Some random description.",
|
||||
"logo" => "https://files.readme.io/ee907a0-small-rave_by_flutterwave.png",
|
||||
],
|
||||
|
||||
/**
|
||||
* Rave original properties representation.
|
||||
*/
|
||||
"class" => [
|
||||
"amount",
|
||||
"country",
|
||||
"currency",
|
||||
"lastname",
|
||||
"firstname",
|
||||
["logo" => "customLogo"],
|
||||
"phonenumber",
|
||||
["title" => "customTitle"],
|
||||
"payButtonText",
|
||||
["email" => "customerEmail"],
|
||||
"payment_method",
|
||||
["description" => "customeDescription"],
|
||||
"metadata",
|
||||
]
|
||||
];
|
||||
81
vendor/kingflamez/laravelrave/tests/TestCase.php
vendored
Normal file
81
vendor/kingflamez/laravelrave/tests/TestCase.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Mockery;
|
||||
use Orchestra\Testbench\TestCase as BaseTestCase;
|
||||
use phpDocumentor\Reflection\Types\Void_;
|
||||
|
||||
abstract class TestCase extends BaseTestCase {
|
||||
|
||||
public $m;
|
||||
|
||||
protected $envVars;
|
||||
|
||||
protected $data;
|
||||
|
||||
protected $formData;
|
||||
|
||||
function setUp () : void {
|
||||
|
||||
$this->m = new Mockery;
|
||||
|
||||
$this->envVars = (array) include __DIR__ . "/Stubs/env.php";
|
||||
|
||||
$this->data = (array) include __DIR__ . "/Stubs/request_data.php";
|
||||
|
||||
$this->formData = $this->data["form"];
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear mockery after every test in preparation for a new mock.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() : void {
|
||||
|
||||
$this->m->close();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register package.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return array Packages to register
|
||||
*/
|
||||
protected function getPackageProviders($app)
|
||||
{
|
||||
return [ "\KingFlamez\Rave\RaveServiceProvider" ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get alias packages from app.
|
||||
*
|
||||
* @param \illuminate\Foundation\Application $app
|
||||
* @return array Aliases.
|
||||
*/
|
||||
protected function getPackageAliases($app)
|
||||
{
|
||||
return [
|
||||
"Rave" => "\KingFlamez\Rave\Facades\Rave"
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure Environment.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
array_walk($this->envVars, function ($value, $key) use (&$app) {
|
||||
|
||||
$app["config"]->set("flutterwave.{$key}", $value);
|
||||
});
|
||||
}
|
||||
}
|
||||
29
vendor/kingflamez/laravelrave/tests/Unit/RaveServiceProviderTests.php
vendored
Normal file
29
vendor/kingflamez/laravelrave/tests/Unit/RaveServiceProviderTests.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use KingFlamez\Rave\Rave;
|
||||
|
||||
class RaveServiceProviderTests extends TestCase
|
||||
{
|
||||
/**
|
||||
* Tests if service provider Binds alias "laravelrave" to \KingFlamez\Rave\Rave
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function isBound()
|
||||
{
|
||||
$this->assertTrue($this->app->bound('laravelrave'));
|
||||
}
|
||||
/**
|
||||
* Test if service provider returns \Rave as alias for \KingFlamez\Rave\Rave
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function hasAliased()
|
||||
{
|
||||
$this->assertTrue($this->app->isAlias("KingFlamez\Rave\Rave"));
|
||||
$this->assertEquals('laravelrave', $this->app->getAlias("KingFlamez\Rave\Rave"));
|
||||
}
|
||||
}
|
||||
114
vendor/kingflamez/laravelrave/tests/Unit/UnitTests.php
vendored
Normal file
114
vendor/kingflamez/laravelrave/tests/Unit/UnitTests.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Tests\TestCase;
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
use KingFlamez\Rave\Rave;
|
||||
use Tests\Stubs\PaymentEventHandler;
|
||||
use Tests\Concerns\ExtractProperties;
|
||||
|
||||
class UnitTests extends TestCase
|
||||
{
|
||||
|
||||
use ExtractProperties;
|
||||
|
||||
/**
|
||||
* Tests if app returns \KingFlamez\Rave\Rave if called with ailas.
|
||||
*
|
||||
* @test
|
||||
* @return \KingFlamez\Rave\Rave
|
||||
*/
|
||||
function initiateRaveFromApp()
|
||||
{
|
||||
|
||||
$rave = $this->app->make("laravelrave");
|
||||
|
||||
$this->assertTrue($rave instanceof Rave);
|
||||
|
||||
return $rave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Rave initiallizes with default values;.
|
||||
*
|
||||
* @test
|
||||
*
|
||||
* @depends initiateRaveFromApp
|
||||
* @param \KingFlamez\Rave\Rave $rave
|
||||
* @return void
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function initializeWithDefaultValues(Rave $rave)
|
||||
{
|
||||
|
||||
$reflector = new ReflectionClass($rave);
|
||||
|
||||
$methods = $reflector->getProperties(ReflectionProperty::IS_PROTECTED);
|
||||
|
||||
foreach ($methods as $method) {
|
||||
if ($method->getName() == 'baseUrl') $baseUrl = $method;
|
||||
if ($method->getName() == 'secretKey') $secretKey = $method;
|
||||
if ($method->getName() == 'publicKey') $publicKey = $method;
|
||||
};
|
||||
|
||||
$baseUrl->setAccessible(true);
|
||||
$publicKey->setAccessible(true);
|
||||
$secretKey->setAccessible(true);
|
||||
|
||||
$this->assertEquals($this->app->config->get("flutterwave.secretKey"), $secretKey->getValue($rave));
|
||||
$this->assertEquals($this->app->config->get("flutterwave.publicKey"), $publicKey->getValue($rave));
|
||||
$this->assertEquals(
|
||||
"https://api.flutterwave.com/v3",
|
||||
$baseUrl->getValue($rave)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if transaction reference is generated.
|
||||
*
|
||||
* @test
|
||||
* @depends initiateRaveFromApp
|
||||
* @param Rave $rave
|
||||
* @return void
|
||||
*/
|
||||
function generateReference(Rave $rave)
|
||||
{
|
||||
|
||||
$ref = $rave->generateReference();
|
||||
|
||||
$prefix = 'flw';
|
||||
|
||||
$this->assertRegExp("/^{$prefix}_\w{13}$/", $ref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing if keys are modified using setkeys.
|
||||
*
|
||||
* @test
|
||||
* @depends initiateRaveFromApp
|
||||
* @param Rave $rave
|
||||
* @return void
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
function settingKeys(Rave $rave)
|
||||
{
|
||||
|
||||
$newPublicKey = "public_key";
|
||||
$newSecretKey = "secret_key";
|
||||
$rave->setKeys($newPublicKey, $newSecretKey);
|
||||
$reflector = new ReflectionClass($rave);
|
||||
$reflector = $reflector->getProperties(ReflectionProperty::IS_PROTECTED);
|
||||
|
||||
$keys = array_map(function ($value) use ($rave, $newPublicKey, $newSecretKey) {
|
||||
$name = $value->getName();
|
||||
if ($name === "publicKey" || $name === "secretKey") {
|
||||
$value->setAccessible(true);
|
||||
$key = $value->getValue($rave);
|
||||
$this->assertEquals(${"new" . ucfirst($name)}, $key);
|
||||
}
|
||||
}, $reflector);
|
||||
}
|
||||
}
|
||||
7979
vendor/kingflamez/laravelrave/yarn.lock
vendored
Normal file
7979
vendor/kingflamez/laravelrave/yarn.lock
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user