Skip to content

Commit

Permalink
Merge pull request #1 from iamsayan/develop
Browse files Browse the repository at this point in the history
v1.1.6
  • Loading branch information
Sayan Datta committed Jul 15, 2022
2 parents 124da4e + 94b99a5 commit 16f5968
Show file tree
Hide file tree
Showing 22 changed files with 1,006 additions and 565 deletions.
17 changes: 17 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/.wordpress-org
/.git
/.github
/node_modules

LICENSE
_config.yml
.distignore
.gitignore
CHANGELOG.md
composer.json
composer.lock
package.json
package-lock.json
phpcs.xml
README.md
todo
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: https://www.paypal.me/iamsayan
custom: https://rzp.io/l/Bq3W5pr
File renamed without changes
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to WordPress.org

on:
release:
types: [published]

jobs:
deploy:
name: New release
runs-on: ubuntu-latest
environment: wp.org plugin

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: rzp-woocommerce

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,72 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.1.6
Release Date: July 15, 2022

* Improved: Code Quality.
* WordPress tested upto v6.0.
* WC Tested upto v6.7.

## 1.1.5
Release Date: July 25, 2021

* Improved: Localhost check.
* Support for old WC Version (2.0 to 3.1)
* WC Tested upto v5.5 and v5.6.

## 1.1.4
Release Date: June 16, 2021

* Added: Order Number instead of Order ID.
* WC Tested upto v5.4.

## 1.1.3
Release Date: May 23, 2021

* Added: Auto Enable Webhook on plugin settings save.
* Fixed: Bug related to new API.

## 1.1.2
Release Date: January 11, 2021

* Added: Option to switch between Standard and Legacy Payment Links API. If your Razorpay Account was created on or after 1 September 2020 and Legacy API is not working for you, please use Standrard API. Legacy API will be officially deprecated by Razorpay on 31st March, 2021.

## 1.1.1
Release Date: December 14, 2020

* WordPress tested upto v5.6.
* WC Tested upto v4.8.

## 1.1.0
Release Date: November 7, 2020

* Fixed: Partial refund from Razorpay Dashbaord causing multiple refund events.
* WC Tested upto v4.6.

## 1.0.9
Release Date: August 15, 2020

* Fixed: Webhook Issue.
* WC Tested upto v4.4.

## 1.0.8
Release Date: July 24, 2020

* Fixed: Redirection issue due to recent Razorpay API Chnages.

## 1.0.7
Release Date: July 20, 2020

* WC Tested upto v4.3.

## 1.0.6
Release Date: June 9, 2020

* Tweak: Cart will not be cleared if payment is not actually made.
* Fixed: Redirection issue.
* WC Tested upto v4.2.0

## 1.0.5
Release Date: May 24, 2020

