Skip to content

Commit

Permalink
Merge branch 'v2.0' into v3-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Jun 19, 2024
2 parents 24c2a26 + dabed36 commit 77baff8
Show file tree
Hide file tree
Showing 112 changed files with 941 additions and 1,036 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
php-versions: ['7.1', '7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Install Composer dependencies
env:
PHP_VERSION: ${{ matrix.php-versions }}
run: composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;)
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run type checking analysis
env:
PHP_VERSION: ${{ matrix.php-versions }}
Expand Down
34 changes: 10 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Laravel PayPal
name: Laravel PayPal V2
on: [push, pull_request]
jobs:
paypal:
Expand All @@ -7,10 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
include:
- php-versions: '8.0'
continue-on-error: true
php-versions: ['7.1', '7.2', '7.3', '7.4']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -35,22 +32,11 @@ jobs:
- name: Install Composer dependencies
env:
PHP_VERSION: ${{ matrix.php-versions }}
run: composer install --no-progress --prefer-dist --optimize-autoloader $(if [ "$PHP_VERSION" == "8.0" || "$PHP_VERSION" == "8.1" ]; then echo "--ignore-platform-reqs"; fi;)
- name: Run tests for PHP 7.2 to 8.0 with code coverage
if: matrix.php-versions == '7.2' || matrix.php-versions == '7.3' || matrix.php-versions == '7.4' || matrix.php-versions == '8.0'
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run tests with code coverage
env:
PHP_VERSION: ${{ matrix.php-versions }}
run: vendor/bin/phpunit $(if [ "$PHP_VERSION" == "7.2" ]; then echo "-c phpunit.xml.dist.php72"; fi;) $(if [ "$PHP_VERSION" == "7.3" ]; then echo "-c phpunit.xml.dist.php8"; fi;) $(if [ "$PHP_VERSION" == "7.4" ]; then echo "-c phpunit.xml.dist.php8"; fi;) $(if [ "$PHP_VERSION" == "8.0" ]; then echo "-c phpunit.xml.dist.php8"; fi;) --coverage-clover build/logs/clover.xml
- name: Install PestPHP
if: matrix.php-versions == '8.1' || matrix.php-versions == '8.2' || matrix.php-versions == '8.3'
env:
PHP_VERSION: ${{ matrix.php-versions }}
run: composer require pestphp/pest --dev --with-all-dependencies
- name: Run tests for PHP 8.1+ with code coverage
if: matrix.php-versions == '8.1' || matrix.php-versions == '8.2' || matrix.php-versions == '8.3'
env:
PHP_VERSION: ${{ matrix.php-versions }}
run: vendor/bin/pest --coverage-clover build/logs/clover.xml
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Install PHP Coveralls library
env:
PHP_VERSION: ${{ matrix.php-versions }}
Expand All @@ -72,8 +58,8 @@ jobs:
needs: [paypal]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build:
- php-scrutinizer-run
environment:
php:
version: 8.1.13
version: '7.3.21'
tests:
override:
-
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM srmklive/docker-php-cli:7.4
FROM srmklive/docker-php-cli:7.1

LABEL maintainer="Raza Mehdi<[email protected]>"

Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,44 @@ By default, the currency used is `USD`. If you wish to change it, you may call `
$provider->setCurrency('EUR');
```

## Create Recurring Daily Subscription

```php
$response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE')
->addSubscriptionTrialPricing('DAY', 7)
->addDailyPlan('Demo Plan', 'Demo Plan', 1.50)
->setupSubscription('John Doe', '[email protected]', '2021-12-10') ;
```

## Create Recurring Weekly Subscription

```php
$response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE')
->addSubscriptionTrialPricing('DAY', 7)
->addWeeklyPlan('Demo Plan', 'Demo Plan', 30)
->setupSubscription('John Doe', '[email protected]', '2021-12-10') ;
```

## Create Recurring Monthly Subscription

```php
$response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE')
->addSubscriptionTrialPricing('DAY', 7)
->addMonthlyPlan('Demo Plan', 'Demo Plan', 100)
->setupSubscription('John Doe', '[email protected]', '2021-12-10') ;
```

## Create Recurring Annual Subscription

