Conditions | 4 |
Paths | 3 |
Total Lines | 28 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public static function listen() { |
||
19 | if ( ! filter_has_var( INPUT_POST, 'Data' ) || ! filter_has_var( INPUT_POST, 'Seal' ) ) { |
||
20 | return; |
||
21 | } |
||
22 | |||
23 | $input_data = filter_input( INPUT_POST, 'Data' ); |
||
24 | |||
25 | $data = Client::parse_piped_string( $input_data ); |
||
26 | |||
27 | $transaction_reference = $data['transactionReference']; |
||
28 | |||
29 | $payment = get_pronamic_payment_by_meta( '_pronamic_payment_omnikassa_transaction_reference', $transaction_reference ); |
||
30 | |||
31 | if ( null === $payment ) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | // Add note. |
||
36 | $note = sprintf( |
||
37 | /* translators: %s: payment provider name */ |
||
38 | __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
||
39 | __( 'OmniKassa', 'pronamic_ideal' ) |
||
40 | ); |
||
41 | |||
42 | $payment->add_note( $note ); |
||
43 | |||
44 | // Update payment. |
||
45 | Plugin::update_payment( $payment ); |
||
46 | } |
||
48 |