Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions square/helpers/FrmSquareLiteApiHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( 'You are not allowed to call this page directly.' );
}

/**
* This file exists for backward compatibility with the Payments Submodule.
* Without these functions the Authorize.Net add on will trigger fatal errors.
*/
class FrmSquareLiteApiHelper {

/**
* The payments submodule calls this function.
* This function exists so payments can be refunded when the Stripe add-on or Authorize.Net is active.
*
* @param int $payment_id
*
* @return bool
*/
public static function refund_payment( $payment_id ) {
return FrmSquareLiteConnectHelper::refund_payment( $payment_id );
}

/**
* The payments submodule calls this function.
* This function exists so subscriptions can be cancelled when the Stripe add-on or Authorize.Net is active.
*
* @param string $sub_id
*
* @return bool
*/
public static function cancel_subscription( $sub_id ) {
return FrmSquareLiteConnectHelper::cancel_subscription( $sub_id );
}
}
9 changes: 5 additions & 4 deletions square/helpers/FrmSquareLiteConnectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,11 @@ public static function get_latest_error_from_square_api() {
/**
* @param string $receipt_id
*
* @return false|object
* @return bool
*/
public static function refund_payment( $receipt_id ) {
return self::post_with_authenticated_body( 'refund_payment', array( 'receipt_id' => $receipt_id ) );
$data = self::post_with_authenticated_body( 'refund_payment', array( 'receipt_id' => $receipt_id ) );
return is_object( $data );
}

/**
Expand Down Expand Up @@ -702,10 +703,10 @@ public static function get_subscription_id_for_payment( $payment_id ) {
/**
* @param string $subscription_id
*
* @return false|object
* @return bool
*/
public static function cancel_subscription( $subscription_id ) {
return self::post_with_authenticated_body( 'cancel_subscription', compact( 'subscription_id' ) );
return false !== self::post_with_authenticated_body( 'cancel_subscription', compact( 'subscription_id' ) );
}

public static function handle_disconnect() {
Expand Down
Loading