```php
$response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE')
->addSubscriptionTrialPricing('DAY', 7)
->addAnnualPlan('Demo Plan', 'Demo Plan', 600)
->setupSubscription('John Doe', '[email protected]', '2021-12-10') ;
```

## Create Subscription by Existing Product & Billing Plan

<a name="usage-helpers"></a>
## Helper Methods

Expand Down
106 changes: 50 additions & 56 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
{
"name": "srmklive/paypal",
"type": "library",
"description": "Laravel plugin For Processing Payments Through Paypal Express Checkout. Can Be Used Independently With Other Applications.",
"keywords": [
"http",
"rest",
"web service",
"paypal",
"laravel paypal"
],
"license": "MIT",
"authors": [
{
"name": "Raza Mehdi",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Srmklive\\PayPal\\": "src/"
}
"name": "srmklive/paypal",
"type": "library",
"description": "Laravel plugin For Processing Payments Through Paypal Express Checkout. Can Be Used Independently With Other Applications.",
"keywords": ["http", "rest", "web service", "paypal", "laravel paypal"],
"license": "MIT",
"authors": [
{
"name": "Raza Mehdi",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Srmklive\\PayPal\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Srmklive\\PayPal\\Tests\\": "tests/"
}
},
"require": {
"php": "^7.0",
"guzzlehttp/guzzle": "~6.0|~7.0",
"illuminate/support": "~5.1|~5.2|~5.3|~5.4|~5.5|~5.6|~5.7|~5.8",
"nesbot/carbon": "~1.0|~2.0"
},
"require-dev": {
"phpstan/phpstan": "~0.1|~1.0",
"phpunit/phpunit": "^5.7|^6.0|^7.0|^8.0",
"symfony/var-dumper": "~3.0|~4.0|~5.0"
},
"config": {
"allow-plugins": {
"kylekatarnls/update-helper": true
},
"autoload-dev": {
"psr-4": {
"Srmklive\\PayPal\\Tests\\": "tests/"
}
},
"require": {
"php": ">=7.2|^8.0",
"ext-curl": "*",
"guzzlehttp/guzzle": "~7.0",
"illuminate/support": "~6.0|~7.0|~8.0|~9.0|^10.0|^11.0",
"nesbot/carbon": "~2.0|^3.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^8.0|^9.0|^10.0|^11.0",
"symfony/var-dumper": "~5.0|^6.0|^7.0"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
"providers": [
"Srmklive\\PayPal\\Providers\\PayPalServiceProvider"
],
"aliases": {
"PayPal": "Srmklive\\PayPal\\Facades\\PayPal"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
"sort-packages": true,
"optimize-autoloader": true
},
"extra": {
"laravel": {
"providers": [
"Srmklive\\PayPal\\Providers\\PayPalServiceProvider"
],
"aliases": {
"PayPal": "Srmklive\\PayPal\\Facades\\PayPal"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
47 changes: 26 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="PayPal Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<exclude>
<file>src/PayPalFacadeAccessor.php</file>
<file>src/Traits/PayPalVerifyIPN.php</file>
<file>src/Services/Str.php</file>
<directory suffix=".php">src/Facades/</directory>
<directory suffix=".php">src/Providers/</directory>
</exclude>
</whitelist>
</filter>
<logging>
<junit outputFile="build/report.junit.xml"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<file>src/PayPalFacadeAccessor.php</file>
<file>src/Traits/PayPalVerifyIPN.php</file>
<file>src/Services/Str.php</file>
<directory suffix=".php">src/Facades/</directory>
<directory suffix=".php">src/Providers/</directory>
</exclude>
</source>
</phpunit>
35 changes: 0 additions & 35 deletions phpunit.xml.dist.php72

This file was deleted.

28 changes: 0 additions & 28 deletions phpunit.xml.dist.php8

This file was deleted.

2 changes: 1 addition & 1 deletion src/Services/PayPal.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(array $config = [])
*
* @param array $credentials
*/
protected function setOptions(array $credentials): void
protected function setOptions(array $credentials)
{
// Setting API Endpoints
$this->config['api_url'] = 'https://api-m.paypal.com';
Expand Down
Loading

0 comments on commit 77baff8

Please sign in to comment.