Conditions | 3 |
Paths | 3 |
Total Lines | 27 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public static function listen() { |
||
19 | if ( ! filter_has_var( INPUT_GET, 'nocks_webhook' ) ) { |
||
20 | return; |
||
21 | } |
||
22 | |||
23 | $transaction_id = file_get_contents( 'php://input' ); |
||
24 | |||
25 | $payment = get_pronamic_payment_by_transaction_id( $transaction_id ); |
||
26 | |||
27 | if ( null === $payment ) { |
||
28 | return; |
||
29 | } |
||
30 | |||
31 | // Add note. |
||
32 | $note = sprintf( |
||
33 | /* translators: %s: payment provider name */ |
||
34 | __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
||
35 | __( 'Nocks', 'pronamic_ideal' ) |
||
36 | ); |
||
37 | |||
38 | $payment->add_note( $note ); |
||
39 | |||
40 | // Log webhook request. |
||
41 | do_action( 'pronamic_pay_webhook_log_payment', $payment ); |
||
42 | |||
43 | // Update payment. |
||
44 | Plugin::update_payment( $payment, false ); |
||
45 | } |
||
47 |