PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | paypal/helpers/FrmPayPalLiteConnectHelper.php +38 -37 6.31 → trunk View file →
@@ -76,9 +76,8 @@
76 76 // And return true so it does not try to handle it as an error.
77 77 return true;
78 78 }
79 79
80 - // TODO: Only render when we visit the PayPal tab.
81 80 $status = self::get_seller_status();
82 81
83 82 /*
84 83 $status = new stdClass();
@@ -849,14 +848,9 @@
849 848 /**
850 849 * @return array
851 850 */
852 851 private static function get_standard_authenticated_body() {
853 - $mode = self::get_mode_value_from_post();
854 - return array(
855 - 'merchant_id' => get_option( self::get_merchant_id_option_name( $mode ) ),
856 - 'server_password' => get_option( self::get_server_side_token_option_name( $mode ) ),
857 - 'client_password' => get_option( self::get_client_side_token_option_name( $mode ) ),
858 - );
852 + return self::get_body_for_mode( FrmPayPalLiteAppHelper::active_mode() );
859 853 }
860 854
861 855 /**
862 856 * Check $_POST for live or test mode value as it can be updated in real time from PayPal Settings and can be configured before the update is saved.
@@ -873,8 +867,26 @@
873 867 return $test_mode ? 'test' : 'live';
874 868 }
875 869
876 870 /**
871 + * Get the standard body with account id, mode, and passwords to send to the connect server.
872 + *
873 + * @since 6.32.1
874 + *
875 + * @param string $mode 'live' or 'test'.
876 + *
877 + * @return array
878 + */
879 + private static function get_body_for_mode( $mode ) {
880 + return array(
881 + 'merchant_id' => get_option( self::get_merchant_id_option_name( $mode ) ),
882 + 'server_password' => get_option( self::get_server_side_token_option_name( $mode ) ),
883 + 'client_password' => get_option( self::get_client_side_token_option_name( $mode ) ),
884 + 'frm_paypal_api_mode' => $mode,
885 + );
886 + }
887 +
888 + /**
877 889 * @return string|null
878 890 */
879 891 public static function get_latest_error_from_paypal_api() {
880 892 return self::$latest_error_from_paypal_api;
@@ -937,8 +949,9 @@
937 949
938 950 public static function handle_disconnect() {
939 951 self::disconnect();
940 952 self::reset_paypal_api_integration();
953 + FrmTransLiteAppHelper::trigger_gateway_disconnected_hook( 'paypal', self::get_mode_value_from_post() );
941 954 wp_send_json_success();
942 955 }
943 956
944 957 /**
@@ -944,11 +957,9 @@
944 957 /**
945 958 * @return false|object
946 959 */
947 960 private static function disconnect() {
948 - $additional_body = array(
949 - 'frm_paypal_api_mode' => self::get_mode_value_from_post(),
950 - );
961 + $additional_body = self::get_body_for_mode( self::get_mode_value_from_post() );
951 962 return self::post_with_authenticated_body( 'disconnect', $additional_body );
952 963 }
953 964
954 965 /**
@@ -1007,27 +1018,17 @@
1007 1018 * @param array $payer
1008 1019 * @param string $shipping_preference
1009 1020 * @param array $pricing_data Optional. Array of products with prices and quantities.
1010 1021 * @param array $shipping Optional. Shipping name and address data.
1022 + * @param string $description Optional. Description for the order.
1011 1023 *
1012 1024 * @return false|object
1013 1025 */
1014 - public static function create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data = array(), $shipping = array() ) {
1026 + public static function create_order( $amount, $currency, $payment_source, $payer, $shipping_preference, $pricing_data = array(), $shipping = array(), $description = '' ) {
1015 1027 $brand_name = self::get_brand_name();
1016 1028
1017 - // Log pricing data for debugging if FrmLog is available
1018 - if ( class_exists( 'FrmLog' ) && $pricing_data ) {
1019 - $log = new FrmLog();
1020 - $log->add(
1021 - array(
1022 - 'title' => 'PayPal Order: Pricing Data',
1023 - 'content' => print_r( $pricing_data, true ),
1024 - )
1025 - );
1026 - }
1027 -
1028 1029 // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
1029 - return self::post_with_authenticated_body( 'create_order', compact( 'amount', 'currency', 'payment_source', 'brand_name', 'payer', 'shipping_preference', 'pricing_data', 'shipping' ) );
1030 + return self::post_with_authenticated_body( 'create_order', compact( 'amount', 'currency', 'payment_source', 'brand_name', 'payer', 'shipping_preference', 'pricing_data', 'shipping', 'description' ) );
1030 1031 }
1031 1032
1032 1033 /**
1033 1034 * @since 6.31
@@ -1094,21 +1095,10 @@
1094 1095 return self::post_with_authenticated_body( 'create_subscription', compact( 'data' ) );
1095 1096 }
1096 1097
1097 1098 /**
1098 - * @since 6.31
1099 - *
1100 - * @param array $data Setup token data including payment_source.
1101 - *
1102 1099 * @return false|object
1103 1100 */
1104 - public static function create_vault_setup_token( $data = array() ) {
1105 - return self::post_with_authenticated_body( 'create_vault_setup_token', compact( 'data' ) );
1106 - }
1107 -
1108 - /**
1109 - * @return false|object
1110 - */
1111 1101 public static function get_seller_status() {
1112 1102 $mode = self::get_mode_value_from_post();
1113 1103 $status = get_option( self::get_paypal_seller_status_option_name( $mode ) );
1114 1104
@@ -1115,11 +1105,9 @@
1115 1105 if ( is_object( $status ) ) {
1116 1106 return $status;
1117 1107 }
1118 1108
1119 - $additional_body = array(
1120 - 'frm_paypal_api_mode' => $mode,
1121 - );
1109 + $additional_body = self::get_body_for_mode( $mode );
1122 1110
1123 1111 return self::post_with_authenticated_body( 'get_seller_status', $additional_body );
1124 1112 }
1125 1113
@@ -1162,6 +1150,19 @@
1162 1150 * @return string
1163 1151 */
1164 1152 public static function get_bn_code() {
1165 1153 return 'Strategy11LLCPPCP_SP';
1154 + }
1155 +
1156 + /**
1157 + * @since 6.31
1158 + * @deprecated 6.32.1
1159 + *
1160 + * @param array $data Setup token data including payment_source.
1161 + *
1162 + * @return false|object
1163 + */
1164 + public static function create_vault_setup_token( $data = array() ) {
1165 + _deprecated_function( __METHOD__, '6.32.1' );
1166 + return false;
1166 1167 }
1167 1168 }