| @@ -33,8 +33,9 @@ | ||
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @param string $function |
| 36 | 36 | * @param array ...$params |
| 37 | + * | |
| 37 | 38 | * @return mixed |
| 38 | 39 | */ |
| 39 | 40 | public static function call_stripe_helper_class( $function, ...$params ) { |
| 40 | 41 | if ( self::should_use_stripe_connect() && is_callable( "FrmStrpLiteConnectApiAdapter::$function" ) ) { |
| @@ -66,11 +67,13 @@ | ||
| 66 | 67 | * @return string |
| 67 | 68 | */ |
| 68 | 69 | public static function get_customer_id_meta_name() { |
| 69 | 70 | $meta_name = '_frmstrp_customer_id'; |
| 71 | + | |
| 70 | 72 | if ( 'test' === self::active_mode() ) { |
| 71 | 73 | $meta_name .= '_test'; |
| 72 | 74 | } |
| 75 | + | |
| 73 | 76 | return $meta_name; |
| 74 | 77 | } |
| 75 | 78 | |
| 76 | 79 | /** |
| @@ -88,24 +91,26 @@ | ||
| 88 | 91 | * |
| 89 | 92 | * @psalm-return 'live'|'test' |
| 90 | 93 | */ |
| 91 | 94 | public static function active_mode() { |
| 92 | - $settings = self::get_settings(); | |
| 93 | - return $settings->settings->test_mode ? 'test' : 'live'; | |
| 95 | + return self::get_settings()->settings->test_mode ? 'test' : 'live'; | |
| 94 | 96 | } |
| 95 | 97 | |
| 96 | 98 | /** |
| 97 | 99 | * Add education about Stripe fees. |
| 98 | 100 | * |
| 101 | + * @param string $content UTM Content for the admin upgrade link. | |
| 102 | + * @param array|false|string $gateway Gateway or list of gateways this applies to. | |
| 103 | + * | |
| 99 | 104 | * @return void |
| 100 | 105 | */ |
| 101 | - public static function fee_education( $medium = 'tip', $gateway = false ) { | |
| 102 | - $license_type = FrmAddonsController::license_type(); | |
| 103 | - if ( in_array( $license_type, array( 'elite', 'business' ), true ) ) { | |
| 106 | + public static function fee_education( $content = 'tip', $gateway = false ) { | |
| 107 | + if ( ! FrmAddonsController::payment_fees_apply( 'stripe' ) ) { | |
| 104 | 108 | return; |
| 105 | 109 | } |
| 106 | 110 | |
| 107 | 111 | $classes = 'frm-light-tip show_stripe'; |
| 112 | + | |
| 108 | 113 | if ( $gateway && ! array_intersect( (array) $gateway, array( 'stripe' ) ) ) { |
| 109 | 114 | $classes .= ' frm_hidden'; |
| 110 | 115 | } |
| 111 | 116 | |
| @@ -111,10 +116,10 @@ | ||
| 111 | 116 | |
| 112 | 117 | FrmTipsHelper::show_tip( |
| 113 | 118 | array( |
| 114 | 119 | 'link' => array( |
| 115 | - 'content' => 'stripe-fee', | |
| 116 | - 'medium' => $medium, | |
| 120 | + 'campaign' => 'stripe-fee', | |
| 121 | + 'content' => $content, | |
| 117 | 122 | ), |
| 118 | 123 | 'tip' => 'Pay as you go pricing: 3% fee per-transaction + Stripe fees.', |
| 119 | 124 | 'call' => __( 'Upgrade to save on fees.', 'formidable' ), |
| 120 | 125 | 'class' => $classes, |
| @@ -128,19 +133,34 @@ | ||
| 128 | 133 | * |
| 129 | 134 | * @return void |
| 130 | 135 | */ |
| 131 | 136 | public static function not_connected_warning() { |
| 137 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 132 | 138 | ?> |
| 133 | - <div class="frm_warning_style frm-with-icon"> | |
| 134 | - <?php FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon', array( 'style' => 'width:24px' ) ); ?> | |
| 139 | + <div class="frm_warning_style"> | |
| 135 | 140 | <span> |
| 136 | 141 | <?php |
| 137 | - /* translators: %1$s: Link HTML, %2$s: End link */ | |
| 138 | - printf( esc_html__( 'Credit Cards will not work without %1$sconnecting Stripe%2$s or %3$sconnecting Square%4$s first.', 'formidable' ), '<a href="?page=formidable-settings&t=stripe_settings" target="_blank">', '</a>', '<a href="?page=formidable-settings&t=square_settings" target="_blank">', '</a>' ); | |
| 142 | + printf( | |
| 143 | + /* translators: %1$s: Link HTML, %2$s: End link */ | |
| 144 | + esc_html__( 'Credit Cards will not work without connecting %1$sStripe%2$s, %3$sSquare%4$s, or %5$sPayPal%6$s first.', 'formidable' ), | |
| 145 | + // %1$s | |
| 146 | + '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=stripe_settings' ) ) . '" target="_blank">', | |
| 147 | + // %2$s | |
| 148 | + '</a>', | |
| 149 | + // %3$s | |
| 150 | + '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=square_settings' ) ) . '" target="_blank">', | |
| 151 | + // %4$s | |
| 152 | + '</a>', | |
| 153 | + // %5$s | |
| 154 | + '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=paypal_settings' ) ) . '" target="_blank">', | |
| 155 | + // %6$s | |
| 156 | + '</a>' | |
| 157 | + ); | |
| 139 | 158 | ?> |
| 140 | 159 | </span> |
| 141 | 160 | </div> |
| 142 | 161 | <?php |
| 162 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 143 | 163 | } |
| 144 | 164 | |
| 145 | 165 | /** |
| 146 | 166 | * @deprecated 6.22 |