Пример #1
0
 /**
  * Filter the data for generating an signature
  *
  * @param array $data
  * @return array
  */
 public static function filter_data($data)
 {
     $filter = array();
     // List all parameters prefixed with brq_, add_ or cust_, except brq_signature
     foreach ($data as $key => $value) {
         if ((Pronamic_WP_Pay_Buckaroo_Util::string_starts_with($key, 'brq_') || Pronamic_WP_Pay_Buckaroo_Util::string_starts_with($key, 'add_') || Pronamic_WP_Pay_Buckaroo_Util::string_starts_with($key, 'cust_')) && !Pronamic_WP_Pay_Buckaroo_Util::string_equals($key, Pronamic_WP_Pay_Buckaroo_Parameters::SIGNATURE)) {
             $filter[$key] = $value;
         }
     }
     return $filter;
 }
Пример #2
0
 /**
  * Update status of the specified payment
  *
  * @param Pronamic_Pay_Payment $payment
  */
 public function update_status(Pronamic_Pay_Payment $payment)
 {
     $method = filter_var($_SERVER['REQUEST_METHOD'], FILTER_SANITIZE_STRING);
     $data = array();
     switch ($method) {
         case 'GET':
             $data = $_GET;
             break;
         case 'POST':
             $data = $_POST;
             // WPCS: CSRF OK
             break;
     }
     $data = Pronamic_WP_Pay_Buckaroo_Util::urldecode($data);
     $data = stripslashes_deep($data);
     $data = $this->client->verify_request($data);
     if ($data) {
         $payment->set_transaction_id($data[Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT]);
         $payment->set_status(Pronamic_WP_Pay_Buckaroo_Statuses::transform($data[Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE]));
         $payment->set_consumer_iban($data[Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN]);
         $payment->set_consumer_bic($data[Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC]);
         $payment->set_consumer_name($data[Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME]);
         $labels = array(Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT => __('Payment', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT_METHOD => __('Payment Method', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE => __('Status Code', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE_DETAIL => __('Status Code Detail', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_MESSAGE => __('Status Message', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER => __('Invoice Number', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::AMOUNT => __('Amount', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::CURRENCY => __('Currency', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::TIMESTAMP => __('Timestamp', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => __('Service iDEAL Consumer Issuer', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME => __('Service iDEAL Consumer Name', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN => __('Service iDEAL Consumer IBAN', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC => __('Service iDEAL Consumer BIC', 'pronamic_ideal'), Pronamic_WP_Pay_Buckaroo_Parameters::TRANSACTIONS => __('Transactions', 'pronamic_ideal'));
         $note = '';
         $note .= '<p>';
         $note .= __('Buckaroo data:', '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);
     }
 }