PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.4
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.4
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 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 All 134 releases
jetformbuilder / modules / gateways / meta-boxes / payment-details-box.php

payment-details-box.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.5.4, at modules/gateways/meta-boxes/payment-details-box.php

80 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Modules\Gateways\Meta_Boxes;
5
6 use Jet_Form_Builder\Admin\Exceptions\Not_Found_Page_Exception;
7 use Jet_Form_Builder\Admin\Single_Pages\Meta_Boxes\Base_List_Box;
8 use Jet_Form_Builder\Admin\Table_Views\Columns\Created_At_Column;
9 use Jet_Form_Builder\Admin\Table_Views\Columns\Updated_At_Column;
10 use Jet_Form_Builder\Exceptions\Query_Builder_Exception;
11 use JFB_Modules\Gateways\Meta_Boxes\Actions\Delete_Payment_Action;
12 use JFB_Modules\Gateways\Meta_Boxes\Columns\Gateway_Type_Column;
13 use JFB_Modules\Gateways\Meta_Boxes\Columns\Payment_Amount_Column;
14 use JFB_Modules\Gateways\Meta_Boxes\Columns\Payment_Currency_Column;
15 use JFB_Modules\Gateways\Table_Views\Columns\Transaction_Column;
16 use JFB_Modules\Gateways\Pages\Single_Payment_Page;
17 use JFB_Modules\Gateways\Query_Views\Payment_View;
18 use JFB_Modules\Gateways\Rest_Api\Receive_Payment;
19 use JFB_Modules\Gateways\Table_Views\Columns\Payment_Status_Column;
20
21 // If this file is called directly, abort.
22 if ( ! defined( 'WPINC' ) ) {
23 die;
24 }
25
26 class Payment_Details_Box extends Base_List_Box {
27
28 public function get_title(): string {
29 return __( 'Payment Details', 'jet-form-builder' );
30 }
31
32 public function get_columns(): array {
33 return array(
34 'amount' => new Payment_Amount_Column(),
35 'code' => new Payment_Currency_Column(),
36 'gateway' => new Gateway_Type_Column(),
37 'status' => new Payment_Status_Column(),
38 'transaction' => new Transaction_Column(),
39 'created_at' => new Created_At_Column(),
40 'updated_at' => new Updated_At_Column(),
41 );
42 }
43
44 public function get_actions(): array {
45 if ( ! is_a( jet_fb_current_page(), Single_Payment_Page::class ) ) {
46 return array();
47 }
48
49 return array(
50 new Delete_Payment_Action(),
51 );
52 }
53
54 public function get_rest_url(): string {
55 return Receive_Payment::dynamic_rest_url(
56 array( 'id' => $this->get_id() )
57 );
58 }
59
60 public function get_rest_methods(): string {
61 return Receive_Payment::get_methods();
62 }
63
64 /**
65 * @return array
66 * @throws Not_Found_Page_Exception
67 */
68 public function get_list(): array {
69 try {
70 return Payment_View::findById( $this->get_id() );
71 } catch ( Query_Builder_Exception $exception ) {
72 throw new Not_Found_Page_Exception(
73 esc_html( $exception->getMessage() ),
74 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
75 ...$exception->get_additional()
76 );
77 }
78 }
79 }
80