/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { if (filter_has_var(INPUT_GET, 'status')) { $status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING); $payment->set_status($status); } }
/** * Update lead status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public static function status_update(Pronamic_Pay_Payment $payment, $can_redirect = false) { $source_id = $payment->get_source_id(); $order = new WC_Order((int) $source_id); $gateway = new Pronamic_WP_Pay_Extensions_WooCommerce_IDealGateway(); $data = new Pronamic_WP_Pay_Extensions_WooCommerce_PaymentData($order, $gateway); // Only update if order is not 'processing' or 'completed' // @see https://github.com/woothemes/woocommerce/blob/v2.0.0/classes/class-wc-order.php#L1279 $should_update = !Pronamic_WP_Pay_Extensions_WooCommerce_WooCommerce::order_has_status($order, array(Pronamic_WP_Pay_Extensions_WooCommerce_WooCommerce::ORDER_STATUS_COMPLETED, Pronamic_WP_Pay_Extensions_WooCommerce_WooCommerce::ORDER_STATUS_PROCESSING)); // Defaults $status = null; $url = $data->get_normal_return_url(); $status = $payment->get_status(); $payment_method_title = $order->payment_method_title; switch ($status) { case Pronamic_WP_Pay_Statuses::CANCELLED: $url = $data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: if ($should_update) { $note = sprintf('%s %s.', $payment_method_title, __('payment expired', 'pronamic_ideal')); // WooCommerce PayPal gateway uses 'failed' order status for an 'expired' payment // @see http://plugins.trac.wordpress.org/browser/woocommerce/tags/1.5.4/classes/gateways/class-wc-paypal.php#L557 $order->update_status(Pronamic_WP_Pay_Extensions_WooCommerce_WooCommerce::ORDER_STATUS_FAILED, $note); } $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::FAILURE: if ($should_update) { $note = sprintf('%s %s.', $payment_method_title, __('payment failed', 'pronamic_ideal')); $order->update_status(Pronamic_WP_Pay_Extensions_WooCommerce_WooCommerce::ORDER_STATUS_FAILED, $note); } $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: if ($should_update) { // Payment completed $order->add_order_note(sprintf('%s %s.', $payment_method_title, __('payment completed', 'pronamic_ideal'))); // Mark order complete $order->payment_complete(); } $url = $data->get_success_url(); break; case Pronamic_WP_Pay_Statuses::OPEN: if ($should_update) { $order->add_order_note(sprintf('%s %s.', $payment_method_title, __('payment open', 'pronamic_ideal'))); } break; default: if ($should_update) { $order->add_order_note(sprintf('%s %s.', $payment_method_title, __('payment unknown', 'pronamic_ideal'))); } break; } if ($can_redirect) { wp_redirect($url); exit; } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $result = $this->client->transaction_info($payment->get_transaction_id()); if (isset($result, $result->paymentDetails)) { $state = $result->paymentDetails->state; $status = Pronamic_WP_Pay_Gateways_PayNL_States::transform($state); $payment->set_status($status); } }
/** * Update the status of the specified payment * * @param Pronamic_Pay_Payment $payment * @param boolean $can_redirect (optional, defaults to false) */ public static function status_update(Pronamic_Pay_Payment $payment, $can_redirect = false) { $source_id = $payment->get_source_id(); $data = new Pronamic_WP_Pay_Extensions_EDD_PaymentData($source_id, array()); // Only update if order is not completed $should_update = edd_get_payment_status($source_id) !== Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_PUBLISH; // Defaults $status = null; $note = null; $url = $data->get_normal_return_url(); $status = $payment->get_status(); switch ($status) { case Pronamic_WP_Pay_Statuses::CANCELLED: $url = $data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: if ($should_update) { edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_ABANDONED); } $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::FAILURE: if ($should_update) { edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_FAILED); } $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: if ($should_update) { edd_insert_payment_note($source_id, __('Payment completed.', 'pronamic_ideal')); /* * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/admin/payments/view-order-details.php#L36 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/admin/payments/view-order-details.php#L199-L206 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/payments/functions.php#L1312-L1332 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/gateways/paypal-standard.php#L555-L576 */ } edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_PUBLISH); edd_empty_cart(); $url = $data->get_success_url(); break; case Pronamic_WP_Pay_Statuses::OPEN: if ($should_update) { edd_insert_payment_note($source_id, __('Payment open.', 'pronamic_ideal')); } break; default: if ($should_update) { edd_insert_payment_note($source_id, __('Payment unknown.', 'pronamic_ideal')); } break; } if ($can_redirect) { wp_redirect($url, 303); exit; } }
/** * Get order ID. * * @param string $order_id * @param Pronamic_Pay_PaymentDataInterface $data * @param Pronamic_Pay_Payment $payment */ public static function get_order_id($order_id, Pronamic_Pay_Payment $payment) { // Replacements definition $replacements = array('{order_id}' => $payment->get_order_id(), '{payment_id}' => $payment->get_id()); // Find and replace $order_id = str_replace(array_keys($replacements), array_values($replacements), $order_id, $count); // Make sure there is an dynamic part in the order ID if (0 === $count) { $order_id .= $payment->get_order_id(); } return $order_id; }
/** * Start * * @param Pronamic_Pay_PaymentDataInterface $data * @see Pronamic_WP_Pay_Gateway::start() */ public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $payment_method = null) { $payment->set_transaction_id(md5(time() . $data->get_order_id())); $payment->set_action_url($this->client->get_payment_server_url()); $this->client->set_merchant_reference($data->get_order_id()); $this->client->set_payment_amount($data->get_amount()); $this->client->set_currency_code($data->get_currency()); $this->client->set_ship_before_date(new DateTime('+5 days')); $this->client->set_shopper_locale($data->get_language_and_country()); $this->client->set_order_data($data->get_description()); $this->client->set_session_validity(new DateTime('+1 hour')); $this->client->set_shopper_reference($data->get_email()); $this->client->set_shopper_email($data->get_email()); }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $transaction_id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); $status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING); $salt = filter_input(INPUT_GET, 'salt', FILTER_SANITIZE_STRING); $checksum = filter_input(INPUT_GET, 'checksum', FILTER_SANITIZE_STRING); $payment->set_status(Pronamic_WP_Pay_Gateways_Qantani_PaymentStatuses::transform($status)); }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $mollie_payment = $this->client->get_payment($payment->get_transaction_id()); if ($mollie_payment) { $payment->set_status(Pronamic_WP_Pay_Mollie_Statuses::transform($mollie_payment->status)); if (isset($mollie_payment->details)) { $details = $mollie_payment->details; if (isset($details->consumerName)) { $payment->set_consumer_name($details->consumerName); } if (isset($details->consumerAccount)) { $payment->set_consumer_iban($details->consumerAccount); } } } else { $this->error = $this->client->get_error(); } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $result = $this->client->check_payment($payment->get_transaction_id()); if (false !== $result) { $consumer = $result->consumer; switch ($result->status) { case Pronamic_WP_Pay_Gateways_Mollie_IDeal_Statuses::SUCCESS: $payment->set_consumer_name($consumer->name); $payment->set_consumer_account_number($consumer->account); $payment->set_consumer_city($consumer->city); case Pronamic_WP_Pay_Gateways_Mollie_IDeal_Statuses::CANCELLED: case Pronamic_WP_Pay_Gateways_Mollie_IDeal_Statuses::EXPIRED: case Pronamic_WP_Pay_Gateways_Mollie_IDeal_Statuses::FAILURE: $payment->set_status($result->status); break; case Pronamic_WP_Pay_Gateways_Mollie_IDeal_Statuses::CHECKED_BEFORE: // Nothing to do here break; } } else { $this->error = $this->client->get_error(); } }
/** * Update the status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public static function status_update(Pronamic_Pay_Payment $payment) { $source_id = $payment->get_source_id(); $data = new Pronamic_WP_Pay_Extensions_EDD_PaymentData($source_id, array()); // Only update if order is not completed $should_update = edd_get_payment_status($source_id) !== Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_PUBLISH; if ($should_update) { switch ($payment->get_status()) { case Pronamic_WP_Pay_Statuses::CANCELLED: // Nothing to do? break; case Pronamic_WP_Pay_Statuses::EXPIRED: edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_ABANDONED); break; case Pronamic_WP_Pay_Statuses::FAILURE: edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_FAILED); break; case Pronamic_WP_Pay_Statuses::SUCCESS: edd_insert_payment_note($source_id, __('Payment completed.', 'pronamic_ideal')); /* * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/admin/payments/view-order-details.php#L36 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/admin/payments/view-order-details.php#L199-L206 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/payments/functions.php#L1312-L1332 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.2.8/includes/gateways/paypal-standard.php#L555-L576 */ edd_update_payment_status($source_id, Pronamic_WP_Pay_Extensions_EDD_EasyDigitalDownloads::ORDER_STATUS_PUBLISH); edd_empty_cart(); break; case Pronamic_WP_Pay_Statuses::OPEN: edd_insert_payment_note($source_id, __('Payment open.', 'pronamic_ideal')); break; default: edd_insert_payment_note($source_id, __('Payment unknown.', 'pronamic_ideal')); break; } } }
/** * Update lead status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public static function status_update(Pronamic_Pay_Payment $payment, $can_redirect = false) { $merchant = new Pronamic_WP_Pay_Extensions_WPeCommerce_IDealMerchant($payment->get_source_id()); $data = new Pronamic_WP_Pay_Extensions_WPeCommerce_PaymentData($merchant); $url = $data->get_normal_return_url(); switch ($payment->status) { case Pronamic_WP_Pay_Statuses::CANCELLED: $merchant->set_purchase_processed_by_purchid(Pronamic_WP_Pay_Extensions_WPeCommerce_WPeCommerce::PURCHASE_STATUS_INCOMPLETE_SALE); // $merchant->set_transaction_details( $payment->transaction->getId(), Pronamic_WP_Pay_Extensions_WPeCommerce_WPeCommerce::PURCHASE_STATUS_INCOMPLETE_SALE ); $url = $data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: break; case Pronamic_WP_Pay_Statuses::FAILURE: break; case Pronamic_WP_Pay_Statuses::SUCCESS: /* * Transactions results * * @see https://github.com/wp-e-commerce/WP-e-Commerce/blob/v3.8.9.5/wpsc-merchants/paypal-pro.merchant.php#L303 */ $session_id = get_post_meta($payment->get_id(), '_pronamic_payment_wpsc_session_id', true); transaction_results($session_id); $merchant->set_purchase_processed_by_purchid(Pronamic_WP_Pay_Extensions_WPeCommerce_WPeCommerce::PURCHASE_STATUS_ACCEPTED_PAYMENT); $url = $data->get_success_url(); break; case Pronamic_WP_Pay_Statuses::OPEN: break; default: break; } if ($can_redirect) { wp_redirect($url, 303); exit; } }
/** * Construct and initialize payment object * * @param int $post_id */ public function __construct($post_id) { parent::__construct(); $this->id = $post_id; $this->post = get_post($post_id); // Load $this->config_id = get_post_meta($post_id, '_pronamic_payment_config_id', true); $this->amount = get_post_meta($post_id, '_pronamic_payment_amount', true); $this->currency = get_post_meta($post_id, '_pronamic_payment_currency', true); $this->transaction_id = get_post_meta($post_id, '_pronamic_payment_transaction_id', true); $this->action_url = get_post_meta($post_id, '_pronamic_payment_action_url', true); $this->source = get_post_meta($post_id, '_pronamic_payment_source', true); $this->source_id = get_post_meta($post_id, '_pronamic_payment_source_id', true); $this->email = get_post_meta($post_id, '_pronamic_payment_email', true); $this->status = get_post_meta($post_id, '_pronamic_payment_status', true); }
/** * Update lead status of the specified payment * * @see https://github.com/Charitable/Charitable/blob/1.1.4/includes/gateways/class-charitable-gateway-paypal.php#L229-L357 * @param Pronamic_Pay_Payment $payment */ public static function status_update(Pronamic_Pay_Payment $payment) { $donation_id = $payment->get_source_id(); switch ($payment->get_status()) { case Pronamic_WP_Pay_Statuses::CANCELLED: give_update_payment_status($donation_id, 'cancelled'); break; case Pronamic_WP_Pay_Statuses::EXPIRED: give_update_payment_status($donation_id, 'abandoned'); break; case Pronamic_WP_Pay_Statuses::FAILURE: give_update_payment_status($donation_id, 'failed'); break; case Pronamic_WP_Pay_Statuses::SUCCESS: give_update_payment_status($donation_id, 'publish'); break; case Pronamic_WP_Pay_Statuses::OPEN: default: give_update_payment_status($donation_id, 'pending'); break; } }
/** * Update lead status of the specified payment * * @param string $payment */ public function update_status(Pronamic_Pay_Payment $payment, $can_redirect = false) { $lead_id = $payment->get_source_id(); $lead = RGFormsModel::get_lead($lead_id); if ($lead) { $form_id = $lead['form_id']; $form = RGFormsModel::get_form($form_id); $feed = get_pronamic_gf_pay_feed_by_entry_id($lead_id); $data = new Pronamic_WP_Pay_Extensions_GravityForms_PaymentData($form, $lead, $feed); if ($feed) { $url = null; switch ($payment->status) { case Pronamic_WP_Pay_Statuses::CANCELLED: $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::CANCELLED; $url = $data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::EXPIRED; $url = $feed->get_url(Pronamic_WP_Pay_Extensions_GravityForms_Links::EXPIRED); break; case Pronamic_WP_Pay_Statuses::FAILURE: $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::FAILED; $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: if (!Pronamic_WP_Pay_Extensions_GravityForms_Entry::is_payment_approved($lead)) { // Only fullfill order if the payment isn't approved aloready $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::PAYMENT_STATUS] = Pronamic_WP_Pay_Extensions_GravityForms_PaymentStatuses::APPROVED; // @see https://github.com/gravityforms/gravityformspaypal/blob/2.3.1/class-gf-paypal.php#L1741-L1742 if ($this->addon) { $action = array('id' => $payment->get_transaction_id(), 'type' => 'complete_payment', 'transaction_id' => $payment->get_transaction_id(), 'amount' => $payment->get_amount(), 'entry_id' => $lead['id']); $this->addon->complete_payment($lead, $action); } $this->fulfill_order($lead); } $url = $data->get_success_url(); break; case Pronamic_WP_Pay_Statuses::OPEN: default: $url = $data->get_normal_return_url(); break; } Pronamic_WP_Pay_Extensions_GravityForms_GravityForms::update_entry($lead); if ($url && $can_redirect) { wp_redirect($url); exit; } } } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $result = $this->client->get_status($payment->get_transaction_id()); if ($result instanceof Pronamic_WP_Pay_Gateways_Sisow_Error) { $this->error = $this->client->get_error(); return; } if (false === $result) { $this->error = $this->client->get_error(); return; } if ($result instanceof Pronamic_WP_Pay_Gateways_Sisow_Transaction) { $transaction = $result; $payment->set_status($transaction->status); $payment->set_consumer_name($transaction->consumer_name); $payment->set_consumer_account_number($transaction->consumer_account); $payment->set_consumer_city($transaction->consumer_city); } }
/** * Update lead status of the specified payment * * @see https://github.com/Charitable/Charitable/blob/1.1.4/includes/gateways/class-charitable-gateway-paypal.php#L229-L357 * @param Pronamic_Pay_Payment $payment */ public static function status_update(Pronamic_Pay_Payment $payment) { global $transaction; $transaction_id = $payment->get_source_id(); $transaction = new MeprTransaction($transaction_id); $should_update = !Pronamic_WP_Pay_Extensions_MemberPress_MemberPress::transaction_has_status($transaction, array(MeprTransaction::$failed_str, MeprTransaction::$complete_str)); if ($should_update) { $gateway = new Pronamic_WP_Pay_Extensions_MemberPress_Gateway(); switch ($payment->get_status()) { case Pronamic_WP_Pay_Statuses::CANCELLED: case Pronamic_WP_Pay_Statuses::EXPIRED: case Pronamic_WP_Pay_Statuses::FAILURE: $gateway->record_payment_failure(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: $gateway->record_payment(); break; case Pronamic_WP_Pay_Statuses::OPEN: default: break; } } }
public static function status_update(Pronamic_Pay_Payment $payment, $can_redirect = false) { $data = new Pronamic_WP_Pay_Extensions_S2Member_PaymentData(array('level' => get_post_meta($payment->get_id(), '_pronamic_payment_s2member_level', true), 'period' => get_post_meta($payment->get_id(), '_pronamic_payment_s2member_period', true))); $url = $data->get_normal_return_url(); switch ($payment->status) { case Pronamic_WP_Pay_Statuses::CANCELLED: $url = $data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::FAILURE: $url = $data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: $url = $data->get_success_url(); break; case Pronamic_WP_Pay_Statuses::OPEN: $url = $data->get_normal_return_url(); break; } if ($url && $can_redirect) { wp_redirect($url, 303); exit; } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $mollie_payment = $this->client->get_payment($payment->get_transaction_id()); if (!$mollie_payment) { $this->error = $this->client->get_error(); return; } $status = Pronamic_WP_Pay_Mollie_Statuses::transform($mollie_payment->status); $payment->set_status($status); $subscription = $payment->get_subscription(); if ($subscription && '' === $subscription->get_transaction_id()) { // First payment or non-subscription recurring payment, // use payment status for subscription too. $subscription->set_status($status); } if (isset($mollie_payment->details)) { $details = $mollie_payment->details; if (isset($details->consumerName)) { $payment->set_consumer_name($details->consumerName); } if (isset($details->consumerAccount)) { $payment->set_consumer_iban($details->consumerAccount); } } }
/** * Source column */ public static function source_text($text, Pronamic_Pay_Payment $payment) { $url = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $payment->get_source_id()), admin_url('admin.php')); $text = ''; $text .= __('Event Espresso', 'pronamic_ideal') . '<br />'; $text .= sprintf('<a href="%s">%s</a>', esc_attr($url), sprintf(__('Transaction %s', 'pronamic_ideal'), $payment->get_source_id())); return $text; }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $order = $this->client->get_order($payment->get_transaction_id()); if ($order) { $payment->set_status(Pronamic_WP_Pay_ING_KassaCompleet_Statuses::transform($order->status)); if (isset($order->transactions[0]->payment_method_details)) { $details = $order->transactions[0]->payment_method_details; if (isset($details->consumer_name)) { $payment->set_consumer_name($details->consumer_name); } if (isset($details->consumer_iban)) { $payment->set_consumer_iban($details->consumer_iban); } } } else { $this->error = $this->client->get_error(); } }
public function update_status(Pronamic_Pay_Payment $payment) { $merchant = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Merchant(); $merchant->account = $this->config->account_id; $merchant->site_id = $this->config->site_id; $merchant->site_secure_code = $this->config->site_code; $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_StatusRequestMessage($merchant, $payment->get_transaction_id()); $result = $this->client->get_status($message); if ($result) { $status = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Statuses::transform($result->ewallet->status); $payment->set_status($status); $payment->set_consumer_name($result->payment_details->account_holder_name); $payment->set_consumer_iban($result->payment_details->account_iban); $payment->set_consumer_bic($result->payment_details->account_bic); $payment->set_consumer_account_number($result->payment_details->account_id); } else { $this->error = $this->client->get_error(); } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $status = $this->client->check_status($this->config->layoutcode, $payment->get_transaction_id(), false, Pronamic_IDeal_IDeal::MODE_TEST === $this->config->mode); if ($status) { $payment->set_status(Pronamic_WP_Pay_Gateways_TargetPay_ResponseCodes::transform($status->code)); if (Pronamic_WP_Pay_Gateways_TargetPay_ResponseCodes::OK === $status->code) { $payment->set_consumer_name($status->account_name); $payment->set_consumer_account_number($status->account_number); $payment->set_consumer_city($status->account_city); } } }
/** * Get form HTML * * @return string */ public function get_form_html(Pronamic_Pay_Payment $payment, $auto_submit = false) { $html = ''; // Form $form_inner = ''; $form_inner .= $this->get_output_html(); $form_inner .= sprintf('<input class="btn btn-primary" type="submit" name="pay" value="%s" />', __('Pay', 'pronamic_ideal')); $form = sprintf('<form id="pronamic_ideal_form" name="pronamic_ideal_form" method="post" action="%s">%s</form>', esc_attr($payment->get_action_url()), $form_inner); // HTML $html .= $form; if ($auto_submit) { $html .= '<script type="text/javascript">document.pronamic_ideal_form.submit();</script>'; } return $html; }
/** * Source text * * @param text $text * @param Pronamic_Pay_Payment $payment * @return string */ public static function source_text($text, Pronamic_Pay_Payment $payment) { $text = ''; $text .= __('Membership', 'pronamic_ideal') . '<br />'; $text .= sprintf('<a href="%s">%s</a>', add_query_arg(array('page' => 'membershipgateways', 'action' => 'transactions', 'gateway' => 'pronamic_ideal'), admin_url('admin.php')), sprintf(__('Transaction #%s', 'pronamic_ideal'), $payment->get_id())); return $text; }
/** * Source column */ public static function source_text($text, Pronamic_Pay_Payment $payment) { $url = add_query_arg(array('page' => 'events', 'event_admin_reports' => 'event_list_attendees', 'all_a' => 'true'), admin_url('admin.php')); $text = ''; $text .= __('Event Espresso', 'pronamic_ideal') . '<br />'; $text .= sprintf('<a href="%s">%s</a>', esc_attr($url), sprintf(__('Attendee #%s', 'pronamic_ideal'), $payment->get_source_id())); return $text; }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $approval_code = filter_input(INPUT_POST, 'approval_code', FILTER_SANITIZE_STRING); $input_hash = filter_input(INPUT_POST, 'response_hash'); $hash_values = array($this->client->get_secret(), $approval_code, filter_input(INPUT_POST, 'chargetotal', FILTER_SANITIZE_STRING), filter_input(INPUT_POST, 'currency', FILTER_SANITIZE_STRING), filter_input(INPUT_POST, 'txndatetime', FILTER_SANITIZE_STRING), $this->client->get_storename()); if (filter_has_var(INPUT_POST, 'notification_hash')) { $input_hash = filter_input(INPUT_POST, 'notification_hash'); $hash_values = array(filter_input(INPUT_POST, 'chargetotal', FILTER_SANITIZE_STRING), $this->client->get_secret(), filter_input(INPUT_POST, 'currency', FILTER_SANITIZE_STRING), filter_input(INPUT_POST, 'txndatetime', FILTER_SANITIZE_STRING), $this->client->get_storename(), $approval_code); } $hash = Pronamic_WP_Pay_Gateways_EMS_ECommerce_Client::compute_hash($hash_values); // Check if the posted hash is equal to the calculated response or notification hash if (0 === strcasecmp($input_hash, $hash)) { $response_code = substr($approval_code, 0, 1); switch ($response_code) { case 'Y': $status = Pronamic_WP_Pay_Statuses::SUCCESS; break; case 'N': $status = Pronamic_WP_Pay_Statuses::FAILURE; $fail_code = filter_input(INPUT_POST, 'fail_rc', FILTER_SANITIZE_NUMBER_INT); if ('5993' === $fail_code) { $status = Pronamic_WP_Pay_Statuses::CANCELLED; } break; default: $status = Pronamic_WP_Pay_Statuses::OPEN; break; } // Set the status of the payment $payment->set_status($status); $labels = array('approval_code' => __('Approval code', 'pronamic_ideal'), 'oid' => __('Order ID', 'pronamic_ideal'), 'refnumber' => _x('Reference number', 'creditcard', 'pronamic_ideal'), 'status' => __('Status', 'pronamic_ideal'), 'txndate_processed' => __('Time of transaction processing', 'pronamic_ideal'), 'tdate' => __('Identification for transaction', 'pronamic_ideal'), 'fail_reason' => __('Fail reason', 'pronamic_ideal'), 'response_hash' => __('Response hash', 'pronamic_ideal'), 'processor_response_code' => __('Processor response code', 'pronamic_ideal'), 'fail_rc' => __('Fail code', 'pronamic_ideal'), 'terminal_id' => __('Terminal ID', 'pronamic_ideal'), 'ccbin' => __('Creditcard issuing bank', 'pronamic_ideal'), 'cccountry' => __('Creditcard country', 'pronamic_ideal'), 'ccbrand' => __('Creditcard brand', 'pronamic_ideal')); $note = ''; $note .= '<p>'; $note .= __('EMS e-Commerce transaction data in response message:', 'pronamic_ideal'); $note .= '</p>'; $note .= '<dl>'; foreach ($labels as $key => $label) { if (filter_has_var(INPUT_POST, $key)) { $note .= sprintf('<dt>%s</dt>', esc_html($label)); $note .= sprintf('<dd>%s</dd>', esc_html(filter_input(INPUT_POST, $key, FILTER_SANITIZE_STRING))); } } $note .= '</dl>'; $payment->add_note($note); } }
/** * Update the status of the specified payment * * @param Pronamic_Pay_Payment $payment * @param bool $can_redirect (optional, defaults to false) */ public static function status_update(Pronamic_Pay_Payment $payment, $can_redirect = false) { // Create empty payment data object to be able to get the URLs $empty_data = new Pronamic_WP_Pay_Extensions_IThemesExchange_PaymentData(0, new stdClass()); switch ($payment->get_status()) { case Pronamic_WP_Pay_Statuses::CANCELLED: $url = $empty_data->get_cancel_url(); break; case Pronamic_WP_Pay_Statuses::EXPIRED: $url = $empty_data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::FAILURE: $url = $empty_data->get_error_url(); break; case Pronamic_WP_Pay_Statuses::SUCCESS: $transient_transaction = it_exchange_get_transient_transaction(self::$slug, $payment->get_source_id()); // Create transaction $transaction_id = it_exchange_add_transaction(self::$slug, $payment->get_source_id(), Pronamic_WP_Pay_Extensions_IThemesExchange_IThemesExchange::ORDER_STATUS_PAID, $transient_transaction['customer_id'], $transient_transaction['transaction_object']); // A transaction ID is numeric on success if (!is_numeric($transaction_id)) { $url = $empty_data->get_error_url(); break; } $data = new Pronamic_WP_Pay_Extensions_IThemesExchange_PaymentData($transaction_id, new stdClass()); $url = $data->get_success_url(); it_exchange_empty_shopping_cart(); break; case Pronamic_WP_Pay_Statuses::OPEN: default: $url = $empty_data->get_normal_return_url(); break; } if ($can_redirect) { wp_redirect($url, 303); exit; } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $result = $this->client->get_payment_status($payment->get_id()); if ($result) { $payment->set_status(Pronamic_WP_Pay_Gateways_PayDutch_States::transform($result->state)); $payment->set_consumer_name($result->consumername); $payment->set_consumer_account_number($result->consumeraccount); $payment->set_consumer_city($result->consumercity); // $payment->set_consumer_country( $result->consumercountry ); } else { $this->error = $this->client->get_error(); } }
/** * Update status of the specified payment * * @param Pronamic_Pay_Payment $payment */ public function update_status(Pronamic_Pay_Payment $payment) { $result = $this->client->get_status($payment->get_transaction_id()); $error = $this->client->get_error(); if (null !== $error) { $this->set_error($error); } else { $transaction = $result->transaction; $payment->set_status($transaction->getStatus()); $payment->set_consumer_name($transaction->getConsumerName()); $payment->set_consumer_account_number($transaction->getConsumerAccountNumber()); $payment->set_consumer_city($transaction->getConsumerCity()); } }
/** * Update status payment note * * @param Pronamic_Pay_Payment $payment * @param array $data */ private function update_status_payment_note(Pronamic_Pay_Payment $payment, $data) { $labels = array('STATUS' => __('Status', 'pronamic_ideal'), 'ORDERID' => __('Order ID', 'pronamic_ideal'), 'CURRENCY' => __('Currency', 'pronamic_ideal'), 'AMOUNT' => __('Amount', 'pronamic_ideal'), 'PM' => __('Payment Method', 'pronamic_ideal'), 'ACCEPTANCE' => __('Acceptance', 'pronamic_ideal'), 'STATUS' => __('Status', 'pronamic_ideal'), 'CARDNO' => __('Card Number', 'pronamic_ideal'), 'ED' => __('End Date', 'pronamic_ideal'), 'CN' => __('Customer Name', 'pronamic_ideal'), 'TRXDATE' => __('Transaction Date', 'pronamic_ideal'), 'PAYID' => __('Pay ID', 'pronamic_ideal'), 'NCERROR' => __('NC Error', 'pronamic_ideal'), 'BRAND' => __('Brand', 'pronamic_ideal'), 'IP' => __('IP', 'pronamic_ideal'), 'SHASIGN' => __('SHA Signature', 'pronamic_ideal')); $note = ''; $note .= '<p>'; $note .= __('Ogone transaction data in response message:', 'pronamic_ideal'); $note .= '</p>'; $note .= '<dl>'; foreach ($labels as $key => $label) { if (isset($data[$key]) && '' !== $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); }