Skip to content

Commit

Permalink
Merge pull request #165 from razorpay/master-opencart3-php8
Browse files Browse the repository at this point in the history
PO-120 (Opencart<> Opencart Deprecated error)
  • Loading branch information
rohitcbr authored May 20, 2024
2 parents feae05f + 94244e8 commit 620766c
Show file tree
Hide file tree
Showing 129 changed files with 5,693 additions and 1,038 deletions.
2 changes: 1 addition & 1 deletion admin/language/en-gb/extension/payment/razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
$_['text_invoice'] = 'Invoice Details';
$_['text_not_select_sub_ID'] = 'Please Select Subscription ';
$_['text_subscription_status'] = 'Enable Subscription in Settings.';
$_['text_webhook_cron_header'] = 'Set the cron job in your WHMCS site server to call the Cron URL in every 5 mins frequncy.';
$_['text_webhook_cron_header'] = 'Set the cron job in your OpenCart site server to call the Cron URL in every 5 mins frequncy.';
$_['text_webhook_cron'] = '<ol><li>In CLI run <strong>crontab -e</strong></li><li>Add the command: <strong>%s</strong></li><li>Save.</li><li>Run: <strong>crontab -l</strong> confirm below if cron is added.</li></ol>';
$_['text_webhook_cron_confirm'] = 'Confirm Cron created.';

Expand Down
6 changes: 3 additions & 3 deletions catalog/controller/extension/payment/razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private function get_order_creation_data($order_id)
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);

