Skip to content

Commit c6a10b5

Browse files
committed
Merge branch 'release/v0.0.5'
2 parents c289871 + 21cc33e commit c6a10b5

35 files changed

+3801
-22
lines changed

Facades/VaahAjax.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php namespace WebReinvent\VaahExtend\Facades;
2+
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class VaahAjax extends Facade {
7+
protected static function getFacadeAccessor() {
8+
return 'vaahajax';
9+
}
10+
}

Facades/VaahEventBrite.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php namespace WebReinvent\VaahExtend\Facades;
2+
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class VaahEventBrite extends Facade {
7+
protected static function getFacadeAccessor() {
8+
return 'vaaheventbrite';
9+
}
10+
}

Facades/VaahExtract.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php namespace WebReinvent\VaahExtend\Facades;
2+
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class VaahExtract extends Facade {
7+
protected static function getFacadeAccessor() {
8+
return 'vaahextract';
9+
}
10+
}

Facades/VaahImap.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php namespace WebReinvent\VaahExtend\Facades;
2+
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class VaahImap extends Facade {
7+
protected static function getFacadeAccessor() {
8+
return 'vaahimap';
9+
}
10+
}

Facades/VaahStripe.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php namespace WebReinvent\VaahExtend\Facades;
2+
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class VaahStripe extends Facade {
7+
protected static function getFacadeAccessor() {
8+
return 'vaahstripe';
9+
}
10+
}

Libraries/VaahAjax.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# VaahStripe
2+
> Small Laravel Helpers
3+
4+
### Installation
5+
6+
VaahStripe provides an expressive, fluent interface to Stripe's One Time Payment
7+
and subscription billing services.
8+
9+
For extra fraud protection, 3D Secure (3DS) requires customers to complete an
10+
additional verification step with the card issuer when paying.
11+
Typically, you direct the customer to an authentication page on their bank’s
12+
website, and they enter a password associated with the card or a
13+
code sent to their phone. This process is familiar to customers
14+
through the card networks’ brand names, such as Visa Secure and
15+
Mastercard Identity Check.
16+
17+
### Dependencies
18+
- [STRIPE BY CARTALYST](https://github.com/cartalyst/stripe-laravel)
19+
20+
### Installation
21+
22+
```shell script
23+
composer require cartalyst/stripe-laravel
24+
```
25+
26+
Add Facade in `config/app.php`:
27+
```php
28+
'aliases' => [
29+
...
30+
'VaahStripe' => WebReinvent\VaahExtend\Facades\VaahStripe::class,
31+
...
32+
]
33+
```
34+
35+
Add env configuration:
36+
```
37+
38+
...
39+
STRIPE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
40+
...
41+
42+
```
43+
44+
Reference url: https://stripe.com/docs/api
45+
46+
### Methods
47+
48+
- Stripe One Time Payment
49+
50+
```
51+
52+
$customer => [
53+
'name' => 'xxxxxx',
54+
'email' => '[email protected]'
55+
];
56+
57+
$card => [
58+
'number' => 'xxxx-xxxx-xxxx-xxxx',
59+
'exp_month' => '01', // 01-12
60+
'exp_year' => '2021',
61+
'cvc' => 'xxx'
62+
];
63+
64+
$package => [
65+
'currency' => 'usd', // usd / USD
66+
'amount' => '01',
67+
'description' => 'xxxxxx'
68+
];
69+
70+
$address => [
71+
'city' => 'xxxxxx', // optional
72+
'country' => 'xxxxxx',
73+
'line1' => 'xxxxxx',
74+
'line2' => 'xxxxxx', // optional
75+
'postal_code' => '123456', // optional
76+
'state' => 'xxxxxx' // optional
77+
];
78+
79+
$return_url // URL to redirect your customer back to after they authenticate or cancel their payment
80+
81+
\VaahStripe::pay($customer, $card, $package, $address, $return_url);
82+
83+
```
84+
85+
- Stripe Subscription
86+
```php
87+
88+
$customer => [
89+
'name' => 'xxxxxx',
90+
'email' => '[email protected]'
91+
];
92+
93+
$card => [
94+
'number' => 'xxxx-xxxx-xxxx-xxxx',
95+
'exp_month' => '01', // 01-12
96+
'exp_year' => '2021',
97+
'cvc' => 'xxx'
98+
];
99+
100+
$address => [
101+
'city' => 'xxxxxx', // optional
102+
'country' => 'xxxxxx',
103+
'line1' => 'xxxxxx',
104+
'line2' => 'xxxxxx', // optional
105+
'postal_code' => '123456', // optional
106+
'state' => 'xxxxxx' // optional
107+
];
108+
109+
$price_id // Price define the unit cost, currency, and (optional) billing cycle for Subcription
110+
111+
$return_url // URL to redirect your customer back to after they authenticate or cancel their payment
112+
113+
\VaahStripe::subscription($customer, $card, $address, $price_id, $return_url);
114+
115+
```
116+
117+
- Create Product
118+
```php
119+
120+
$request => [
121+
'name' => 'xxxxxx',
122+
'description' => 'xxxxxx'
123+
];
124+
125+
\VaahStripe::createProduct($request);
126+
127+
```
128+
129+
- Create Price
130+
```php
131+
132+
$request => [
133+
'product_id' => 'xxxxxx',
134+
'currency' => 'usd',
135+
'amount' => '01',
136+
'interval' => '01'
137+
138+
];
139+
140+
\VaahStripe::createPrice($request);
141+
142+
```
143+
144+
- Find Product
145+
```php
146+
147+
\VaahStripe::findProductByName($name);
148+
149+
```
150+
151+
- Find Price
152+
```php
153+
154+
$product_id
155+
156+
$value //optional
157+
158+
$by //optional default = amount amount/currency/interval
159+
160+
\VaahStripe::getProductPrice($product_id, $value, $by);
161+
162+
```

Libraries/VaahAjax.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
namespace WebReinvent\VaahExtend\Libraries;
3+
4+
5+
use GuzzleHttp\Client;
6+
7+
class VaahAjax{
8+
9+
public $ajax;
10+
11+
//----------------------------------------------------------
12+
public function __construct()
13+
{
14+
$this->ajax = new Client();
15+
}
16+
//------------------------------------------------
17+
public function post($url, $params=null, $headers = null)
18+
{
19+
$data = null;
20+
21+
if(!is_null($params))
22+
{
23+
$data['form_params'] = $params;
24+
}
25+
if(!is_null($headers))
26+
{
27+
$data['headers'] = $headers;
28+
}
29+
try{
30+
$res = $this->ajax->request('POST', $url, $data);
31+
$response = [
32+
'status' => 'success',
33+
'data' => [
34+
'status_code' => $res->getStatusCode(),
35+
'body' => $res->getBody(),
36+
'content' => $res->getBody()->getContents(),
37+
]
38+
];
39+
}catch(\Exception $e)
40+
{
41+
$response['status'] = 'failed';
42+
$response['errors'][] = $e->getMessage();
43+
44+
}
45+
return $response;
46+
}
47+
48+
//------------------------------------------------
49+
//----------------------------------------------------------
50+
51+
//----------------------------------------------------------
52+
//----------------------------------------------------------
53+
//----------------------------------------------------------
54+
}

0 commit comments

Comments
 (0)