Skip to content

Commit

Permalink
Initial Release 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
md-aamroni committed Apr 1, 2024
1 parent e82a7cd commit 9d15d21
Show file tree
Hide file tree
Showing 34 changed files with 996 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
22 changes: 22 additions & 0 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Laravel

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
laravel-tests:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.2'
- uses: actions/checkout@v3
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/pest
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/.env
/.php-cs-fixer.php
/.phpunit.result.cache
/box.json
/compose.override.yaml
/composer.lock
/dev-tools/bin/
/dev-tools/infection/
/dev-tools/phpstan/cache/
/dev-tools/vendor/
/infection.json5
/php-cs-fixer.phar.asc
/phpstan.neon
/vendor/

xdebug.log
20 changes: 20 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
php:
risky: false
version: 8.3
preset: recommended
monolithic: true
tab-width: 4
use-tabs: false
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.php"
not-name:
- "*.blade.php"
- "_ide_helper.php"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

All notable changes to this package will be documented here.

## v1.0.0 (2024-04-01)
- Initial release of the package.
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Contributor Guidelines

A contributor is an individual or entity that actively participates in the development of a software project by making code contributions, submitting bug reports, proposing new features, offering suggestions for improvements, or engaging in discussions related to the project's development.

Contributors can come from diverse backgrounds and skill levels. They may contribute in various ways, such as:

- **Code Contributions**: Writing, reviewing, and submitting code changes to add new features, fix bugs, or improve existing functionality.

- **Bug Reports**: Identifying and reporting issues, bugs, or unexpected behavior encountered while using the software.

- **Feature Requests**: Suggesting new features, enhancements, or improvements to the project.

- **Documentation**: Writing, updating, or improving documentation to help users understand how to use the software or contribute to the project.

- **Testing**: Conducting testing and quality assurance activities to ensure the software functions correctly and meets its requirements.

- **Community Engagement**: Participating in discussions, providing feedback, and helping other users or contributors within the project's community forums, mailing lists, or chat channels.

- **Design**: Offering design suggestions, mockups, or user interface improvements to enhance the overall user experience of the software.

- **Translation**: Translating the software's user interface, documentation, or other resources into different languages to make the project more accessible to a global audience.

In summary, contributors play a vital role in the success and growth of open-source software projects by actively engaging with the project's development and community, thereby helping to improve the quality, usability, and functionality of the software for all users.
85 changes: 84 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
# Stripe
<p align="center"><a href="https://qubenext.com" target="_blank"><img src="./logo.svg" width="400" alt="Laravel Logo"></a></p>


### Config Example
Collect your public and secret keys, and configure as necessary in config/payment.php

```php
'stripe' => [
'public' => env('STRIPE_PUBLIC_KEY'),
'secret' => env('STRIPE_SECRET_KEY'),
'redirect' => [
'success' => 'http://localhost:8000/stripe/success',
'cancel' => 'http://localhost:8000/stripe/cancel'
],
'currency' => 'USD'
]
```

### Checkout Example
```php
<?php

use Aamroni\Stripe\Entities\CustomerEntity;
use Aamroni\Stripe\Entities\PurchaseEntity;
use Aamroni\Stripe\Facades\Stripe;
use Aamroni\Stripe\StripePaymentManager;

// @step01: Create a customer information
$customer = CustomerEntity::instance(
name: 'James Wilson',
email: 'james.wilson@example.com',
mobile: '+1 562-506-8893',
street: '2812 Locust Court',
city: 'Irvine',
postal: '92614',
state: 'California',
country: 'US'
);

// @step02: Create a purchase information
$purchase = PurchaseEntity::instance(
title: 'FoldSack No. 1 Backpack, Fits 15 Laptops',
quantity: 1,
regular: 109.95,
offered: 99,
currency: 'USD'
);

// @step03: Process the Stripe checkout
$stripe = Stripe::checkout($customer, $purchase);
// or
$stripe = StripePaymentManager::instance()->checkout($customer, $purchase);

dd($stripe);
```

### Customer Example
```php
<?php

use Aamroni\Stripe\Contracts\CustomerContract;

$instance = CustomerContract::instance();
$response = $instance->create(CustomerEntity: $customer); // Create a customer information
$response = $instance->delete(); // Delete a customer information
$response = $instance->record(); // Fetch all customer information
$response = $instance->record(id: $id); // Fetch a specific customer information

dd($response);
```

### Purchase Example
```php
<?php

use Aamroni\Stripe\Contracts\PurchaseContract;

$instance = PurchaseContract::instance();
$response = $instance->create(PurchaseEntity: $purchase); // Create a purchase information
$response = $instance->record(); // Fetch all purchase information
$response = $instance->record(id: $id); // Fetch a specific purchase information

dd($response);
```
6 changes: 6 additions & 0 deletions aamroni.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_
(_)
__ _ __ _ _ __ ___ _ __ ___ _ __ _
/ _` |/ _` | '_ ` _ \| '__/ _ \| '_ \| |
| (_| | (_| | | | | | | | | (_) | | | | |
\__,_|\__,_|_| |_| |_|_| \___/|_| |_|_|
43 changes: 43 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "aamroni/stripe",
"description": "Stripe API Payment in Laravel",
"type": "library",
"license": "MIT",
"version": "1.0.0",
"autoload": {
"psr-4": {
"Aamroni\\Stripe\\": "src/"
}
},
"authors": [
{
"name": "md-aamroni",
"email": "md.aamroni@gmail.com",
"role": "Software Developer | Tech Enthusiast"
}
],
"require": {
"php": ">=8.2"
},
"require-dev": {
"laravel/pint": "^1.15",
"pestphp/pest": "^2.34"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
"providers": [
"Aamroni\\Stripe\\Providers\\StripeServiceProvider"
],
"aliases": {
"Stripe": "Aamroni\\Stripe\\Facades\\Stripe"
}
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
24 changes: 24 additions & 0 deletions config/payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Stripe Payment Service Config
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'stripe' => [
'public' => env('STRIPE_PUBLIC_KEY'),
'secret' => env('STRIPE_SECRET_KEY'),
'redirect' => [
'success' => sprintf('%s/stripe/success', env('APP_URL')),
'cancel' => sprintf('%s/stripe/cancel', env('APP_URL')),
],
'currency' => 'USD'
],
];
11 changes: 11 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
37 changes: 37 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"preset": "psr12",
"rules": {
"phpdoc_align": true,
"phpdoc_separation": false,
"array_indentation": true,
"array_syntax": true,
"phpdoc_trim_consecutive_blank_line_separation": true,
"trim_array_spaces": true,
"global_namespace_import": true,
"phpdoc_trim": true,
"clean_namespace": true,
"no_break_comment": true,
"no_empty_comment": true,
"align_multiline_comment": true,
"no_blank_lines_after_phpdoc": true,
"no_empty_phpdoc": true,
"backtick_to_shell_exec": true,
"assign_null_coalescing_to_coalesce_equal": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"braces": true,
"cast_spaces": true,
"class_attributes_separation": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
"compact_nullable_typehint": true,
"concat_space": false,
"curly_braces_position": true,
"echo_tag_syntax": true,
"function_declaration": true,
"heredoc_indentation": true,
"integer_literal_case": true,
"magic_constant_casing": true,
"native_function_type_declaration_casing": true
}
}
Loading

0 comments on commit 9d15d21

Please sign in to comment.