@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * Constructor |
14 | 14 | */ |
15 | 15 | |
16 | - public function __construct(){ |
|
16 | + public function __construct(){ |
|
17 | 17 | //Init |
18 | 18 | $this->id = 'paykeeper'; |
19 | 19 | $this->title = __( 'PayKeeper', 'my-domain' ); // Frontend name |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->supports = array( 'sandbox', 'tokens', 'addons' ); |
31 | 31 | |
32 | 32 | |
33 | - $this->enabled = wpinv_is_gateway_active( $this->id ); |
|
33 | + $this->enabled = wpinv_is_gateway_active( $this->id ); |
|
34 | 34 | parent::__construct() |
35 | 35 | |
36 | 36 | if ($this->enabled){ |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /** |
48 | - * Processes ipns and marks payments as complete. |
|
48 | + * Processes ipns and marks payments as complete. |
|
49 | 49 | * @docs https://docs.paykeeper.ru/metody-integratsii/priyom-post-opoveshhenij/ |
50 | - * |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function verify_ipn() { |
|
50 | + * |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function verify_ipn() { |
|
54 | 54 | // проверяем наличие необходимых данных в массиве $_POST |
55 | - if ( empty( $_POST ) || empty($_POST["id"],$_POST["sum"], $_POST["orderid"],$_POST["key"]))) { |
|
56 | - wp_die( 'Gateway IPN Request Failure', 500 ); |
|
57 | - } |
|
55 | + if ( empty( $_POST ) || empty($_POST["id"],$_POST["sum"], $_POST["orderid"],$_POST["key"]))) { |
|
56 | + wp_die( 'Gateway IPN Request Failure', 500 ); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | $posted = wp_unslash( $_POST ); |
60 | 60 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | |
85 | 85 | //проверяем совпадение данныых инвойса с данными из _POST |
86 | 86 | if ( number_format( $invoice->get_total(), 2, '.', '' ) !== number_format( $posted["sum"], 2, '.', '' ) ) { |
87 | - /* translators: %s: Amount. */ |
|
88 | - wpinv_error_log( "Amounts do not match: {$posted['sum']} instead of {$invoice->get_total()}", 'IPN Error', false ); |
|
87 | + /* translators: %s: Amount. */ |
|
88 | + wpinv_error_log( "Amounts do not match: {$posted['sum']} instead of {$invoice->get_total()}", 'IPN Error', false ); |
|
89 | 89 | wpinv_error_log( $posted["sum"], 'Validated IPN Amount', false ); |
90 | 90 | wp_die( 'Invoice not paid via PayKeeper', 500 ); |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
94 | 94 | // инвойс уже оплачен или возвращен |
@@ -104,29 +104,29 @@ discard block |
||
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - /** |
|
108 | - * Retrieves IPN Invoice. |
|
109 | - * |
|
110 | - * @param array $posted |
|
111 | - * @return WPInv_Invoice |
|
112 | - */ |
|
113 | - protected function get_ipn_invoice( $posted ) { |
|
107 | + /** |
|
108 | + * Retrieves IPN Invoice. |
|
109 | + * |
|
110 | + * @param array $posted |
|
111 | + * @return WPInv_Invoice |
|
112 | + */ |
|
113 | + protected function get_ipn_invoice( $posted ) { |
|
114 | 114 | |
115 | - wpinv_error_log( 'Retrieving PayKeeper IPN Response Invoice', false ); |
|
115 | + wpinv_error_log( 'Retrieving PayKeeper IPN Response Invoice', false ); |
|
116 | 116 | |
117 | - if ( ! empty( $posted['orderid'] ) ) { |
|
118 | - $invoice = new WPInv_Invoice( $posted['orderid'] ); |
|
117 | + if ( ! empty( $posted['orderid'] ) ) { |
|
118 | + $invoice = new WPInv_Invoice( $posted['orderid'] ); |
|
119 | 119 | |
120 | - if ( $invoice->exists() ) { |
|
121 | - wpinv_error_log( 'Found invoice #' . $invoice->get_number(), false ); |
|
122 | - return $invoice; |
|
123 | - } |
|
124 | - } |
|
120 | + if ( $invoice->exists() ) { |
|
121 | + wpinv_error_log( 'Found invoice #' . $invoice->get_number(), false ); |
|
122 | + return $invoice; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | |
126 | - wpinv_error_log( 'Could not retrieve the associated invoice.', false ); |
|
127 | - wp_die( 'Could not retrieve the associated invoice.', 200 ); |
|
126 | + wpinv_error_log( 'Could not retrieve the associated invoice.', false ); |
|
127 | + wp_die( 'Could not retrieve the associated invoice.', 200 ); |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | 132 |