$data = [
'receipt' => $order_id,
'receipt' => (string)$order_id,
'amount' => $this->currency->format($order['total'], $order['currency_code'], $order['currency_value'], false) * 100,
'currency' => $order['currency_code'],
'payment_capture' => ($this->config->get('payment_razorpay_payment_action') === 'authorize') ? 0 : 1
Expand Down Expand Up @@ -557,12 +557,12 @@ public function getMerchantPreferences(array &$preferences)
{
try
{
$response = Requests::get($this->api->getBaseUrl() . 'preferences?key_id=' . $this->api->getKey());
$response = Requests::get($this->api->getBaseUrl() . '/preferences?key_id=' . $this->api->getKey());
}
catch (Exception $e)
{
$this->log->write($e->getMessage());
throw new Exception($e->getMessage(), $e->getHttpCode());
throw new Exception($e->getMessage(), $e->getCode());
}

$preferences['is_hosted'] = false;
Expand Down
38 changes: 37 additions & 1 deletion system/library/razorpay/razorpay-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,42 @@ Changelog for Razorpay-PHP SDK. Follows [keepachangelog.com](https://keepachange

## Unreleased

## [2.9.0] - 2023-12-18
feat: Added new API endpoints

* Added support for `addBankAccount`, `deleteBankAccount`, `requestEligibilityCheck` & `fetchEligibility` on customer
* Added support for `uploadAccountDoc` & `fetchAccountDoc` on account
* Added support for [Dispute](https://razorpay.com/docs/api/disputes/)
* Added support for [Document](https://razorpay.com/docs/api/documents/)
* Added support for fetch all IINs Supporting native otps & fetch all IINs with business sub-type using `all`
* Added support for `viewRtoReview` & `editFulfillment` on order
* Added support for fetch a payment (emi/ offer/ card/ upi) using `expandedDetails` on payments
* Added support for `uploadStakeholderDoc` & `fetchStakeholderDoc` on stakeholder


## [2.8.7] - 2023-09-11
[#357](https://github.com/razorpay/razorpay-php/pull/357) [`b29754f`](https://github.com/razorpay/razorpay-php/commit/b29754f8892e0c2035055cf73fd7ab132de18e52) Chore: Changed Content-Type `application/json` for `order create` API from default `application/x-www-form-urlencoded`


## [2.8.6] - 2023-06-16
[#348](https://github.com/razorpay/razorpay-php/pull/348) [`68b2028`](https://github.com/razorpay/razorpay-php/commit/68b2028bafda49af970a098d6d11aa8e5a575d40) feat: Added new API endpoints

* Added account onboarding API (create, fetch, edit, delete)
* Added stakeholders API (create, fetch, fetchAll, edit)
* Added product configuration API (requestProductConfiguration, fetch, edit, fetchTnc)
* Added webhooks API (create, fetch, fetchAll, edit, delete)
* Added token sharing API (create, fetch, delete, processPaymentOnAlternatePAorPG)

## [2.8.5] - 2022-10-19

### Added
- Update [Request](https://github.com/WordPress/Requests/tree/v2.0.4) library to v2.0.4

## [2.8.4] - 2022-06-28

- New APIs for Third party validation (createUpi, validateVpa, fetchPaymentMethods)
- Update documentation

## [2.8.3] - 2022-04-29

- PHP v8.1 is officially supported
Expand Down Expand Up @@ -221,4 +257,4 @@ Changelog for Razorpay-PHP SDK. Follows [keepachangelog.com](https://keepachange
[2.5.0]: https://github.com/razorpay/razorpay-php/compare/2.4.0-beta...2.5.0
[2.8.0]: https://github.com/razorpay/razorpay-php/compare/2.7.1...2.8.0
[2.8.1]: https://github.com/razorpay/razorpay-php/compare/2.8.0...2.8.1
[2.8.2]: https://github.com/razorpay/razorpay-php/compare/2.8.0...2.8.2
[2.8.2]: https://github.com/razorpay/razorpay-php/compare/2.8.0...2.8.2
6 changes: 3 additions & 3 deletions system/library/razorpay/razorpay-sdk/Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* Allows for Composer to autoload the old PSR-0 classes via the custom autoloader.
* This prevents issues with _extending final classes_ (which was the previous solution).
*
* Please see the Changelog for the 2.0.0 release for upgrade notes.
* Please see the Changelog for the 2.0.4 release for upgrade notes.
*
* @package Requests
*
* @deprecated 2.0.0 Use the PSR-4 class names instead.
* @deprecated 2.0.4 Use the PSR-4 class names instead.
*/
define("REQUESTS_SILENCE_PSR0_DEPRECATIONS",true);

if (class_exists('WpOrg\Requests\Autoload') === false) {
require_once __DIR__. 'libs/Requests-2.0.0/src/Autoload.php';
require_once __DIR__. 'libs/Requests-2.0.4/src/Autoload.php';
}

WpOrg\Requests\Autoload::register();
7 changes: 7 additions & 0 deletions system/library/razorpay/razorpay-sdk/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2019 Razorpay

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 9 additions & 0 deletions system/library/razorpay/razorpay-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,26 @@ The resources can be accessed via the `$api` object. All the methods invocations
$api->payment->fetch($paymentId);
```
## Supported Resources
- [Account](documents/account.md)
- [Customer](documents/customer.md)
- [Dispute](documents/dispute.md)
- [Document](documents/document.md)
- [Token](documents/token.md)
- [Order](documents/order.md)
- [Payments](documents/payment.md)
- [Settlements](documents/settlement.md)
- [Refunds](documents/refund.md)
- [Fund](documents/fund.md)
- [Invoice](documents/invoice.md)
- [Iin](documents/Iin.md)
- [Plan](documents/plan.md)
- [Item](documents/item.md)
- [Subscriptions](documents/subscription.md)
- [Add-on](documents/addon.md)
- [Payment Links](documents/paymentLink.md)
- [Product Configuration](documents/productConfiguration.md)
- [Smart Collect](documents/virtualaccount.md)
- [Stakeholder](documents/stakeholder.md)
- [Transfer](documents/transfer.md)
- [QR Code](documents/qrcode.md)
- [Emandate](documents/emandate.md)
Expand All @@ -74,6 +81,8 @@ The resources can be accessed via the `$api` object. All the methods invocations
- [Register Emandate and Charge First Payment Together](documents/registeremandate.md)
- [Register NACH and Charge First Payment Together](documents/registernach.md)
- [Payment Verification](documents/paymentVerfication.md)
- [Webhook](documents/webhook.md)


## Development

Expand Down
7 changes: 5 additions & 2 deletions system/library/razorpay/razorpay-sdk/Razorpay.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

// Include Requests only if not already defined
const REQUESTS_SILENCE_PSR0_DEPRECATIONS = true;
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS'))
{
define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true);
}

if (class_exists('WpOrg\Requests\Autoload') === false)
{
require_once __DIR__.'/libs/Requests-2.0.0/src/Autoload.php';
require_once __DIR__.'/libs/Requests-2.0.4/src/Autoload.php';
}

try
Expand Down
41 changes: 41 additions & 0 deletions system/library/razorpay/razorpay-sdk/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "razorpay/razorpay",
"description": "Razorpay PHP Client Library",
"keywords": ["razorpay", "api", "php", "client"],
"authors": [
{
"name": "Abhay Rana",
"email": "[email protected]",
"homepage": "https://captnemo.in",
"role": "Developer"
},
{
"name": "Shashank Kumar",
"email": "[email protected]",
"role": "Developer"
}
],
"support": {
"email": "[email protected]",
"issues": "https://github.com/Razorpay/razorpay-php/issues",
"source": "https://github.com/Razorpay/razorpay-php"
},
"homepage": "https://docs.razorpay.com",
"license": "MIT",
"require": {
"php": ">=7.3",
"rmccue/requests": "^2.0",
"ext-json": "*"
},
"require-dev": {
"raveren/kint": "1.*",
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
"Razorpay\\Api\\": "src/",
"Razorpay\\Tests\\": "tests/"
},
"files" : ["Deprecated.php"]
}
}
104 changes: 104 additions & 0 deletions system/library/razorpay/razorpay-sdk/documents/Iin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
### Iin

### Token IIN API

```php
$tokenIin = "412345";
$api->iin->fetch($tokenIin);
```

**Parameters:**

| Name | Type | Description |
|------------|--------|-----------------------------------|
| tokenIin* | string | The token IIN. |

**Response:**
```json
{
"iin": "412345",
"entity": "iin",
"network": "Visa",
"type": "credit",
"sub_type": "business",
"issuer_code": "HDFC",
"issuer_name": "HDFC Bank Ltd",
"international": false,
"is_tokenized": true,
"card_iin": "411111",
"emi":{
"available": true
},
"recurring": {
"available": true
},
"authentication_types": [
{
"type":"3ds"
},
{
"type":"otp"
}
]
}
```
-------------------------------------------------------------------------------------------------------

### Fetch All IINs Supporting Native OTP

```php
$api->iin->all(array("flow" => "otp"));
```

**Response:**
```json
{
"count": 24,
"iins": [
"512967",
"180005",
"401704",
"401806",
"123456",
"411111",
"123512967",
"180012305",
"401123704"
]
}
```
-------------------------------------------------------------------------------------------------------

### Fetch All IINs with Business Sub-type

```php
$api->iin->all(array("sub_type" => "business"));
```

**Response:**
```json
{
"count": 24,
"iins": [
"512967",
"180005",
"401704",
"401806",
"607389",
"652203",
"414367",
"787878",
"123456",
"411111",
"123512967",
"180012305",
"401123704"
]
}
```
-------------------------------------------------------------------------------------------------------

**PN: * indicates mandatory fields**
<br>
<br>
**For reference click [here](https://razorpay.com/docs/api/payments/cards/iin-api/#iin-entity)**
Loading

0 comments on commit 620766c

Please sign in to comment.