public static function listen() { if (filter_has_var(INPUT_POST, 'Data') && filter_has_var(INPUT_POST, 'Seal')) { $input_data = filter_input(INPUT_POST, 'Data', FILTER_SANITIZE_STRING); $data = Pronamic_WP_Pay_Gateways_OmniKassa_Client::parse_piped_string($input_data); $transaction_reference = $data['transactionReference']; $payment = get_pronamic_payment_by_meta('_pronamic_payment_omnikassa_transaction_reference', $transaction_reference); Pronamic_WP_Pay_Plugin::update_payment($payment); } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $input_data = filter_input(INPUT_POST, 'Data', FILTER_SANITIZE_STRING); $input_seal = filter_input(INPUT_POST, 'Seal', FILTER_SANITIZE_STRING); $data = Pronamic_WP_Pay_Gateways_OmniKassa_Client::parse_piped_string($input_data); $seal = Pronamic_WP_Pay_Gateways_OmniKassa_Client::compute_seal($input_data, $this->config->secret_key); // Check if the posted seal is equal to our seal if (0 === strcasecmp($input_seal, $seal)) { $response_code = $data['responseCode']; $status = Pronamic_WP_Pay_Gateways_OmniKassa_ResponseCodes::transform($response_code); // Set the status of the payment $payment->set_status($status); $labels = array('amount' => __('Amount', 'pronamic_ideal'), 'captureDay' => _x('Capture Day', 'creditcard', 'pronamic_ideal'), 'captureMode' => _x('Capture Mode', 'creditcard', 'pronamic_ideal'), 'currencyCode' => __('Currency Code', 'pronamic_ideal'), 'merchantId' => __('Merchant ID', 'pronamic_ideal'), 'orderId' => __('Order ID', 'pronamic_ideal'), 'transactionDateTime' => __('Transaction Date Time', 'pronamic_ideal'), 'transactionReference' => __('Transaction Reference', 'pronamic_ideal'), 'keyVersion' => __('Key Version', 'pronamic_ideal'), 'authorisationId' => __('Authorisation ID', 'pronamic_ideal'), 'paymentMeanBrand' => __('Payment Mean Brand', 'pronamic_ideal'), 'paymentMeanType' => __('Payment Mean Type', 'pronamic_ideal'), 'responseCode' => __('Response Code', 'pronamic_ideal')); $note = ''; $note .= '<p>'; $note .= __('OmniKassa transaction data in response message:', 'pronamic_ideal'); $note .= '</p>'; $note .= '<dl>'; foreach ($labels as $key => $label) { if (isset($data[$key])) { $note .= sprintf('<dt>%s</dt>', esc_html($label)); $note .= sprintf('<dd>%s</dd>', esc_html($data[$key])); } } $note .= '</dl>'; $payment->add_note($note); } }