Skip to content

Instantly share code, notes, and snippets.

Ivan Andreev vanbo

Block or report user

Report or block vanbo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vanbo
vanbo / wc-paytrace-modify-overlay-settings
Last active Nov 21, 2019
WC Paysafe Modify Overlay settings
View wc-paytrace-modify-overlay-settings
/**
* Add the gist to your "theme/functions.php" file or any file loading with after the "theme/functions.php" file
*/
add_filter( 'wc_paysafe_checkoutjs_order_iframe_props', 'prefix_modify_overlay_parameters', 10, 3 );
/**
* @param array $parameters
* @param \WC_Order $order
* @param \WcPaysafe\Api\Checkoutjs\Service $service
*
@vanbo
vanbo / wc-paysafe-checkoutjs-automatically-open-form
Created Nov 15, 2019
wc-paysafe-checkoutjs-automatically-open-form
View wc-paysafe-checkoutjs-automatically-open-form
<script>
/**
* This is JavaScript code and it should be added to any file that will load it on the WooCommerce "Pay" Page
*
* The code will automatically start the Payment form without requiring the customer to click on the Pay button.
* Important: Keep in mind that if you allow Tokenization, the customer will not be allowed to choose to save their card or not
*/
(function ($) {
$(document).ready(function () {
var isPayPage = $('body').hasClass('woocommerce-order-pay');
@vanbo
vanbo / psigate-modify-api-urls
Created Sep 9, 2019
WC Psigate Modify API URLs
View psigate-modify-api-urls
// Modify XML-API test URL
add_filter( 'wc_psigate_xml_test_url', 'prefix_modify_xml_api_test_url' );
function prefix_modify_xml_api_test_url($url) {
// Put any url in the place of the example one
return 'https://staging.psigate.com:27989/Messenger/XMLMessenger';
}
// Modify Account Manager API test URL
add_filter( 'wc_psigate_manager_test_url', 'prefix_modify_account_manager_test_url' );
function prefix_modify_account_manager_test_url($url) {
@vanbo
vanbo / wc-trustcommerce-modify-token-payment-request
Created Aug 20, 2019
WooCommerce TrustCommerce Modify Token Payment Request
View wc-trustcommerce-modify-token-payment-request
add_filter( 'wc_trustcommerce_process_profile_payment_request_request', 'prefix_modify_token_payment_request', 10, 3 );
/**
* @param array $request
* @param WC_Order $order
* @param $gateway
*
* @return mixed
*/
function prefix_modify_token_payment_request( $request, $order, $gateway ) {
@vanbo
vanbo / wc-paysafe-hosted-api-response-actions
Created Aug 9, 2019
WooCommerce Paysafe Hosted API Response Actions
View wc-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 Aug 12, 2019
WooCommerce Paysafe Checkout API Dynamic Account ID
View wc-paysafe-checkoutjs-dynamic-account-id
/**
* Add the gist to your "theme/functions.php" file or any file loading with after the "theme/functions.php" file
*/
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.
@vanbo
vanbo / wc-trustcommerce-modify-payment-request
Last active Aug 12, 2019
WooCommerce TrustCommerce Modify Payment Request
View wc-trustcommerce-modify-payment-request
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'] ) ) {
$request['avs'] = 'n';
}
@vanbo
vanbo / wc-psigate-add-order-request-xml-api
Created May 27, 2019
WooCommerce Psigate: Add Order details to XML API call
View wc-psigate-add-order-request-xml-api
add_filter( 'wc_psigate_process_credit_card_payment_parameters', 'prigate_xml_api_add_order_details', 11, 2 );
/**
* @param array $original_parameters
* @param WC_Order $order
*
* @return array
*/
function prigate_xml_api_add_order_details( $original_parameters, $order ) {
/**
@vanbo
vanbo / wc-paysafe-hosted-modify-payment-request
Last active Jul 11, 2019
WooCommerce Paysafe Hosted API - Modify Payment Request
View wc-paysafe-hosted-modify-payment-request
/**
* IMPORTANT: The filters only work for the Paysafe Hosted Payments API integration.
* Other integrations like Paysafe Checkout JS will have separate filters for the requests
*/
// Normal order
add_filter( 'wc_paysafe_request_params', 'prefix_paysafe_modify_request', 10, 2 );
// Subscriptions/Pre-Orders order
add_filter( 'wc_paysafe_addons_request_params', 'prefix_paysafe_modify_request', 10, 2 );
@vanbo
vanbo / wc-ipay88-change-description
Last active Feb 28, 2019
WooCommerce iPay88 change description
View wc-ipay88-change-description
add_filter( 'wc_ipay88_order_description', 'prefix_change_ipay88_payment_description', 10, 2 );
/**
* @param $desc
* @param WC_Order $order
*
* @return string
*/
function prefix_change_ipay88_payment_description( $desc, $order ) {
return sprintf( 'Payment for order %s', $order->get_order_number() );
}
You can’t perform that action at this time.