hps / heartland-woocommerce-plugin

Secure Submit Plugin for WooCommerce
GNU General Public License v2.0
13 stars 14 forks source link

Can't Process Payments from Dashboard #184

Closed tflight closed 2 years ago

tflight commented 2 years ago

If a customer has a saved payment method, it cannot be used to process payments from the Dashboard. Scenario: User has a saved payment method visible at /my-account. An Administrator can create a new order from the WordPress Dashboard --> WooCommerce --> Orders --> Add order. The order by default will have a 'Pending payment' Status. Under 'Order Actions' the plugin has added both 'Capture credit card authorization' and 'Capture MasterPass authorization', but neither work to process a payment for the order.

WordPress 6.0.1 WooCommerce 6.8.0 WooCommerce SecureSubmit Gateway 2.0.2 Storefront theme by WooCommerce 4.1.2 (tested against other default WP themes and they have the same issue)

The 'Capture credit card authorization' option results in the following fatal error:

Fatal error: Uncaught Exception: Get needs a transactionId
in /public_html/wp-content/plugins/woocommerce-securesubmit-gateway/classes/includes/src/Abstractions/HpsBuilderAbstract.php on line 99

Call stack:

HpsBuilderAbstract::validate()
wp-content/plugins/woocommerce-securesubmit-gateway/classes/includes/src/Abstractions/HpsBuilderAbstract.php:38
HpsBuilderAbstract::execute()

wp-content/plugins/woocommerce-securesubmit-gateway/classes/includes/src/Services/Fluent/Gateway/Credit/HpsCreditServiceGetBuilder.php:30
HpsCreditServiceGetBuilder::execute()

wp-content/plugins/woocommerce-securesubmit-gateway/classes/class-wc-gateway-securesubmit.php:286
WC_Gateway_SecureSubmit::isTransactionActiveOnGateway()

wp-content/plugins/woocommerce-securesubmit-gateway/classes/class-wc-gateway-securesubmit.php:187
WC_Gateway_SecureSubmit::process_capture()

wp-includes/class-wp-hook.php:307
WP_Hook::apply_filters()

wp-includes/class-wp-hook.php:331
WP_Hook::do_action()

wp-includes/plugin.php:476
do_action()

wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php:132
WC_Meta_Box_Order_Actions::save()

wp-includes/class-wp-hook.php:307
WP_Hook::apply_filters()

wp-includes/class-wp-hook.php:331
WP_Hook::do_action()

wp-includes/plugin.php:476
do_action()

wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php:269
WC_Admin_Meta_Boxes::save_meta_boxes()

wp-includes/class-wp-hook.php:309
WP_Hook::apply_filters()

wp-includes/class-wp-hook.php:331
WP_Hook::do_action()

wp-includes/plugin.php:476
do_action()

wp-includes/post.php:4673
wp_insert_post()

wp-includes/post.php:4775
wp_update_post()

wp-admin/includes/post.php:426
edit_post()

wp-admin/post.php:227
securesubmit-buildmaster commented 2 years ago

Hi @tflight,

The two capture methods you referenced are meant to be used in conjunction with the "authorize" option for the "Payment Action" setting for our plugin. Generally, when the payment action is set to "authorize", after a customer places an order an admin would later use one of the capture methods to capture (finalize) that earlier authorization. The capture methods will not function correctly in the way you mentioned.

Thank you for bringing this scenario to our attention though. We'll explore changing the plugin's handling so that it offers a useful error response in the future.

tflight commented 2 years ago

Thanks. So is there any way for an Admin to create an order on behalf of a customer and charge their saved card?

securesubmit-buildmaster commented 2 years ago

No, that is not possible. You're able to create an order and even email the order details to the user/customer so that they may pay for the order (using a saved card or a new payment method), but it isn't possible to perform that step on behalf of your customer.