PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.2.3
JetFormBuilder — Dynamic Blocks Form Builder v3.2.3
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / gateways / base-scenario-gateway.php
jetformbuilder / modules / gateways Last commit date
actions-abstract 2 years ago assets 2 years ago db-models 2 years ago export 2 years ago legacy 2 years ago meta-boxes 2 years ago pages 2 years ago paypal 2 years ago query-views 2 years ago rest-api 2 years ago scenarios-abstract 2 years ago tab-handlers 2 years ago table-views 2 years ago base-gateway-action.php 2 years ago base-gateway.php 2 years ago base-scenario-gateway.php 2 years ago gateways-editor-data.php 2 years ago legacy-base-gateway.php 2 years ago migrate-legacy-data.php 2 years ago module.php 2 years ago scenario-item.php 2 years ago
base-scenario-gateway.php
117 lines
1 <?php
2
3
4 namespace JFB_Modules\Gateways;
5
6 use Jet_Form_Builder\Actions\Action_Handler;
7 use Jet_Form_Builder\Db_Queries\Exceptions\Skip_Exception;
8 use Jet_Form_Builder\Exceptions\Gateway_Exception;
9 use Jet_Form_Builder\Exceptions\Repository_Exception;
10 use JFB_Modules\Gateways\Module as GM;
11 use JFB_Modules\Gateways\Paypal\Scenarios_Manager;
12 use JFB_Modules\Gateways\Scenarios_Abstract\Scenario_Logic_Base;
13
14 // If this file is called directly, abort.
15 if ( ! defined( 'WPINC' ) ) {
16 die;
17 }
18
19 abstract class Base_Scenario_Gateway extends \Jet_Form_Builder\Gateways\Base_Gateway {
20
21 /**
22 * @return Scenario_Logic_Base
23 * @throws Repository_Exception
24 */
25 public function get_scenario() {
26 return Scenarios_Manager::instance()->get_logic( $this );
27 }
28
29 /**
30 * @return Scenario_Logic_Base
31 * @throws Gateway_Exception
32 */
33 public function query_scenario() {
34 return Scenarios_Manager::instance()->query_logic();
35 }
36
37 /**
38 * Prevent unnecessary notifications processing before form is send.
39 *
40 * @return void
41 * @throws Repository_Exception
42 */
43 public function before_actions() {
44 $this->set_form_meta( GM::instance()->gateways() );
45 $this->get_scenario()->before_actions();
46 }
47
48 /**
49 * @param Action_Handler $handler
50 *
51 * @throws Repository_Exception
52 */
53 public function after_actions( Action_Handler $handler ) {
54 jet_fb_gateway_current()->get_scenario()->after_actions();
55 }
56
57 public function try_run_on_catch() {
58 try {
59 $scenario = $this->query_scenario();
60 } catch ( Gateway_Exception $exception ) {
61 return;
62 }
63
64 try {
65 /** set to $this->payment_token */
66 $this->set_payment_token();
67
68 } catch ( Skip_Exception $exception ) {
69 return;
70 }
71
72 /**
73 * Init actions for correct migrating
74 *
75 * Later should be deprecated
76 */
77 $scenario->init_request();
78 $scenario->init_actions();
79
80 /** set to $this->gateways_meta */
81 $this->set_form_gateways_meta();
82
83 $scenario->on_catch();
84 }
85
86 // statuses from scenario
87
88 /**
89 * @return mixed
90 * @throws Gateway_Exception
91 */
92 protected function retrieve_gateway_meta() {
93 return $this->query_scenario()->get_gateways_meta();
94 }
95
96 /**
97 * @return string|void
98 * @throws Gateway_Exception
99 */
100 public function get_payment_token() {
101 return $this->query_scenario()->get_queried_token();
102 }
103
104 /**
105 * Apply macros in string
106 *
107 * @param null $content
108 *
109 * @return string [description]
110 * @throws Gateway_Exception
111 */
112 public function apply_macros( $content = null ) {
113 return $this->query_scenario()->apply_macros( $content );
114 }
115
116 }
117