Beispiel #1
0
 /**
  * Start transaction with the specified data
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_Payment $payment)
 {
     $payment->set_action_url($this->client->get_payment_server_url());
     $ogone_data = $this->client->get_data();
     // General
     $ogone_data_general = new Pronamic_WP_Pay_Gateways_Ogone_DataGeneralHelper($ogone_data);
     $ogone_data_general->set_order_id($payment->format_string($this->config->order_id))->set_order_description($payment->get_description())->set_param_plus('payment_id=' . $payment->get_id())->set_currency($payment->get_currency())->set_amount($payment->get_amount())->set_language($payment->get_locale());
     // Customer
     $ogone_data_customer = new Pronamic_WP_Pay_Gateways_Ogone_DataCustomerHelper($ogone_data);
     $ogone_data_customer->set_name($payment->get_customer_name())->set_email($payment->get_email())->set_address($payment->get_address())->set_zip($payment->get_zip())->set_town($payment->get_city())->set_country($payment->get_country())->set_telephone_number($payment->get_telephone_number());
     // URL's
     $ogone_url_helper = new Pronamic_WP_Pay_Gateways_Ogone_DataUrlHelper($ogone_data);
     $ogone_url_helper->set_accept_url(add_query_arg('status', Pronamic_WP_Pay_Statuses::SUCCESS, $payment->get_return_url()))->set_cancel_url(add_query_arg('status', Pronamic_WP_Pay_Statuses::CANCELLED, $payment->get_return_url()))->set_decline_url(add_query_arg('status', Pronamic_WP_Pay_Statuses::FAILURE, $payment->get_return_url()))->set_exception_url(add_query_arg('status', Pronamic_WP_Pay_Statuses::FAILURE, $payment->get_return_url()))->set_back_url(home_url('/'))->set_home_url(home_url('/'));
 }
Beispiel #2
0
 /**
  * Start
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  * @param Pronamic_Pay_Payment $payment
  */
 public function start(Pronamic_Pay_Payment $payment)
 {
     $ogone_data = new Pronamic_WP_Pay_Gateways_Ogone_Data();
     // General
     $ogone_data_general = new Pronamic_WP_Pay_Gateways_Ogone_DataGeneralHelper($ogone_data);
     $ogone_data_general->set_psp_id($this->client->psp_id)->set_order_id($payment->format_string($this->config->order_id))->set_order_description($payment->get_description())->set_param_plus('payment_id=' . $payment->get_id())->set_currency($payment->get_currency())->set_amount($payment->get_amount())->set_language($payment->get_locale());
     // Customer
     $ogone_data_customer = new Pronamic_WP_Pay_Gateways_Ogone_DataCustomerHelper($ogone_data);
     $ogone_data_customer->set_name($payment->get_customer_name())->set_email($payment->get_email())->set_address($payment->get_address())->set_zip($payment->get_zip())->set_town($payment->get_city())->set_country($payment->get_country())->set_telephone_number($payment->get_telephone_number());
     // DirectLink
     $ogone_data_directlink = new Pronamic_WP_Pay_Gateways_Ogone_DirectLink_DataHelper($ogone_data);
     $ogone_data_directlink->set_user_id($this->client->user_id)->set_password($this->client->password);
     // Credit card
     $ogone_data_credit_card = new Pronamic_WP_Pay_Gateways_Ogone_DataCreditCardHelper($ogone_data);
     $credit_card = $payment->get_credit_card();
     $ogone_data_credit_card->set_number($credit_card->get_number())->set_expiration_date($credit_card->get_expiration_date())->set_security_code($credit_card->get_security_code());
     $ogone_data->set_field('OPERATION', 'SAL');
     // 3-D Secure
     if ($this->config->enabled_3d_secure) {
         $secure_data_helper = new Pronamic_WP_Pay_Gateways_Ogone_3DSecure_DataHelper($ogone_data);
         $secure_data_helper->set_3d_secure_flag(true)->set_http_accept(Pronamic_WP_Pay_Server::get('HTTP_ACCEPT'))->set_http_user_agent(Pronamic_WP_Pay_Server::get('HTTP_USER_AGENT'))->set_window('MAINW');
         $ogone_data->set_field('ACCEPTURL', $payment->get_return_url());
         $ogone_data->set_field('DECLINEURL', $payment->get_return_url());
         $ogone_data->set_field('EXCEPTIONURL', $payment->get_return_url());
         $ogone_data->set_field('COMPLUS', '');
     }
     // Signature
     $calculation_fields = Pronamic_WP_Pay_Gateways_Ogone_Security::get_calculations_parameters_in();
     $fields = Pronamic_WP_Pay_Gateways_Ogone_Security::get_calculation_fields($calculation_fields, $ogone_data->get_fields());
     $signature = Pronamic_WP_Pay_Gateways_Ogone_Security::get_signature($fields, $this->config->sha_in_pass_phrase, $this->config->hash_algorithm);
     $ogone_data->set_field('SHASIGN', $signature);
     // Order
     $result = $this->client->order_direct($ogone_data->get_fields());
     $error = $this->client->get_error();
     if (is_wp_error($error)) {
         $this->error = $error;
     } else {
         $payment->set_transaction_id($result->pay_id);
         $payment->set_action_url($payment->get_return_url());
         $payment->set_status(Pronamic_WP_Pay_Gateways_Ogone_Statuses::transform($result->status));
         if (!empty($result->html_answer)) {
             $payment->set_meta('ogone_directlink_html_answer', $result->html_answer);
             $payment->set_action_url(add_query_arg('payment_redirect', $payment->get_id(), home_url('/')));
         }
     }
 }
