| @@ -1,5 +1,5 @@ | ||
| 1 | -PHP library for the PayPlug API | |
| 1 | +PHP library for the Payplug API | |
| 2 | 2 | =============================== |
| 3 | 3 | |
| 4 | 4 | .. image:: https://travis-ci.org/payplug/payplug-php.svg?branch=master |
| 5 | 5 | :target: https://travis-ci.org/payplug/payplug-php |
| @@ -8,46 +8,49 @@ | ||
| 8 | 8 | .. image:: https://img.shields.io/packagist/v/payplug/payplug-php.svg |
| 9 | 9 | :target: https://packagist.org/packages/payplug/payplug-php |
| 10 | 10 | :alt: Packagist |
| 11 | 11 | |
| 12 | -This is the documentation of PayPlug's PHP library. It is designed to | |
| 13 | -help developers to use PayPlug as payment solution in a simple, yet robust way. | |
| 12 | +This is the documentation of Payplug's PHP library. It is designed to | |
| 13 | +help developers use Payplug as a payment solution in a simple, yet robust way. | |
| 14 | 14 | |
| 15 | -You can create a PayPlug account at https://www.payplug.com/. | |
| 15 | +You can create a Payplug account at https://www.payplug.com/. | |
| 16 | 16 | |
| 17 | 17 | Maintenance |
| 18 | +----------- | |
| 18 | 19 | |
| 19 | -CA certificate (cacert.pem) should be updated every year during the first week of December. | |
| 20 | +CA certificate (cacert.pem) should be updated every year during the first week of December. | |
| 20 | 21 | Go to https://curl.se/docs/caextract.html to get a recent one. |
| 21 | 22 | |
| 22 | 23 | Prerequisites |
| 23 | 24 | ------------- |
| 24 | 25 | |
| 25 | -PayPlug's library relies on **cURL** to perform HTTP requests and requires **OpenSSL (1.0.1 or newer)** to secure transactions. You also need **PHP 5.3** or newer for the PayPlug PHP V2. | |
| 26 | +Payplug's library relies on **cURL** to perform HTTP requests and requires **OpenSSL (1.0.1 or newer)** to secure transactions. You also need **PHP 5.3** or newer for the Payplug PHP V2. | |
| 26 | 27 | |
| 27 | -For version **PHP 5.2** or older you must refer to PayPlug PHP V1. | |
| 28 | +For version **PHP 5.2** or older, you must refer to Payplug PHP V1. | |
| 28 | 29 | |
| 29 | 30 | Documentation |
| 30 | 31 | ------------- |
| 31 | -Please see https://docs.payplug.com/api for latest documentation. | |
| 32 | 32 | |
| 33 | +Please see https://docs.payplug.com/api for the latest documentation. | |
| 34 | + | |
| 33 | 35 | Installation |
| 36 | +------------- | |
| 37 | + | |
| 34 | 38 | **Option 1 - Strongly preferred)** via composer: |
| 35 | 39 | |
| 36 | -- Get composer from `composer website`_. | |
| 40 | +- Get composer from the `composer website`_. | |
| 37 | 41 | - Make sure you have initialized your *composer.json*. |
| 38 | 42 | - Run *composer require payplug/payplug-php* from your project directory. |
| 39 | 43 | |
| 40 | 44 | .. _composer website: https://getcomposer.org/download/ |
| 41 | 45 | |
| 42 | -**Option 2)** clone the repository : | |
| 46 | +**Option 2-** clone the repository: | |
| 47 | + | |
| 43 | 48 | :: |
| 44 | 49 | |
| 45 | 50 | git clone https://github.com/payplug/payplug-php.git |
| 46 | 51 | |
| 47 | -**Option 3)** download as a tarball : | |
| 52 | +**Option 3)** download as a tarball: | |
| 48 | 53 | |
| 49 | 54 | - Download the most recent tarball from the `download page V2`_ (V2 for **PHP 5.3** or newer) |
| 50 | 55 | - Download the most recent tarball from the `download page V1`_ (V1 for **PHP 5.2** or older) |
| 51 | 56 | - Unpack the tarball |
| @@ -59,19 +62,82 @@ | ||
| 59 | 62 | __ https://bitbucket.org/payplug/payplug_php/downloads#tag-downloads |
| 60 | 63 | |
| 61 | 64 | To get started, add the following to your PHP script (if you are not running a framework): |
| 62 | 65 | |
| 63 | -.. sourcecode :: php | |
| 66 | +.. code-block:: php | |
| 64 | 67 | |
| 65 | 68 | <?php |
| 66 | 69 | require_once("PATH_TO_PAYPLUG/payplug_php/lib/init.php"); |
| 67 | 70 | |
| 71 | +Project Git Workflow | |
| 72 | +===================== | |
| 73 | + | |
| 74 | +This repository follows a specific Git workflow to ensure smooth collaboration and controlled releases. Please follow the steps outlined below when contributing to this project. | |
| 75 | + | |
| 76 | +Git Workflow Steps | |
| 77 | +------------------ | |
| 78 | + | |
| 79 | +1. **Create a feature or fix branch:** | |
| 80 | + | |
| 81 | + Before making any changes, create a new branch from the `develop` branch: | |
| 82 | + | |
| 83 | + :: | |
| 84 | + | |
| 85 | + git checkout develop | |
| 86 | + git pull origin develop | |
| 87 | + git checkout -b <feature-name> | |
| 88 | + | |
| 89 | + For a bug fix, use: | |
| 90 | + | |
| 91 | + :: | |
| 92 | + | |
| 93 | + git checkout develop | |
| 94 | + git pull origin develop | |
| 95 | + git checkout -b <fix-name> | |
| 96 | + | |
| 97 | +2. **Work on your feature or fix:** | |
| 98 | + | |
| 99 | + Make your code changes and commit them to your feature or fix branch. | |
| 100 | + | |
| 101 | +3. **Create a merge request:** | |
| 102 | + | |
| 103 | + Once your feature or fix is ready, create a merge request from your branch to the `develop` branch. Get your changes reviewed by your peers. | |
| 104 | + | |
| 105 | +4. **Release preparation:** | |
| 106 | + | |
| 107 | + When it's time for a release, create an intermediary branch called `release-<version-number>` from the `develop` branch: | |
| 108 | + | |
| 109 | + :: | |
| 110 | + | |
| 111 | + git checkout develop | |
| 112 | + git pull origin develop | |
| 113 | + git checkout -b release-<version-number> | |
| 114 | + | |
| 115 | +5. **Finalize the release:** | |
| 116 | + | |
| 117 | + Test the code on the `release-<version-number>` branch thoroughly. Fix any bugs or issues that arise. | |
| 118 | + | |
| 119 | +6. **Merge to master:** | |
| 120 | + | |
| 121 | + Once the release is tested and stable, create a merge request from the `release-<version-number>` branch to the `master` branch. This signifies a successful release. | |
| 122 | + | |
| 123 | +7. **Tag the release:** | |
| 124 | + | |
| 125 | + After the merge to `master`, create a new tag to mark the release version: | |
| 126 | + | |
| 127 | + :: | |
| 128 | + | |
| 129 | + git checkout master | |
| 130 | + git pull origin master | |
| 131 | + git tag -a <version-number> -m "Release <version-number>" | |
| 132 | + git push origin master --tags | |
| 133 | + | |
| 68 | 134 | Usage |
| 69 | 135 | ----- |
| 70 | 136 | |
| 71 | 137 | Here's how simple it is to create a payment request: |
| 72 | 138 | |
| 73 | -.. sourcecode :: php | |
| 139 | +.. code-block:: php | |
| 74 | 140 | |
| 75 | 141 | <?php |
| 76 | 142 | require_once("PATH_TO_PAYPLUG/payplug_php/lib/init.php"); // If not using a framework |
| 77 | 143 | |
| @@ -81,9 +147,9 @@ | ||
| 81 | 147 | 'apiVersion' => 'THE_API_VERSION_YOU_WANT', |
| 82 | 148 | )); |
| 83 | 149 | |
| 84 | 150 | // Create a payment request of €9.99. The payment confirmation (IPN) will be sent to "'https://example.net/notifications?id='.$customer_id". |
| 85 | - // note that all amounts must be expressed in centimes as positive whole numbers (€9.99 = 999 centimes). | |
| 151 | + // Note that all amounts must be expressed in centimes as positive whole numbers (€9.99 = 999 centimes). | |
| 86 | 152 | // Metadata allow you to include additional information when processing payments or refunds. |
| 87 | 153 | $customer_id = '42710'; |
| 88 | 154 | |
| 89 | 155 | $payment = Payplug\Payment::create(array( |
| @@ -120,12 +186,11 @@ | ||
| 120 | 186 | 'metadata' => array( |
| 121 | 187 | 'customer_id' => $customer_id |
| 122 | 188 | ) |
| 123 | 189 | )); |
| 124 | - ?> | |
| 125 | 190 | |
| 126 | 191 | // You will be able to find how the payment object is built in the documentation. |
| 127 | - // For instance, if you want to get an URL to the payment page, you get do: | |
| 192 | + // For instance, if you want to get a URL to the payment page, you can do: | |
| 128 | 193 | $paymentUrl = $payment->hosted_payment->payment_url; |
| 129 | 194 | |
| 130 | 195 | // Then, you can redirect the user to the payment page |
| 131 | 196 | header("Location: $paymentUrl"); |
| @@ -134,4 +199,17 @@ | ||
| 134 | 199 | ----------- |
| 135 | 200 | Tests: |
| 136 | 201 | ++++++ |
| 137 | 202 | See tests/README.rst. |
| 203 | + | |
| 204 | +Project Owners | |
| 205 | +-------------- | |
| 206 | + | |
| 207 | +This project is maintained by: | |
| 208 | + | |
| 209 | + | |
| 210 | +- [Imène Lajili](https://github.com/ilajili) | |
| 211 | +- [Manuel Mesquita](https://github.com/PPmmesquita) | |
| 212 | + | |
| 213 | +For any questions or concerns about the workflow, feel free to reach out to the project owners. | |
| 214 | + | |
| 215 | + | |