Skip to content

Instantly share code, notes, and snippets.

View vanbo's full-sized avatar

Ivan Andreev vanbo

View GitHub Profile
@vanbo
vanbo / wc-paysafe-hosted-api-response-actions
Created August 9, 2019 09:15
WooCommerce Paysafe Hosted API Response Actions
/**
* Response actions
*
* do_action( 'wc_paysafe_payment_response_processed', $order, $response );
* do_action( 'wc_paysafe_redirect_hosted_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_declined_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_cancelled_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_errored_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_pending_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_settlement_response_processed', $response, $this, $order );
@vanbo
vanbo / wc-paysafe-checkoutjs-dynamic-account-id
Last active January 17, 2020 10:20
WooCommerce Paysafe Checkout API Dynamic Account ID
add_filter( 'wc_paysafe_checkoutjs_account_id', 'prefix_paysafe_checkout_api_account_id', 10, 3 );
/**
* @param string $account_id The default Account ID for the type
* @param \WcPaysafe\Api\Data_Sources\Order_Source|\WcPaysafe\Api\Data_Sources\User_Source $data_source
* @param string $payment_type The type of payment to be processed.
* Possible values: cards|directdebit|interac|iframe
* Note : The $payment_type values explained:
* 1. cards - Cards API transaction
* 2. directdebit - Direct Debit API transaction
* 3. interac - Interac transaction - not yet supported
@vanbo
vanbo / wc-trustcommerce-modify-payment-request
Last active February 1, 2021 07:58
WooCommerce TrustCommerce Modify Payment Request
/**
* NOTЕ: Add the code to your "themes\child-theme\functions.php" file
*/
add_filter( 'wc_trustcommerce_process_single_payment_request', 'prefix_modify_payment_request', 10, 3 );
function prefix_modify_payment_request( $request, $order, $gateway ) {
// You have access to all request properties right before a payment request is sent.
// Disable the AVS
if ( isset( $request['avs'] ) ) {
@vanbo
vanbo / psigate-show-html-api-only
Created May 18, 2018 08:06
Psigate Show Only HTML API Option
add_action( 'wp_footer', 'prefix_hide_the_card_form' );
function prefix_hide_the_card_form() {
// Checkout or the Pay page
if ( is_checkout() || is_checkout_pay_page() ) {
?>
<style>
.payment_method_psigate div#credit_card_info {
display: none !important;
}
@vanbo
vanbo / wc-paysafe-add-account-based-on-order-currency
Last active September 9, 2019 08:54
WC Paysafe: Add account number based on order currency
// Normal order
add_filter( 'wc_paysafe_request_params', 'prefix_add_account_number', 10, 2 );
// Subscriptions/Pre-Orders order
add_filter( 'wc_paysafe_addons_request_params', 'prefix_add_account_number', 10, 2 );
/**
* @param $params
* @param WC_Order $order
*
* @return mixed
*/