Beispiel #3
0
 /**
  * Start
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_Payment $payment)
 {
     $payment->set_action_url($this->client->get_payment_server_url());
     $ogone_data = $this->client->get_data();
     // General
     $ogone_data_general = new Pronamic_WP_Pay_Gateways_Ogone_DataGeneralHelper($ogone_data);
     $ogone_data_general->set_order_id($payment->format_string($this->config->order_id))->set_order_description($payment->get_description())->set_param_plus('payment_id=' . $payment->get_id())->set_currency($payment->get_currency())->set_amount($payment->get_amount())->set_language($payment->get_locale());
     // Customer
     $ogone_data_customer = new Pronamic_WP_Pay_Gateways_Ogone_DataCustomerHelper($ogone_data);
     $ogone_data_customer->set_name($payment->get_customer_name())->set_email($payment->get_email())->set_address($payment->get_address())->set_zip($payment->get_zip())->set_town($payment->get_city())->set_country($payment->get_country())->set_telephone_number($payment->get_telephone_number());
     // Payment method
     // @see https://github.com/wp-pay-gateways/ogone/wiki/Brands
     switch ($payment->get_method()) {
         case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD:
             /*
              * Set credit card payment method.
              * @since 1.2.3
              */
             $ogone_data_general->set_payment_method(Pronamic_WP_Pay_Gateways_Ogone_PaymentMethods::CREDIT_CARD);
             break;
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             /*
              * Set iDEAL payment method.
              * @since 1.2.3
              */
             $ogone_data_general->set_brand(Pronamic_WP_Pay_Gateways_Ogone_Brands::IDEAL)->set_payment_method(Pronamic_WP_Pay_Gateways_Ogone_PaymentMethods::IDEAL);
             break;
         case Pronamic_WP_Pay_PaymentMethods::BANCONTACT:
         case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
             $ogone_data_general->set_brand(Pronamic_WP_Pay_Gateways_Ogone_Brands::BCMC)->set_payment_method(Pronamic_WP_Pay_Gateways_Ogone_PaymentMethods::CREDIT_CARD);
             break;
     }
     // Parameter Variable
     $param_var = Pronamic_WP_Pay_Gateways_Ogone_Util::get_param_var($this->config->param_var);
     if (!empty($param_var)) {
         $ogone_data->set_field('PARAMVAR', $param_var);
     }
     // Template Page
     $template_page = $this->config->param_var;
     if (!empty($template_page)) {
         $ogone_data->set_field('TP', $template_page);
     }
     // URL's
     $ogone_url_helper = new Pronamic_WP_Pay_Gateways_Ogone_DataUrlHelper($ogone_data);
     $ogone_url_helper->set_accept_url(add_query_arg('status', 'accept', $payment->get_return_url()))->set_cancel_url(add_query_arg('status', 'cancel', $payment->get_return_url()))->set_decline_url(add_query_arg('status', 'decline', $payment->get_return_url()))->set_exception_url(add_query_arg('status', 'exception', $payment->get_return_url()));
 }