Skip to content

Commit

Permalink
updated: ,ibraries
Browse files Browse the repository at this point in the history
  • Loading branch information
themodernpk committed Mar 6, 2023
1 parent c5d0292 commit 38223ff
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Libraries/VaahAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function post($url, $params=null, $headers = null)
}catch(\Exception $e)
{
$response['status'] = 'failed';
$response['errors'][] = $e->getMessage();
$response['errors'] = [$e->getMessage()];

}
return $response;
Expand Down
9 changes: 8 additions & 1 deletion Libraries/VaahArtisan.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static function setParams()
//-------------------------------------------------
public static function validateMigrateCommands($command)
{
$response = [];
//acceptable commands
$commands = [
"migrate",
Expand All @@ -30,7 +31,7 @@ public static function validateMigrateCommands($command)
if(!in_array($command, $commands))
{
$response['status'] = 'failed';
$response['errors'][] = 'Invalid command';
$response['errors'] = ['Invalid command'];
if(env('APP_DEBUG'))
{
$response['hint']['acceptable_commands'] = $commands;
Expand All @@ -44,6 +45,7 @@ public static function validateMigrateCommands($command)
//-------------------------------------------------
public static function artisan()
{
$response = [];
try{
\Artisan::call(self::$command, self::$params);
$response['status'] = 'success';
Expand Down Expand Up @@ -84,6 +86,11 @@ public static function migrationReset($path=null, $db_connection_name=null)
return self::migrate('migrate:reset', $db_connection_name, $path);
}
//-------------------------------------------------
public static function migrationFresh($db_connection_name=null)
{
return self::migrate('migrate:fresh', $db_connection_name);
}
//-------------------------------------------------
public static function validateSeedCommand($command)
{
//acceptable commands
Expand Down
23 changes: 23 additions & 0 deletions Libraries/VaahDB.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php namespace WebReinvent\VaahExtend\Libraries;


use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class VaahDB{

public static function isConnected()
{
try {
return DB::connection()->getPdo();
} catch (\Exception $e) {
return false;
}
}

public static function isTableExist($table)
{
return Schema::hasTable($table);
}

}
34 changes: 17 additions & 17 deletions Libraries/VaahStripe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Add Facade in `config/app.php`:
```

Add env configuration:
```
```env
...
STRIPE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Expand All @@ -47,27 +47,27 @@ Reference url: https://stripe.com/docs/api

- Stripe One Time Payment

```
```php

$customer => [
$customer = [
'name' => 'xxxxxx',
'email' => '[email protected]'
];

$card => [
$card = [
'number' => 'xxxx-xxxx-xxxx-xxxx',
'exp_month' => '01', // 01-12
'exp_year' => '2021',
'cvc' => 'xxx'
];

$package => [
$package = [
'currency' => 'usd', // usd / USD
'amount' => '01',
'description' => 'xxxxxx'
];

$address => [
$address = [
'city' => 'xxxxxx', // optional
'country' => 'xxxxxx',
'line1' => 'xxxxxx',
Expand All @@ -76,7 +76,7 @@ Reference url: https://stripe.com/docs/api
'state' => 'xxxxxx' // optional
];

$return_url // URL to redirect your customer back to after they authenticate or cancel their payment
$return_url = ""; // URL to redirect your customer back to after they authenticate or cancel their payment

\VaahStripe::pay($customer, $card, $package, $address, $return_url);

Expand All @@ -85,19 +85,19 @@ Reference url: https://stripe.com/docs/api
- Stripe Subscription
```php

$customer => [
$customer = [
'name' => 'xxxxxx',
'email' => '[email protected]'
];

$card => [
$card = [
'number' => 'xxxx-xxxx-xxxx-xxxx',
'exp_month' => '01', // 01-12
'exp_year' => '2021',
'cvc' => 'xxx'
];

$address => [
$address = [
'city' => 'xxxxxx', // optional
'country' => 'xxxxxx',
'line1' => 'xxxxxx',
Expand All @@ -106,9 +106,9 @@ Reference url: https://stripe.com/docs/api
'state' => 'xxxxxx' // optional
];

$price_id // Price define the unit cost, currency, and (optional) billing cycle for Subcription
$price_id = 50; // Price define the unit cost, currency, and (optional) billing cycle for Subcription

$return_url // URL to redirect your customer back to after they authenticate or cancel their payment
$return_url = ""; // URL to redirect your customer back to after they authenticate or cancel their payment

\VaahStripe::subscription($customer, $card, $address, $price_id, $return_url);

Expand All @@ -117,7 +117,7 @@ Reference url: https://stripe.com/docs/api
- Create Product
```php

$request => [
$request = [
'name' => 'xxxxxx',
'description' => 'xxxxxx'
];
Expand All @@ -129,7 +129,7 @@ Reference url: https://stripe.com/docs/api
- Create Price
```php

$request => [
$request = [
'product_id' => 'xxxxxx',
'currency' => 'usd',
'amount' => '01',
Expand All @@ -151,11 +151,11 @@ Reference url: https://stripe.com/docs/api
- Find Price
```php

$product_id
$product_id = 1;

$value //optional
$value = ""; //optional

$by //optional default = amount amount/currency/interval
$by = ""; //optional default = amount amount/currency/interval

\VaahStripe::getProductPrice($product_id, $value, $by);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": "^7.4|^8.0",
"php-imap/php-imap": "^4.0",
"php-imap/php-imap": "^5.0",
"ext-json": "*",
"ext-imap": "*",
"ext-curl": "*",
Expand Down

0 comments on commit 38223ff

Please sign in to comment.