diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml deleted file mode 100644 index 9e186e05..00000000 --- a/.github/workflows/sphinx.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: "Build Documentation" - -on: push - -jobs: - build: - name: Documentation - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v3 - - name: Build HTML - uses: ammaraskar/sphinx-action@master - with: - pre-build-command: "python -m pip install --upgrade pip && pip install sphinx-rtd-theme && pip install sphinx-new-tab-link" - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: html-docs - path: docs/build/html/ - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/main' - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/build/html \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml index eb97e1d7..683d440c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -25,9 +25,7 @@ build: - php-scrutinizer-run environment: php: - version: 8.1.13 - python: - version: pypy3.9-7.3.9 + version: 8.1.13 tests: override: - diff --git a/README.rst b/README.rst deleted file mode 100644 index cedb16fc..00000000 --- a/README.rst +++ /dev/null @@ -1,5 +0,0 @@ -Laravel PayPal -============== - -**Laravel Paypal** is Laravel-based wrapper for utilization of PayPal Rest API. - diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d0c3cbf1..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index dc1312ab..00000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/source/billing_plans.rst b/docs/source/billing_plans.rst deleted file mode 100644 index 66efde64..00000000 --- a/docs/source/billing_plans.rst +++ /dev/null @@ -1,205 +0,0 @@ -:orphan: - -Billing Plans -============= - -This package the following API endpoints for Billing Plans: - -* Create Billing Plan. -* List Billing Plans. -* Show Billing Plan Details. -* Update Billing Plan. -* Activate Billing Plan. -* Deactivate Billing Plan. -* Update Billing Plan Pricing Scheme. - - -Create Billing Plan -------------------- - -This implementation creates a billing plan that defines pricing and billing cycle details for subscriptions by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create - -.. code-block:: console - - $data = json_decode("{ - "product_id": "PROD-XXCD1234QWER65782", - "name": "Video Streaming Service Plan", - "description": "Video Streaming Service basic plan", - "status": "ACTIVE", - "billing_cycles": [ - { - "frequency": { - "interval_unit": "MONTH", - "interval_count": 1 - }, - "tenure_type": "TRIAL", - "sequence": 1, - "total_cycles": 2, - "pricing_scheme": { - "fixed_price": { - "value": "3", - "currency_code": "USD" - } - } - }, - { - "frequency": { - "interval_unit": "MONTH", - "interval_count": 1 - }, - "tenure_type": "TRIAL", - "sequence": 2, - "total_cycles": 3, - "pricing_scheme": { - "fixed_price": { - "value": "6", - "currency_code": "USD" - } - } - }, - { - "frequency": { - "interval_unit": "MONTH", - "interval_count": 1 - }, - "tenure_type": "REGULAR", - "sequence": 3, - "total_cycles": 12, - "pricing_scheme": { - "fixed_price": { - "value": "10", - "currency_code": "USD" - } - } - } - ], - "payment_preferences": { - "auto_bill_outstanding": true, - "setup_fee": { - "value": "10", - "currency_code": "USD" - }, - "setup_fee_failure_action": "CONTINUE", - "payment_failure_threshold": 3 - }, - "taxes": { - "percentage": "10", - "inclusive": false - } - }", true); - - $plan = $provider->createPlan($data); - - -List Billing Plans ------------------- - -This implementation lists billing plans by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_list - -.. code-block:: console - - $plans = $provider->listPlans(); - -By default, the API returns a paginated response and only includes the first 20 results. However if you pass your own parameters, you can do writing the following: - -.. code-block:: console - - $plans = $provider->listPlans(1, 30); - -In the above snippet, we are returning the plans containing upto 30 items in each paginated response along with count details. - - -Show Billing Plan Details -------------------------- - -This implementation shows details for a billing plan by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_get - -.. code-block:: console - - $plan_id = 'P-7GL4271244454362WXNWU5NQ'; - - $plan = $provider->showPlanDetails($plan_id); - - -Update Billing Plan -------------------- - -This implementation updates details for a billing plan by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_patch - -.. code-block:: console - - $data = json_decode("[ - { - "op": "replace", - "path": "/payment_preferences/payment_failure_threshold", - "value": 7 - } - ]", true); - - $plan_id = 'P-7GL4271244454362WXNWU5NQ'; - - $plan = $provider->updatePlan($plan_id, $data); - - -Activate Billing Plan ---------------------- - -This implementation activates a billing plan by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_activate - -.. code-block:: console - - $plan_id = 'P-7GL4271244454362WXNWU5NQ'; - - $plan = $provider->activatePlan($plan_id); - - -Dectivate Billing Plan ----------------------- - -This implementation deactivates a billing plan by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_deactivate - -.. code-block:: console - - $plan_id = 'P-7GL4271244454362WXNWU5NQ'; - - $plan = $provider->deactivatePlan($plan_id); - - -Update Billing Plan Pricing Scheme ----------------------------------- - -This implementation updates pricing scheme for a billing plan by implementing the following API: - -https://developer.paypal.com/docs/api/subscriptions/v1/#plans_update-pricing-schemes - -.. code-block:: console - - $pricing = json_decode("{ - "pricing_schemes": [ - { - "billing_cycle_sequence": 2, - "pricing_scheme": { - "fixed_price": { - "value": "50", - "currency_code": "USD" - } - } - } - ] - }", true); - - $plan_id = 'P-7GL4271244454362WXNWU5NQ'; - - $plan = $provider->updatePlanPricing($plan_id, $pricing); \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 34ebe21a..00000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,30 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information - -project = 'Laravel PayPal' -copyright = '2023, Raza Mehdi' -author = 'Raza Mehdi' -release = '1.0' - -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration - -extensions = [ - "sphinx_new_tab_link", -] - -templates_path = ['_templates'] -exclude_patterns = [] - - - -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - -html_theme = 'sphinx_rtd_theme' -html_static_path = ['_static'] diff --git a/docs/source/documentation.rst b/docs/source/documentation.rst deleted file mode 100644 index 7eb28c7d..00000000 --- a/docs/source/documentation.rst +++ /dev/null @@ -1,4 +0,0 @@ -Documentation -============= - -* :doc:`billing_plans` \ No newline at end of file diff --git a/docs/source/helpers.rst b/docs/source/helpers.rst deleted file mode 100644 index f5f75675..00000000 --- a/docs/source/helpers.rst +++ /dev/null @@ -1,122 +0,0 @@ - -Helper Methods -============== - -This package contains a lot of helper methods to make setting up API calls a lot easier. Here are all the available helper methods for performing API calls. - - -Subscription: Create Recurring Subscription (Daily) ---------------------------------------------------- - -.. code-block:: console - - $response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE') - ->addPlanTrialPricing('DAY', 7) - ->addDailyPlan('Demo Plan', 'Demo Plan', 1.50) - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Recurring Subscription (Weekly) ----------------------------------------------------- - -.. code-block:: console - - $response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE') - ->addPlanTrialPricing('DAY', 7) - ->addWeeklyPlan('Demo Plan', 'Demo Plan', 30) - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Recurring Subscription (Monthly) ------------------------------------------------------ - -.. code-block:: console - - $response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE') - ->addPlanTrialPricing('DAY', 7) - ->addMonthlyPlan('Demo Plan', 'Demo Plan', 100) - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Recurring Subscription (Annual) ----------------------------------------------------- - -.. code-block:: console - - $response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE') - ->addPlanTrialPricing('DAY', 7) - ->addAnnualPlan('Demo Plan', 'Demo Plan', 600) - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Recurring Subscription (Custom Intervals) --------------------------------------------------------------- - -.. code-block:: console - - $response = $provider->addProduct('Demo Product', 'Demo Product', 'SERVICE', 'SOFTWARE') - ->addCustomPlan('Demo Plan', 'Demo Plan', 150, 'MONTH', 3) - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Subscription with Existing Product & Billing Plan ----------------------------------------------------------------------- - -.. code-block:: console - - $response = $this->client->addProductById('PROD-XYAB12ABSB7868434') - ->addBillingPlanById('P-5ML4271244454362WXNWU5NQ') - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Subscription with Setup Fee ------------------------------------------------- - -.. code-block:: console - - $response = $this->client->addSetupFee(9.99) - ->addProductById('PROD-XYAB12ABSB7868434') - ->addBillingPlanById('P-5ML4271244454362WXNWU5NQ') - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Subscription with Shipping Address -------------------------------------------------------- - -.. code-block:: console - - $response = $this->client->addShippingAddress('John Doe', 'House no. 123', 'Street 456', 'Test Area', 'Test Area', 10001, 'US') - ->addProductById('PROD-XYAB12ABSB7868434') - ->addBillingPlanById('P-5ML4271244454362WXNWU5NQ') - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Subscription: Create Subscription with Payment Failure Threshold ----------------------------------------------------------------- - -.. code-block:: console - - $response = $this->client->addPaymentFailureThreshold(5) - ->addProductById('PROD-XYAB12ABSB7868434') - ->addBillingPlanById('P-5ML4271244454362WXNWU5NQ') - ->setReturnAndCancelUrl('https://example.com/paypal-success', 'https://example.com/paypal-cancel') - ->setupSubscription('John Doe', 'john@example.com', '2021-12-10'); - - -Billing Plans: Update Pricing Schemes -------------------------------------- - -.. code-block:: console - - $response = $this->client->addBillingPlanById('P-5ML4271244454362WXNWU5NQ') - ->addPricingScheme('DAY', 7, 0, true) - ->addPricingScheme('MONTH', 1, 100) - ->processBillingPlanPricingUpdates(); \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index 26b11094..00000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. Laravel PayPal documentation master file, created by - sphinx-quickstart on Wed Sep 6 01:27:06 2023. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to Laravel PayPal's documentation! -========================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - installation - usage - helpers - documentation diff --git a/docs/source/installation.rst b/docs/source/installation.rst deleted file mode 100644 index 7691209a..00000000 --- a/docs/source/installation.rst +++ /dev/null @@ -1,90 +0,0 @@ - -Installation -============ - -This package utilizes PayPal Rest API under the hood. If you are using PayPal Express Checkout, please refer to the README for v1 here: - -https://github.com/srmklive/laravel-paypal/blob/v1.0/README.md - - -For installation, run the following commands: - -Laravel 5.1 to 5.8 ------------------- - -.. code-block:: console - - composer require srmklive/paypal:~2.0 - -Laravel 6 & above ------------------ - -.. code-block:: console - - composer require srmklive/paypal:~3.0 - - -Publishing Assets -================= - -After installation, you can use the following commands to publish the assets: - -.. code-block:: console - - php artisan vendor:publish --provider "Srmklive\PayPal\Providers\PayPalServiceProvider" - - -Configuration -============= - -.. code-block:: console - - # PayPal API Mode - # Values: sandbox or live (Default: live) - PAYPAL_MODE= - - #PayPal Setting & API Credentials - sandbox - PAYPAL_SANDBOX_CLIENT_ID= - PAYPAL_SANDBOX_CLIENT_SECRET= - - #PayPal Setting & API Credentials - live - PAYPAL_LIVE_CLIENT_ID= - PAYPAL_LIVE_CLIENT_SECRET= - PAYPAL_LIVE_APP_ID= - - # Payment Action. Can only be 'Sale', 'Authorization' or 'Order' - PAYPAL_PAYMENT_ACTION=Sale - - # Currency. Default is USD. If you need to update it, then set the value through the PAYPAL_CURRENCY environment variable. - PAYPAL_CURRENCY=EUR - - # Validate SSL when creating api client. By default, the value is great. To disable validation set to false. - PAYPAL_VALIDATE_SSL=false - - -Configuration File -================== - -The configuration file **paypal.php** is located in the **config** folder. Following are its contents when published: - -.. code-block:: console - - return [ - 'mode' => env('PAYPAL_MODE', 'sandbox'), // Can only be 'sandbox' Or 'live'. If empty or invalid, 'live' will be used. - 'sandbox' => [ - 'client_id' => env('PAYPAL_SANDBOX_CLIENT_ID', ''), - 'client_secret' => env('PAYPAL_SANDBOX_CLIENT_SECRET', ''), - 'app_id' => 'APP-80W284485P519543T', - ], - 'live' => [ - 'client_id' => env('PAYPAL_LIVE_CLIENT_ID', ''), - 'client_secret' => env('PAYPAL_LIVE_CLIENT_SECRET', ''), - 'app_id' => '', - ], - - 'payment_action' => env('PAYPAL_PAYMENT_ACTION', 'Sale'), // Can only be 'Sale', 'Authorization' or 'Order' - 'currency' => env('PAYPAL_CURRENCY', 'USD'), - 'notify_url' => env('PAYPAL_NOTIFY_URL', ''), // Change this accordingly for your application. - 'locale' => env('PAYPAL_LOCALE', 'en_US'), // force gateway language i.e. it_IT, es_ES, en_US ... (for express checkout only) - 'validate_ssl' => env('PAYPAL_VALIDATE_SSL', true), // Validate SSL when creating api client. - ]; \ No newline at end of file diff --git a/docs/source/usage.rst b/docs/source/usage.rst deleted file mode 100644 index 18792233..00000000 --- a/docs/source/usage.rst +++ /dev/null @@ -1,63 +0,0 @@ - -Usage -===== - - -Initialization --------------- - -.. code-block:: console - - // Import the class namespaces first, before using it directly - use Srmklive\PayPal\Services\PayPal as PayPalClient; - - $provider = new PayPalClient; - - // Through facade. No need to import namespaces - $provider = \PayPal::setProvider(); - - -Get Access Token ----------------- - -After setting the PayPal API configuration, you need to get access token before performing any API calls - -.. code-block:: console - - $provider->getAccessToken(); - - -Override Configuration ----------------------- - -You can override PayPal API configuration by calling setApiCredentials method: - -.. code-block:: console - - $config = [ - 'mode' => 'live', - 'live' => [ - 'client_id' => 'some-client-id', - 'client_secret' => 'some-client-secret', - 'app_id' => 'APP-80W284485P519543T', - ], - - 'payment_action' => 'Sale', - 'currency' => 'USD', - 'notify_url' => 'https://your-app.com/paypal/notify', - 'locale' => 'en_US', - 'validate_ssl' => true, - ]; - - $provider->setApiCredentials($config); - - - -Change Currency ---------------- - -By default the currency used is **USD**. You can either add the `PAYPAL_CURRENCY` environment variable in your **.env** file or you may call `setCurrency` method to set a different currency before calling any respective API methods: - -.. code-block:: console - - $provider->setCurrency('EUR'); diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4da48237..00000000 Binary files a/requirements.txt and /dev/null differ