=== Bayarcash WooCommerce ===
Contributors: webimpian
Tags: FPX, DuitNow, Direct Debit, DuitNow QR, Credit Card, GrabPay
Requires at least: 5.6
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 4.4.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.txt

Accept online payment & QR from Malaysia. Currently, Bayarcash support FPX, Direct Debit, DuitNow, Credit Card, Boost, GrabPay, ShopeePay, Touch 'n Go and more payment channels.

== Description ==

Bayarcash is a Malaysia online payment platform that support FPX, Direct Debit, DuitNow, Credit Card, e-Wallets and cross-border payment channels.

Fully supports WooCommerce Subscription products with Direct Debit functionality. [See more](https://woocommerce.com/products/woocommerce-subscriptions/)

== How it works ==

This plugin will connect to Bayarcash endpoint to secure payment processing between bank & ewallet in Malaysia.

Please visit our website [https://bayarcash.com/](https://bayarcash.com/) for terms of use and privacy policy, or email to hai@bayarcash.com for any inquiries.

== Features ==

- One-off payment via FPX (CASA & credit card account)
- Payment via FPX Line of Credit
- Payment via Credit & Debit Card
- Payment via DuitNow Online Banking/Wallets
- Payment via DuitNow QR
- Payment via Touch 'n Go eWallet
- Payment via Boost PayFlex & Wallet
- Payment via GrabPay & PayLater by Grab
- Payment via SPayLater & ShopeePay
- Payment via Alipay, WeChat Pay & PromptPay
- Support cross-border payment via DuitNow QR, QRIS Indonesia & NETS Singapore
- Weekly & monthly recurring payment via Direct Debit. Deduction happen automatic directly via bank account (flat rate fees).
- Support multiple Bayarcash account per website
- Copy credentials across payment channels for quick setup
- Shariah-compliance payment gateway

Register as [**Bayarcash merchant here**](https://bayarcash.com/register/)

== Requirements ==

To use Bayarcash WooCommerce requires minimum:

- PHP 7.4
- WordPress 5.6
- WooCommerce Plugin

== Installation ==

= Demo =

[Test with WordPress](https://tastewp.com/new/?pre-installed-plugin-slug=bayarcash-wc&pre-installed-plugin-slug=woocommerce&redirect=admin.php%3Fpage%3Dwc-settings%26tab%3Dcheckout%26section%3Dbayarcash-wc%26ni%3Dtrue)

Make sure that you already have WooCommerce plugin installed and activated.

1. Login to your **WordPress Dashboard**
2. Go to **Plugins > Add New**
3. Search **Bayarcash WC** and click **Install**
4. **Activate** the plugin through the **Plugins** screen in WordPress

= Updating =

While our plugin supports seamless automatic updates, we strongly advise creating a full backup of your site before any update process. This precautionary measure ensures the safety of your data and allows for easy restoration if needed.

== Screenshots ==
* Explore all payment options available with Bayarcash for your customers.
* Enter your Personal Access Token (PAT) and API Secret Key, then save to start using Bayarcash.
* Let customers pay easily using Bayarcash at checkout.
* Track payments with WooCommerce order notes.
* Accept recurring payments using direct debit for WooCommerce Subscriptions.
* Set up weekly or monthly direct debit payments for subscriptions.
* Accept payments through FPX 2.0 (DuitNow Online Banking).
* View automatic subscription payment updates in your order notes.

== Frequently Asked Questions ==

= Where can I register as Bayarcash merchant? =
You can register as merchant [here](https://bayarcash.com/register/). We accept organisation that has active SSM certificate, ROS for non-governmental organization (NGO), state-certified for madrasah & sekolah tahfiz and yayasan.

= What does it mean by shariah-compliance payment gateway? =
Please note that in order for us to comply with our shariah-compliance policy, we do not support organisation involved in:

- The production or sale of pork, alcohol and alcohol-related activities, non-halal food and beverages, tobacco product (including e-cigarettes), drug paraphernalia, pornography, guns, and other arms
- Gaming and betting
- Shariah non-compliant entertainment
- Conventional insurance
- Jihadist or terrorist activities
- Fraud and corruption organization

[Click here](https://bayarcash.com/wp-content/uploads/sites/2/2022/09/elzar-bayarcash.jpeg) to view shariah-certificate endorsement by our official advisor Dr. Zaharuddin Abd Rahman from Elzar Shariah Solutions & Advisory.

= Where do I report security bugs found in this plugin? =

Please report security bugs found in the source code of the Bayarcash WooCommerce plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/f68f06b3-c3a8-41dc-a12b-c0678c4ae3f1). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.

== Changelog ==

= 4.4.0 =
* Added 8 new payment channels: Credit & Debit Card, Alipay, WeChat Pay, PromptPay, Touch 'n Go eWallet, Boost PayFlex & Wallet, GrabPay, PayLater by Grab
* Renamed "Credit Card Account" to "FPX Line of Credit" for clarity
* Added "Copy Credentials" feature to quickly copy PAT, Secret Key, Portal Key and Sandbox mode across channels
* Added auto-verify PAT token on blur with whitespace auto-sanitize
* Added payment channel availability check per portal key with warning notice

= 4.3.14 =
* Security: Removed unauthorized order status change in pre-transaction callback

= 4.3.13 =
* Security: Added nonce verification to admin AJAX settings handler
* Security: Added subscription ownership check to prevent unauthorized cancellation
* Improved validation error messages with specific details instead of generic error
* Updated Bayarcash PHP SDK to 2.1.2

= 4.3.12 =
* Fixed checkout fee not applied on first page load for WooCommerce Blocks checkout
* Optimized payment method change detection to reduce unnecessary API calls

= 4.3.11 =
* Fixed minor bugs

= 4.3.10 =
* Fixed compatibility issue with product page display

= 4.3.9 =
* Fixed Direct Debit not detecting 2nd, 3rd, and subsequent deductions
* Improved duplicate processing prevention for renewal orders

= 4.3.8 =
* Fixed Vue.js compatibility issues with certain themes and plugins

= 4.3.7 =
* Fix bug

= 4.3.6 =
* Improve direct debit error display
* Added support for multiple merchant accounts of Bayarcash for DuitNow payment channels

= 4.3.5 =
* Added support for {total} placeholder in payment button text
* Button text will fall back to default WooCommerce text if custom text is empty

= 4.3.4 =
* Improved the cron requery process
* Saved the payment_intent ID for use in the requery process.

= 4.3.3 =
* Bug: Fixed checkout fee calculation to properly handle coupon discounts

= 4.3.2 =
* Added support for multiple merchant accounts of Bayarcash for FPX payment channels

= 4.3.1 =
* Resolved compatibility issues with the SeedProd plugin

= 4.3.0 =
* Implemented WooCommerce Checkout Block compatibility
* Enabled multi-channel functionality in block checkout
* Integrated payment gateway fee calculations with checkout blocks

= 4.2.9 =
* Added validation for subscription billing intervals to only allow every week and every month subscriptions

= 4.2.8 =
* Added error handling for non-MYR currency transactions

= 4.2.7 =
* Fixed bug related to woocommerce subscription

= 4.2.6 =
* New payment option: NETS Singapore for seamless transactions
* Added customizable logo size settings for each payment method
* Added customizable fee name for payment processing charges

= 4.2.5 =
* Gateway Fees: Added option to combine flat rate and percentage
* Buy Now, Pay Later (BNPL): New promotional label on catalog and product pages
* SPayLater: Added warning for orders over RM 1,000

= 4.2.4 =
* Fixed error when changing order status
* Enhanced retrieve portal list display all list available

= 4.2.3 =
* Fixed compatibility issues with PHP 7.4 and added full support for this version

= 4.2.2 =
* Improve payment option logo image

= 4.2.1 =
* Improve order note

= 4.2.0 =
* Added support for DuitNow QR, SPayLater,Boost PayFlex & QRIS payment methods
* Added fallback email option to ensure transaction processing when customer email is disabled or unavailable at checkout
* Implemented configurable gateway fees for different payment methods
* Introduced payment gateway restriction options for each payment method
* Added option to customize checkout logo display for improved brand visibility

= 4.1.2 =
* Iteration on payment channel logos

= 4.1.1 =
* Fix small bugs

= 4.1.0 =
* Integrated support for WooCommerce Subscriptions, enabling Direct Debit payments for subscription-based products
* Enhanced phone number processing for improved data transmission to Bayarcash
* Add custom field for id verification in Funnelkit checkout for subscription-based products
* Refined error messaging to provide more user-friendly and informative notifications

= 4.0.0 =
* Added support for DuitNow and Line of Credit payment methods
* Implemented new Bayarcash SDK for improved API interactions
* Streamlined token verification with Vue.js, reducing admin page bloat
* Enhanced admin settings page with dynamic portal key selection
* Upgraded cron requery function for better performance
* Added checksum verification for increased security
* Improved error handling and logging for individual payment methods
* Refactored code for better structure and maintainability

= 3.0.0 =
* Refactoring and code improvements.

= 2.0.19 =
* Prevent the plugin from accidentally changing the order status that has already been paid (like on hold, processing, completed, etc) back to failed after the requery process to Bayarcash Console.
* Add parameter raw_website containing order data to the transaction request form. 

= 2.0.18 =
* Add security measure to ensure request received from server is not tampered

= 2.0.17 =
* Comment out cron status logger to reduce WC log verbosity
* Add prefix BC_WooCommerce_FPX to file names and class names
* Change cron implementation to execute in actionable class instance instead of relying on http request triggers
* Update plugin identifier as bayarcash instead of generic fpx
* Optimize cron re-query by only only querying orders that have pending status, payment_method of bayarcash/fpx with return result limit capped at 30 orders
* Fix access non-existent method get_transaction_order_no() to get_order_no()

= 2.0.16 =
* Fix order note for normal callback return, mapped buyer name correctly 

= 2.0.15 =
* Fix re-query order status update respond mapping from console.bayar.cash 

= 2.0.14 =
* Handle other payment response that is obtain when user complete the purchase-payment cycle correctly
* Split database handler for different responses

= 2.0.13 =
* Fix missing variable argument on method and invocation

= 2.0.12 =
* Add if WC Order Status Manager Plugin active use plugin order status def.
* Refactor check_exchange_no_can_be_add into separate operations
* Remove JS limit checkout button clicks code

= 2.0.11 =
* Prevent abnormal fpx_transaction_exchange_number from being to stored
* Add js implementation to prevent user from multiple requests to server
* If order status already pending don't add transaction exchange number

= 2.0.10 = 
*  Fix unpaid transaction redirect back to success thank you page

= 2.0.9 = 
*  Fix Transaction ID not saved to wp_postmeta, add wc logger

= 2.0.8 = 
*  Add comments and DocBlock

= 2.0.7 = 
*  Filter server order info, only updated previous selected order statuses

  The order statuses are :
  - pending
  - canceled

= 2.0.6 = 
* Add FPX Response Sanitizer,Validator,better order no duplicate handling

= 2.0.5 =
* Remove hardcode set order to processing status when success pay

= 2.0.4 =
* Change object property mapping to get correct order no

= 2.0.3 =
* Change cron interval to 5 minutes
* Fix add duplicated order notes
* Update DocBlock
* Add GPL-3.0-or-later license reference

= 2.0.2 =
* Fix variable fpx_output_data_primary to use the latest output returned from the payment portal.
* Remove trailing comma at Authorization: Bearer array.
* Remove payment type description at both back-end and front-end.
* Fix duplicate missing data detection, this->portal_key at the back-end. The 1st should detect missing bearer token, and the 2nd should detect missing Payment Portal key.
* Remove Cancel button at the checkout page after buyer confirm choosing FPX, add auto-click features to the submit button, and immediately display the page loader while contacting the Payment Portal.
* Add customizable payment channel title and payment channel description.

= 2.0.1 =
* Replace parameter s3a with RefNo for more user friendly submission request.
* Add parameter payment_gateway = 1 to the transaction request form.
* Re-order parameters for order payment transaction data comparison between the payment portal and shopping cart.

= 2.0.0 =
* Replace combination of FPX Payment Portal Auth User and Auth Password with Bearer Token for Payment Portal user authentication.
* Update API_client_version to v2.0.0
* Add 'Accept: application/json' and 'Authorization: Bearer ' .$bearer_token to cURL request for communication to the payment portal.

= 1.0 =
* Initial release.