Expand Down
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
![alt text](https://github.com/iamsayan/rzp-woocommerce/raw/master/banner.png "Plugin Banner")
![Razorpay Payment Links for WooCommerce](.github/banner.png "Plugin Banner")

# Razorpay Gateway for WooCommerce
# Razorpay Payment Links for WooCommerce

This is the Un-Official Razorpay Payment Gateway plugin for WooCommerce. Allows you to accept Credit Cards, Debit Cards, Netbanking, Wallets, and UPI Payments with the WooCommerce plugin.

[![WP compatibility](https://plugintests.com/plugins/rzp-woocommerce/wp-badge.svg)](https://plugintests.com/plugins/rzp-woocommerce/latest) [![PHP compatibility](https://plugintests.com/plugins/rzp-woocommerce/php-badge.svg)](https://plugintests.com/plugins/rzp-woocommerce/latest)

## Description

### Razorpay Gateway for WooCommerce
### Razorpay Payment Links for WooCommerce

This is the Un-Official Razorpay Payment Gateway plugin for WooCommerce. Allows you to accept Credit Cards, Debit Cards, Netbanking, Wallets, and UPI Payments with the WooCommerce plugin.

Expand All @@ -32,7 +32,7 @@ It uses a Razorpay's Payment Link API integration, allowing the customer to pay
* Detailed Payment process Log via WooCommerce Logger.
* Lots of filters available to customize the output.

Like Razorpay Gateway for WooCommerce plugin? Consider leaving a [5 star review](https://wordpress.org/support/plugin/rzp-woocommerce/reviews/?rate=5#new-post).
Like Razorpay Payment Links for WooCommerce plugin? Consider leaving a [5 star review](https://wordpress.org/support/plugin/rzp-woocommerce/reviews/?rate=5#new-post).

### Compatibility

Expand All @@ -49,13 +49,13 @@ Like Razorpay Gateway for WooCommerce plugin? Consider leaving a [5 star review]

### From within WordPress
1. Visit 'Plugins > Add New'.
1. Search for 'Razorpay Gateway for WooCommerce'.
1. Activate Razorpay Gateway for WooCommerce from your Plugins page.
1. Search for 'Razorpay Payment Links for WooCommerce'.
1. Activate Razorpay Payment Links for WooCommerce from your Plugins page.
1. Go to "after activation" below.

### Manually
1. Upload the `rzp-woocommerce` folder to the `/wp-content/plugins/` directory.
1. Activate Razorpay Gateway for WooCommerce plugin through the 'Plugins' menu in WordPress.
1. Activate Razorpay Payment Links for WooCommerce plugin through the 'Plugins' menu in WordPress.
1. Go to "after activation" below.

### After activation
Expand All @@ -72,6 +72,22 @@ Yes. You can access this from 'WooCommerce > Settings > Payments > Razorpay Paym

Go to 'WooCommerce > Settings > Payments > Razorpay Payment Gateway', enable/disable options as per your need and save your changes.

#### How to use webhook? What webhooks are supported? =

Go to Razorpay 'Dashboard > Settings > Webhooks'. Enter the URL from plugin settings page and create and copy webhook secret key and paste it to plugin settings and save changes. By Default this plugin supports only these two Webhooks: "payment.authorized" and "refund.created". If you want more webhooks supported, please feel free to contact me at hello@sayandatta.in or https://www.sayandatta.in/contact/ as it needs custom developmet.

#### How to send automatic payment reminder to customer, if customer does not make payment after initiating the payment procedure? =

It needs custom developement. Please contact me at hello@sayandatta.in or https://sayandatta.in/contact/.

#### I want to use Razorpay Web Integration like Automatic Checkout/Manual Checkout (On site Checkout - No Redirection) with webhooks? =

It needs custom developement. Please contact me at hello@sayandatta.in or https://sayandatta.in/contact/.

#### I want to customize the look of the default Razorpay Gateway like colors/text etc. How can I get this? =

It needs custom developement. Please contact me at hello@sayandatta.in or https://sayandatta.in/contact/.

#### Is this plugin compatible with any themes?

Yes, this plugin is compatible with any theme.
Expand Down
101 changes: 71 additions & 30 deletions includes/notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* The admin-facing functionality of the plugin.
*
* @package Razorpay Gateway for WooCommerce
* @package Razorpay Payment Links for WooCommerce
* @subpackage Includes
* @author Sayan Datta
* @license http://www.gnu.org/licenses/ GNU General Public License
Expand All @@ -13,52 +13,93 @@
add_action( 'admin_init', 'rzpwc_dismiss_rating_admin_notice' );

function rzpwc_rating_admin_notice() {
// Show notice after 360 hours (15 days) from installed time.
if ( rzpwc_plugin_get_installed_time() > strtotime( '-360 hours' )
|| '1' === get_option( 'rzpwc_plugin_dismiss_rating_notice' )
|| ! current_user_can( 'manage_options' )
|| apply_filters( 'rzpwc_plugin_hide_sticky_notice', false ) ) {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}

$dismiss = wp_nonce_url( add_query_arg( 'rzpwc_rating_notice_action', 'dismiss_rating_true' ), 'rzpwc_dismiss_rating_true' );
$no_thanks = wp_nonce_url( add_query_arg( 'rzpwc_rating_notice_action', 'no_thanks_rating_true' ), 'rzpwc_no_thanks_rating_true' ); ?>

<div class="notice notice-success">
<p><?php _e( 'Hey, I noticed you\'ve been using Razorpay Gateway for WooCommerce for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a <strong>5-star</strong> rating on WordPress? Just to help me spread the word and boost my motivation.', 'rzp-woocommerce' ); ?></p>
<p><a href="https://wordpress.org/support/plugin/rzp-woocommerce/reviews/?filter=5#new-post" target="_blank" class="button button-secondary"><?php _e( 'Ok, you deserve it', 'rzp-woocommerce' ); ?></a>&nbsp;
<a href="<?php echo $dismiss; ?>" class="already-did"><strong><?php _e( 'I already did', 'rzp-woocommerce' ); ?></strong></a>&nbsp;<strong>|</strong>
<a href="<?php echo $no_thanks; ?>" class="later"><strong><?php _e( 'Nope&#44; maybe later', 'rzp-woocommerce' ); ?></strong></a>
</div>
<?php
$show_rating = true;
if ( rzpwc_plugin_get_installed_time() > strtotime( '-10 days' )
|| '1' === get_option( 'rzpwc_plugin_dismiss_rating_notice' )
|| apply_filters( 'rzpwc/hide_sticky_rating_notice', false ) ) {
$show_rating = false;
}

if ( $show_rating ) {
$dismiss = wp_nonce_url( add_query_arg( 'rzpwc_notice_action', 'dismiss_rating' ), 'rzpwc_notice_nonce' );
$no_thanks = wp_nonce_url( add_query_arg( 'rzpwc_notice_action', 'no_thanks_rating' ), 'rzpwc_notice_nonce' ); ?>

<div class="notice notice-success">
<p><?php echo wp_kses_post( 'Hey, I noticed you\'ve been using Razorpay Payment Links for WooCommerce for more than 1 week – that’s awesome! Could you please do me a BIG favor and give it a <strong>5-star</strong> rating on WordPress? Just to help us spread the word and boost my motivation.', 'rzp-woocommerce' ); ?></p>
<p><a href="https://wordpress.org/support/plugin/rzp-woocommerce/reviews/?filter=5#new-post" target="_blank" class="button button-secondary" rel="noopener"><?php esc_html_e( 'Ok, you deserve it', 'rzp-woocommerce' ); ?></a>&nbsp;
<a href="<?php echo esc_url( $dismiss ); ?>" class="already-did"><strong><?php esc_html_e( 'I already did', 'rzp-woocommerce' ); ?></strong></a>&nbsp;<strong>|</strong>
<a href="<?php echo esc_url( $no_thanks ); ?>" class="later"><strong><?php esc_html_e( 'Nope&#44; maybe later', 'rzp-woocommerce' ); ?></strong></a></p>
</div>
<?php
}

$show_donate = true;
if ( rzpwc_plugin_get_installed_time() > strtotime( '-240 hours' )
|| '1' === get_option( 'rzpwc_plugin_dismiss_donate_notice' )
|| apply_filters( 'rzpwc/hide_sticky_donate_notice', false ) ) {
$show_donate = false;
}

if ( $show_donate ) {
$dismiss = wp_nonce_url( add_query_arg( 'rzpwc_notice_action', 'dismiss_donate' ), 'rzpwc_notice_nonce' );
$no_thanks = wp_nonce_url( add_query_arg( 'rzpwc_notice_action', 'no_thanks_donate' ), 'rzpwc_notice_nonce' ); ?>

<div class="notice notice-success">
<p><?php echo wp_kses_post( 'Hey, I noticed you\'ve been using Razorpay Payment Links for WooCommerce for more than 2 week – that’s awesome! If you like Razorpay Payment Links for WooCommerce and you are satisfied with the plugin, isn’t that worth a coffee or two? Please consider donating. Donations help me to continue support and development of this free plugin! Thank you very much!', 'rzp-woocommerce' ); ?></p>
<p><a href="https://rzp.io/l/Bq3W5pr" target="_blank" class="button button-secondary" rel="noopener"><?php esc_html_e( 'Donate Now', 'rzp-woocommerce' ); ?></a>&nbsp;
<a href="<?php echo esc_url( $dismiss ); ?>" class="already-did"><strong><?php esc_html_e( 'I already donated', 'rzp-woocommerce' ); ?></strong></a>&nbsp;<strong>|</strong>
<a href="<?php echo esc_url( $no_thanks ); ?>" class="later"><strong><?php esc_html_e( 'Nope&#44; maybe later', 'rzp-woocommerce' ); ?></strong></a></p>
</div>
<?php
}
}

function rzpwc_dismiss_rating_admin_notice() {
if( get_option( 'rzpwc_plugin_no_thanks_rating_notice' ) === '1' ) {
if ( get_option( 'rzpwc_plugin_dismissed_time' ) > strtotime( '-360 hours' ) ) {
return;
}
// Check for Rating Notice
if ( get_option( 'rzpwc_plugin_no_thanks_rating_notice' ) === '1'
&& get_option( 'rzpwc_plugin_dismissed_time' ) <= strtotime( '-14 days' ) ) {
delete_option( 'rzpwc_plugin_dismiss_rating_notice' );
delete_option( 'rzpwc_plugin_no_thanks_rating_notice' );
}

if ( ! isset( $_GET['rzpwc_rating_notice_action'] ) ) {
// Check for Donate Notice
if ( get_option( 'rzpwc_plugin_no_thanks_donate_notice' ) === '1'
&& get_option( 'rzpwc_plugin_dismissed_time_donate' ) <= strtotime( '-15 days' ) ) {
delete_option( 'rzpwc_plugin_dismiss_donate_notice' );
delete_option( 'rzpwc_plugin_no_thanks_donate_notice' );
}

if ( ! isset( $_REQUEST['rzpwc_notice_action'] ) || empty( $_REQUEST['rzpwc_notice_action'] ) ) {
return;
}

if ( 'dismiss_rating_true' === $_GET['rzpwc_rating_notice_action'] ) {
check_admin_referer( 'rzpwc_dismiss_rating_true' );
update_option( 'rzpwc_plugin_dismiss_rating_notice', '1' );
check_admin_referer( 'rzpwc_notice_nonce' );

$notice = sanitize_text_field( $_REQUEST['rzpwc_notice_action'] );
$notice = explode( '_', $notice );
$notice_type = end( $notice );
array_pop( $notice );
$notice_action = join( '_', $notice );

if ( 'dismiss' === $notice_action ) {
update_option( 'rzpwc_plugin_dismiss_' . $notice_type . '_notice', '1' );
}

if ( 'no_thanks_rating_true' === $_GET['rzpwc_rating_notice_action'] ) {
check_admin_referer( 'rzpwc_no_thanks_rating_true' );
update_option( 'rzpwc_plugin_no_thanks_rating_notice', '1' );
update_option( 'rzpwc_plugin_dismiss_rating_notice', '1' );
update_option( 'rzpwc_plugin_dismissed_time', time() );
if ( 'no_thanks' === $notice_action ) {
update_option( 'rzpwc_plugin_no_thanks_' . $notice_type . '_notice', '1' );
update_option( 'rzpwc_plugin_dismiss_' . $notice_type . '_notice', '1' );
if ( 'donate' === $notice_type ) {
update_option( 'rzpwc_plugin_dismissed_time_donate', time() );
} else {
update_option( 'rzpwc_plugin_dismissed_time', time() );
}
}

wp_redirect( remove_query_arg( 'rzpwc_rating_notice_action' ) );
wp_redirect( remove_query_arg( [ 'rzpwc_notice_action', '_wpnonce' ] ) );
exit;
}

Expand Down
Loading

0 comments on commit 16f5968

Please sign in to comment.