ccv / ccvonlinepayments-woocommerce Goto Github PK
View Code? Open in Web Editor NEWOfficial CCV Payment Services plugin for WooCommerce
License: MIT License
Official CCV Payment Services plugin for WooCommerce
License: MIT License
By default all orders are set to "on-hold" with this plugin. They should stay in a "pending" state until the payment is processed. If the payment was not completed successfully or was declined by the customer, the order should be set to "failed". That way the payment can be restarted.
An annoying side effect of this is when a user is redirected with a failed payment, that a thank you page is presented. For Woocommerce "on-hold" means that the order was successful but the payment needs to be manually checked by the store owner. In the case of online payments the customer (un-)deliberately cancels/fails the payment and needs to be able to retry this, without creating a new order from scratch.
For more information about the correct status flow in Woocommerce:
https://docs.woocommerce.com/document/managing-orders/
https://docs.woocommerce.com/document/managing-orders/#troubleshooting
PS: It seems to me that the example gateway for bank transfers, provided by Woocommerce, is used as a starting point for this plugin. This is not correct for online payments like bancontact, mastercard, paypal, ...
For inspiration you could take a look at the plugin provided by Mollie
https://github.com/mollie/WooCommerce
Wordpress 5.8.2 with WooCommerce 5.9.0,
CCV Online Payments for Woocommerce version 1.3.0
WooCommerce Sequential Order Numbers version Versie: 1.9.5 | Door SkyVerge
Pugin works, but we want a sequential order nummer and not the post ID's, thats why we installed an extra plugin for sequential order numbers, after plugin is installed every new order gives a page with a critical error
url: http://192.168.1.53/wc-api/ccvonlinepayments_return/?order=22&key=wc_order_fGf1NIW02aoQy&payment_id=8
(my locale test server)
_post_meta table, has a extra entry with ordernumber
it seems that the CCV plugin cant find the correct orderID
The cart is always emptied when starting a new payment. When users go back to the webshop with the back button of the browser they will see an empty cart and will need to start all over again.
The cart should only be emptied when the payment was marked as completed. That way users will be able to restart payments without having to search for their products in the webshop again.
in WC_CcvOnlinePayments_Gateway.php there is this section:
$woocommerce->cart->empty_cart()
This issue is probably linked to #1 where the wrong assumption is made that every payment is a bank transfer that needs to be manually checked.
This plugin throws some exceptions when a visitor tries to checkout without creating an account.
In WC_CcvOnlinePayments_Gateway.php
there is this section:
/** @var WP_User $userData */
$userData = get_userdata($order->get_customer_id());
$paymentRequest->setAccountInfoAccountIdentifier($order->get_customer_id());
$paymentRequest->setAccountInfoAccountCreationDate(DateTime::createFromFormat('Y-m-d H:i:s', $userData->user_registered));
$paymentRequest->setAccountInfoEmail($userData->user_email);
New visitors don't have a user account connected. So $order->get_customer_id(()
will return "0" by default.
This results in $userData
to be blank and $userData->user_registered
to fail.
We've temporarily hotfixed this in our application like this:
/** @var WP_User $userData */
$userData = get_userdata($order->get_customer_id());
if($userData) {
$paymentRequest->setAccountInfoAccountIdentifier($order->get_customer_id());
$paymentRequest->setAccountInfoAccountCreationDate(DateTime::createFromFormat('Y-m-d H:i:s', $userData->user_registered));
$paymentRequest->setAccountInfoEmail($userData->user_email);
}
This needs a permanent solution.
Side question: Is there a particular reason this information needs to be part of the payment processing? All the information below seems superfluous:
"accountInfo" => [
"accountIdentifier" => $request->getAccountInfoAccountIdentifier(),
"accountCreationDate" => $request->getAccountInfoAccountCreationDate(),
"accountChangedDate" => $request->getAccountInfoAccountChangeDate(),
"email" => $request->getAccountInfoEmail(),
"homePhoneNumber" => $request->getAccountInfoHomePhoneNumber(),
"homePhoneCountry" => $request->getAccountInfoHomePhoneCountry(),
"mobilePhoneNumber" => $request->getAccountInfoMobilePhoneNumber(),
"mobilePhoneCountry" => $request->getAccountInfoMobilePhoneCountry(),
],
I got a fatal error on the function "key_is_valid" after payment redirection.
Our WordPress is setup as multisite, maybe the issue come from there. I had another issue: the "ccvonlinepayments_payments" table was not created for other websites (only on the primary), I resolve it by creating it manually.
Here is the error:
Fatal error: Uncaught Error: Call to a member function key_is_valid() on bool in /wp-content/plugins/ccvonlinepayments/WC_CCVOnlinePayments.php:94 Stack trace: #0 /wp-content/plugins/ccvonlinepayments/WC_CCVOnlinePayments.php(71): WC_CCVOnlinePayments::handleCallback() #1 /wp-includes/class-wp-hook.php(292): WC_CCVOnlinePayments::doReturn('') #2 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array) #3 /wp-includes/plugin.php(484): WP_Hook->do_action(Array) #4 /wp-content/plugins/woocommerce/includes/class-wc-api.php(161): do_action('woocommerce_api...') #5 /wp-includes/class-wp-hook.php(292): WC_API->handle_api_requests(Object(WP)) #6 /wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array) #7 /wp-includes/plugin.php(551): WP_Hook->do_action(Array) #8 /wp-includes/class-wp.php(388): do_action_ref_array('parse_request', Arr in /wp-content/plugins/ccvonlinepayments/WC_CCVOnlinePayments.php on line 94
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.