Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PO-120 (Opencart<> Opencart Deprecated error) #165

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitcbr please put platform as OpenCart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashgit891 updated here

$_['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
14 changes: 14 additions & 0 deletions system/library/razorpay/razorpay-sdk/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is for unifying the coding style for different editors and IDEs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitcbr please remove this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashgit891 removed in this commit 94244e8

# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.php]
indent_style = space
indent_size = 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: feature.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohitcbr Please remove .github folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashgit891 removed in this commit 94244e8

description: Submit a proposal for a new feature
title: '[Feature]: '
labels: [':rocket: Feature Request']
body:
- type: markdown
attributes:
value: |
### Thank you for taking the time to suggest a new feature!
We kindly ask that you search to see if an issue [already exists](https://github.com/razorpay/razorpay-php/issues?q=is%3Aissue+sort%3Acreated-desc+) for your feature.
We are also happy to accept contributions from our users.
- type: textarea
id: description
attributes:
label: '🚀 Feature Proposal'
description:
validations:
required: true
- type: textarea
id: solution
attributes:
label: Suggested Solution
description:
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives
description:
validations:
required: false
- type: textarea
id: extra
attributes:
label: Additional Information
description:
validations:
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: issue.md
description: Create a report to help us improve
labels: ["issue"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this issue report!
- type: textarea
id: repro-steps
attributes:
label: Steps to reproduce the behavior
description:
placeholder: |
1. Fetch a '...'
2. Update the '....'
3. See error
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: A clear and concise description of what actually happen.
validations:
required: true
- type: textarea
id: code-snippets
attributes:
label: Code snippets
description: If applicable, add code snippets to help explain your problem.
render: Php
validations:
required: false
- type: input
id: language-version
attributes:
label: Php version
placeholder: Php v7.4
validations:
required: true
- type: input
id: lib-version
attributes:
label: Library version
placeholder: razorpay-php v2.8.4
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional Information
description: Add any other information about the problem here.
validations:
required: false
8 changes: 8 additions & 0 deletions system/library/razorpay/razorpay-sdk/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "04:00"
timezone: Asia/Calcutta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Note :- Please follow the below points while attaching test cases document link below:
### - If label `Tested` is added then test cases document URL is mandatory.
### - Link added should be a valid URL and accessible throughout the org.
### - If the branch name contains hotfix / revert by default the BVT workflow check will pass.

| Test Case Document URL |
|-----------------------------------------------|
| Please paste test case document link here.... |
37 changes: 37 additions & 0 deletions system/library/razorpay/razorpay-sdk/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI
on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php 8.0
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: 'Create env file'
run: |
touch ${{ github.workspace }}/tests/.env
echo RAZORPAY_API_KEY=${{ secrets.RAZORPAY_API_KEY }} >> ${{ github.workspace }}/tests/.env
echo RAZORPAY_API_SECRET=${{ secrets.RAZORPAY_API_SECRET }} >> ${{ github.workspace }}/tests/.env
cat ${{ github.workspace }}/tests/.env
- name: Install dependencies
run: composer self-update && composer install && composer require vlucas/phpdotenv && composer dump-autoload
- name: Run tests and collect coverage
run: vendor/bin/phpunit ./tests/CoverageTest.php --coverage-clover coverage.xml .
env:
RAZORPAY_API_KEY: ${{ secrets.RAZORPAY_API_KEY }}
RAZORPAY_API_SECRET: ${{ secrets.RAZORPAY_API_SECRET }}
RAZORPAY_PARTNER_API_KEY: ${{ secrets.RAZORPAY_PARTNER_API_KEY }}
RAZORPAY_PARTNER_API_SECRET: ${{ secrets.RAZORPAY_PARTNER_API_SECRET }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: SecurityChecks
on:
pull_request: {}
push:
branches: ["master"]
schedule:
- cron: '30 20 * * *'
jobs:
semgrep:
name: Semgrep
runs-on: [ubuntu-latest]
container:
image: returntocorp/semgrep
steps:
- uses: actions/[email protected]
- name: Run semgrep
run: semgrep ci
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

workflow_status:
runs-on: [ ubuntu-latest ] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner
name: Update Status Check
needs: [ semgrep ]
if: always()
env:
githubCommit: ${{ github.event.pull_request.head.sha }}
steps:
- name: Set github commit id
run: |
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "schedule" ]; then
echo "githubCommit=${{ github.sha }}" >> $GITHUB_ENV
fi
exit 0
- name: Failed
id: failed
if: (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && github.ref != 'refs/heads/master'
run: |
echo 'Failing the workflow for github security status check.'
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \
-d '{ "state" : "failure" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }}
exit 1
- name: Success
if: steps.failed.conclusion == 'skipped' || github.ref != 'refs/heads/master'
run: |
echo 'Status check has passed!'
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \
-d '{ "state" : "success" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }}
exit 0
5 changes: 5 additions & 0 deletions system/library/razorpay/razorpay-sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
composer.lock
phpunit.xml
vendor/
reports/
**/.DS_Store
Empty file.
45 changes: 45 additions & 0 deletions system/library/razorpay/razorpay-sdk/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
dist: precise
language: php
php:
- 7.3
- 7.4
- 8.0
- 8.1

install: composer install
before_script:
- cp phpunit.xml.dist phpunit.xml
# These two are required in the build step for non-composer-tests
- mkdir -p libs
- cd libs && wget https://github.com/rmccue/Requests/archive/v2.0.4.zip -O requests.zip && unzip requests.zip && rm requests.zip && cd ..
- rm -rf libs/Requests-2.0.4/examples libs/Requests-2.0.4/docs libs/Requests-2.0.4/bin libs/Requests-2.0.4/tests
script:
# Run a syntax validation check on all PHP files
- find . -path ./vendor -prune -o -iname '*.php' |xargs -n1 php -l
- ./vendor/bin/phpunit

notifications:
slack:
secure: fLT1x7BCXi8+sP1Qk1lP74+60JIBCw2clUTSOmB0OuoQGWYIJ4qelKcGH5FFsADGuC1GX2pf0fKRiLdavVrGpBkD4MGFPpyYKPYb0S/FyArN3PjdaNvAqE1VgQCtKkbugP5bHH9bp631+lo2EGQVLWTjlwiijWbCEyDu3L0YVMY=
# We are doing the releases for non-composer folks
# So this includes the vendor directory
before_deploy:
- echo $TRAVIS_TAG > version.txt
- cat release.txt |zip -r@ "razorpay-php.zip"
deploy:
provider: releases
# Otherwise, we lose the vendor/ directory
skip_cleanup: true
api_key:
secure: bHcu1jUASH6aVSD1LmzXdjQC4hc0o8EBbVs9X8e5j+/OC7+UuBBRu+jh6gQje/XWu9Nj1W2LkWhv0IKX1tJbcs0uRstggx+xC0ZayRzkscsqErqeM4WeyJjxe5ewb2eeGujtl9+WWFB3wpUQJtxXaaPuGYtroYGGYuI23wzKN4A=
# travis doesn't support multi file deployes yet, not that we need them
file: razorpay-php.zip
on:
# Only do the release for one build every tag
php: 7.3
# GitHub refuses to accept releases that are not tagged
tags: true
# Allow builds for non-master branches as well
all_branches: true
# Only do the releases if the repo is not a fork
repo: razorpay/razorpay-php
Loading
Loading