Skip to content

Commit

Permalink
Added response code for IPN notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoshualewis committed Apr 15, 2021
1 parent b7a9ad2 commit b32ccf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: BitPay Checkout for WooCommerce
* Plugin URI: https://www.bitpay.com
* Description: Create Invoices and process through BitPay. Configure in your <a href ="admin.php?page=wc-settings&tab=checkout&section=bitpay_checkout_gateway">WooCommerce->Payments plugin</a>.
* Version: 3.44.2103
* Version: 3.45.2104
* Author: BitPay
* Author URI: mailto:[email protected]?subject=BitPay Checkout for WooCommerce
*/
Expand Down Expand Up @@ -720,6 +720,7 @@ function bitpay_checkout_ipn(WP_REST_Request $request)
else :
$order->add_order_note( 'BitPay Invoice ID: <a target = "_blank" href = "' . BPC_getBitPayDashboardLink( $bitpay_checkout_endpoint, $invoiceID ) . '">' . $invoiceID . '</a> has changed to Confirmed. The order status has not been updated due to your settings.' );
endif;
http_response_code(200);
break;

case 'invoice_completed':
Expand All @@ -746,12 +747,14 @@ function bitpay_checkout_ipn(WP_REST_Request $request)
else :
$order->add_order_note( 'BitPay Invoice ID: <a target = "_blank" href = "' . BPC_getBitPayDashboardLink( $bitpay_checkout_endpoint, $invoiceID ) . '">' . $invoiceID . '</a> has changed to Completed. The order status has not been updated due to your settings.' );
endif;
http_response_code(200);
break;
case 'invoice_failedToConfirm':
if ($orderStatus->data->status == 'invalid'):
$order->add_order_note('BitPay Invoice ID: <a target = "_blank" href = "' . BPC_getBitPayDashboardLink($bitpay_checkout_endpoint, $invoiceID) . '">' . $invoiceID . '</a> has become invalid because of network congestion. Order will automatically update when the status changes.');
$order->update_status('failed', __('BitPay payment invalid', 'woocommerce'));
endif;
http_response_code(200);
break;

case 'invoice_expired':
Expand All @@ -764,19 +767,19 @@ function bitpay_checkout_ipn(WP_REST_Request $request)
if($bitpay_checkout_order_expired_status == 1):
$order->update_status($order_status, __('BitPay payment invalid', 'woocommerce'));
endif;
http_response_code(200);
endif;




break;

case 'invoice_refundComplete':


case 'invoice_refundComplete':
$order->add_order_note('BitPay Invoice ID: <a target = "_blank" href = "' . BPC_getBitPayDashboardLink($bitpay_checkout_endpoint, $invoiceID) . '">' . $invoiceID . ' </a> has been refunded.');
$order->update_status('refunded', __('BitPay payment refunded', 'woocommerce'));
break;
http_response_code(200);
default:
break;
}
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: bitcoin, ether, ripple, bitcoin cash, ERC20, payments, bitpay, cryptocurre
Requires at least: 4.9
Tested up to: 5.6
Requires PHP: 5.5
Stable tag: 3.44.2103
Stable tag: 3.45.2104
License: MIT License (MIT)
License URI: https://github.com/bitpay/bitpay-checkout-for-woocommerce/blob/master/LICENSE

Expand Down Expand Up @@ -111,6 +111,9 @@ You can contact our support team via the following form https://bitpay.com/reque

== Changelog ==

= 3.45.2104 =
* Added response code for IPN notifications

= 3.44.2103 =
* Updated Confirmed/Completed options with WooCommerce functionality to complete an order in the system (if set)

Expand Down

0 comments on commit b32ccf5

Please sign in to comment.