Пример #1
0
 /**
  * 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)
 {
     $request = new Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest();
     $request->amount = $data->get_amount();
     $request->description = $data->get_description();
     $request->redirect_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $request->locale = Pronamic_WP_Pay_Mollie_LocaleHelper::transform($data->get_language());
     switch ($payment_method) {
         case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD:
             $request->method = Pronamic_WP_Pay_Mollie_Methods::CREDITCARD;
             break;
         case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
             $request->method = Pronamic_WP_Pay_Mollie_Methods::MISTERCASH;
             break;
         case Pronamic_WP_Pay_PaymentMethods::SOFORT:
             $request->method = Pronamic_WP_Pay_Mollie_Methods::SOFORT;
             break;
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             // @since 1.1.2
             $request->method = Pronamic_WP_Pay_Mollie_Methods::IDEAL;
             break;
     }
     $result = $this->client->create_payment($request);
     if ($result) {
         $payment->set_transaction_id($result->id);
         $payment->set_action_url($result->links->paymentUrl);
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #2
0
 /**
  * Start
  *
  * @param Pronamic_Pay_PaymentDataInterface $data
  * @param Pronamic_Pay_Payment              $payment
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $payment_method = null)
 {
     $payment->set_action_url($this->client->get_payment_server_url());
     // Buckaroo uses 'nl-NL' instead of 'nl_NL'
     $culture = str_replace('_', '-', $data->get_language_and_country());
     switch ($payment_method) {
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             $this->client->set_payment_method(Pronamic_WP_Pay_Buckaroo_PaymentMethods::IDEAL);
             break;
         case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD:
             $this->client->add_requested_service(Pronamic_WP_Pay_Buckaroo_PaymentMethods::AMERICAN_EXPRESS);
             $this->client->add_requested_service(Pronamic_WP_Pay_Buckaroo_PaymentMethods::MAESTRO);
             $this->client->add_requested_service(Pronamic_WP_Pay_Buckaroo_PaymentMethods::MASTERCARD);
             $this->client->add_requested_service(Pronamic_WP_Pay_Buckaroo_PaymentMethods::VISA);
             break;
         case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
             $this->client->set_payment_method(Pronamic_WP_Pay_Buckaroo_PaymentMethods::BANCONTACT_MISTER_CASH);
             break;
     }
     $this->client->set_culture($culture);
     $this->client->set_currency($data->get_currency());
     $this->client->set_description($data->get_description());
     $this->client->set_amount($data->get_amount());
     $this->client->set_invoice_number($payment->get_id());
     $return_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $this->client->set_return_url($return_url);
     $this->client->set_return_cancel_url($return_url);
     $this->client->set_return_error_url($return_url);
     $this->client->set_return_reject_url($return_url);
 }
Пример #3
0
 public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $payment_method = null)
 {
     $url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $transaction_description = $data->get_description();
     if (empty($transaction_description)) {
         $transaction_description = $payment->get_id();
     }
     $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;
     $merchant->notification_url = $url;
     $merchant->redirect_url = $url;
     $merchant->cancel_url = $url;
     $merchant->close_window = 'false';
     $customer = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Customer();
     $customer->locale = $data->get_language_and_country();
     $customer->ip_address = Pronamic_WP_Pay_Server::get('REMOTE_ADDR', FILTER_VALIDATE_IP);
     $customer->forwarded_ip = Pronamic_WP_Pay_Server::get('HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP);
     $customer->first_name = $data->getCustomerName();
     $customer->email = $data->get_email();
     $transaction = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Transaction();
     $transaction->id = uniqid();
     $transaction->currency = $data->get_currency();
     $transaction->amount = $data->get_amount();
     $transaction->description = $transaction_description;
     switch ($payment_method) {
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             $gateway_info = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_GatewayInfo();
             $gateway_info->issuer_id = $data->get_issuer_id();
             $transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::IDEAL;
             $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_DirectTransactionRequestMessage($merchant, $customer, $transaction, $gateway_info);
             break;
         case Pronamic_WP_Pay_PaymentMethods::BANK_TRANSFER:
             $transaction->gateway = Pronamic_WP_Pay_Gateways_MultiSafepay_Gateways::BANK_TRANSFER;
             $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage($merchant, $customer, $transaction);
             break;
         default:
             $message = new Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_XML_RedirectTransactionRequestMessage($merchant, $customer, $transaction);
     }
     $signature = Pronamic_WP_Pay_Gateways_MultiSafepay_Connect_Signature::generate($transaction->amount, $transaction->currency, $merchant->account, $merchant->site_id, $transaction->id);
     $message->signature = $signature;
     $response = $this->client->start_transaction($message);
     if ($response) {
         $transaction = $response->transaction;
         $payment->set_transaction_id($transaction->id);
         if ($transaction->payment_url) {
             $payment->set_action_url($transaction->payment_url);
         }
         if ($response->gateway_info && $response->gateway_info->redirect_url) {
             $payment->set_action_url($response->gateway_info->redirect_url);
         }
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #4
0
 /**
  * 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)
 {
     $result = $this->client->create_transaction($data->get_amount(), $data->get_currency(), $data->get_issuer_id(), $data->get_description(), add_query_arg('payment', $payment->get_id(), home_url('/')));
     if (false !== $result) {
         $payment->set_transaction_id($result->transaction_id);
         $payment->set_action_url($result->bank_url);
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #5
0
 /**
  * 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)
 {
     $result = $this->client->transaction_start($data->get_amount(), Pronamic_WP_Pay_Gateways_PayNL_Util::get_ip_address(), add_query_arg('payment', $payment->get_id(), home_url('/')));
     if (isset($result, $result->transaction)) {
         $transaction_id = $result->transaction->transactionId;
         $payment_url = $result->transaction->paymentURL;
         $payment->set_transaction_id($transaction_id);
         $payment->set_action_url($payment_url);
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #6
0
 /**
  * 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());
 }
Пример #7
0
 /**
  * Start
  *
  * @param Pronamic_Pay_PaymentDataInterface $data
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $method = null)
 {
     $transaction_request = $this->client->get_transaction_request();
     $transaction_request->reference = $payment->get_id();
     $transaction_request->description = $data->get_description();
     $transaction_request->amount = $data->get_amount();
     $transaction_request->method_code = Pronamic_WP_Pay_Gateways_PayDutch_Methods::WEDEAL;
     $transaction_request->issuer_id = $data->get_issuer_id();
     $transaction_request->test = true;
     $transaction_request->success_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $transaction_request->fail_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $result = $this->client->request_transaction($transaction_request);
     if ($result) {
         $payment->set_action_url($result->url);
         $payment->set_transaction_id($result->id);
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #8
0
 /**
  * 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)
 {
     $order_id = $data->get_order_id();
     $purchase_id = empty($order_id) ? $payment->get_id() : $order_id;
     $transaction_request = new Pronamic_WP_Pay_Gateways_Sisow_TransactionRequest();
     $transaction_request->merchant_id = $this->config->merchant_id;
     $transaction_request->shop_id = $this->config->shop_id;
     switch ($payment_method) {
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::IDEAL;
             break;
         case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
             $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::MISTER_CASH;
             break;
     }
     $transaction_request->set_purchase_id($purchase_id);
     $transaction_request->amount = $data->get_amount();
     $transaction_request->issuer_id = $data->get_issuer_id();
     $transaction_request->test_mode = Pronamic_IDeal_IDeal::MODE_TEST === $this->config->mode;
     $transaction_request->set_entrance_code($data->get_entrance_code());
     $transaction_request->description = $data->get_description();
     $transaction_request->return_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $transaction_request->cancel_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $transaction_request->callback_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $transaction_request->notify_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $result = $this->client->create_transaction($transaction_request);
     if (false !== $result) {
         $payment->set_transaction_id($result->id);
         $payment->set_action_url($result->issuer_url);
     } else {
         $this->error = $this->client->get_error();
     }
 }
Пример #9
0
 /**
  * Start an transaction
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $payment_method = null)
 {
     try {
         $locale = $data->get_language_and_country();
         $language = substr($locale, 0, 2);
         $country = substr($locale, 3, 2);
         /*
          * Order ID
          * Your unique order number.
          * This can be auto incremental number from your payments table
          *
          * Data type  = String
          * Max length = 10
          * Required   = Yes
          */
         // Payment object
         $payment_object = new Icepay_PaymentObject();
         $payment_object->setAmount(Pronamic_WP_Pay_Util::amount_to_cents($data->get_amount()))->setCountry($country)->setLanguage($language)->setReference($data->get_order_id())->setDescription($data->get_description())->setCurrency($data->get_currency())->setIssuer($data->get_issuer_id())->setOrderID($payment->get_id());
         // Payment method
         // @since 1.2.0
         $icepay_method = null;
         switch ($payment_method) {
             case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD:
                 // @see https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/creditcard.php
                 $icepay_method = new Icepay_Paymentmethod_Creditcard();
                 break;
             case Pronamic_WP_Pay_PaymentMethods::DIRECT_DEBIT:
                 // @see https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/ddebit.php
                 $icepay_method = new Icepay_Paymentmethod_Ddebit();
                 break;
             case Pronamic_WP_Pay_PaymentMethods::IDEAL:
                 // @see https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/ideal.php
                 $icepay_method = new Icepay_Paymentmethod_Ideal();
                 break;
             case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
                 // @see https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/mistercash.php
                 $icepay_method = new Icepay_Paymentmethod_Mistercash();
                 break;
         }
         if (isset($icepay_method)) {
             // @see https://github.com/icepay/icepay/blob/2.4.0/api/icepay_api_base.php#L342-L353
             $payment_object->setPaymentMethod($icepay_method->getCode());
         }
         // Protocol
         $protocol = is_ssl() ? 'https' : 'http';
         // Basic mode
         $basicmode = Icepay_Basicmode::getInstance();
         $basicmode->setMerchantID($this->config->merchant_id)->setSecretCode($this->config->secret_code)->setProtocol($protocol)->validatePayment($payment_object);
         // Payment
         $payment->set_action_url($basicmode->getURL());
     } catch (Exception $exception) {
         $this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception);
     }
 }
Пример #10
0
 /**
  * Start
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  */
 public function start(Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Payment $payment, $payment_method = null)
 {
     $parameters = new Pronamic_WP_Pay_Gateways_TargetPay_IDealStartParameters();
     $parameters->rtlo = $this->config->layoutcode;
     $parameters->bank = $data->get_issuer_id();
     $parameters->description = $data->get_description();
     $parameters->amount = $data->get_amount();
     $parameters->return_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $parameters->report_url = add_query_arg('payment', $payment->get_id(), home_url('/'));
     $parameters->cinfo_in_callback = 1;
     $result = $this->client->start_transaction($parameters);
     if ($result) {
         $payment->set_action_url($result->url);
         $payment->set_transaction_id($result->transaction_id);
     } else {
         $this->set_error($this->client->get_error());
     }
     // Schedule transaction status request
     // @since 1.0.3
     $time = time();
     wp_schedule_single_event($time + 30, 'pronamic_ideal_check_transaction_status', array('payment_id' => $payment->get_id(), 'seconds' => 30));
 }
Пример #11
0
 /**
  * Start
  *
  * @see Pronamic_WP_Pay_Gateway::start()
  * @param Pronamic_Pay_PaymentDataInterface $data
  */
 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_action_url());
     $this->client->set_customer_language(Pronamic_WP_Pay_Gateways_OmniKassa_LocaleHelper::transform($data->get_language()));
     $this->client->set_currency_numeric_code($data->get_currency_numeric_code());
     $this->client->set_order_id($data->get_order_id());
     $this->client->set_normal_return_url(home_url('/'));
     $this->client->set_automatic_response_url(home_url('/'));
     $this->client->set_amount($data->get_amount());
     $this->client->set_transaction_reference($payment->get_transaction_id());
     switch ($payment_method) {
         /*
          * If this field is not supplied in the payment request, then
          * by default the customer will be redirected to the Rabo
          * OmniKassa payment page. On the payment page, the
          * customer can choose from the payment methods
          * offered by the Rabo OmniKassa. These are the payment
          * methods: IDEAL, MINITIX, VISA, MASTERCARD,
          * MAESTRO, V PAY and BCMC.
          *
          * Exception: the register services INCASSO (direct debit),
          * ACCEPTGIRO (giro collection form) and REMBOURS
          * (cash on delivery) are not displayed on the Rabo
          * OmniKassa payment page by default.
          * If you wish to offer these register services to the
          * customer on the payment page, then you need to
          * always populate the paymentMeanBrandList field with
          * all the payment methods you wish to offer (provided
          * these have been requested and activated): IDEAL,
          * MINITIX, VISA, MASTERCARD, MAESTRO, VPAY, BCMC,
          * INCASSO, ACCEPTGIRO, REMBOURS.
          *
          * If you let the customer choose the payment method
          * while still in your webshop, then you must populate
          * this field of the payment request with only the selected
          * payment method. Populating this field with only one
          * payment method will instruct the Rabo OmniKassa to
          * redirect the customer directly to the payment page for
          * this payment method.
          */
         case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MAESTRO);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MASTERCARD);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::VISA);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::VPAY);
             break;
         case Pronamic_WP_Pay_PaymentMethods::DIRECT_DEBIT:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::INCASSO);
             break;
         case Pronamic_WP_Pay_PaymentMethods::IDEAL:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::IDEAL);
             break;
         case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::BCMC);
             break;
         case Pronamic_WP_Pay_PaymentMethods::MINITIX:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MINITIX);
             break;
         default:
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::IDEAL);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MINITIX);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::VISA);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MASTERCARD);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::MAESTRO);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::VPAY);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::BCMC);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::INCASSO);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::ACCEPTGIRO);
             $this->client->add_payment_mean_brand(Pronamic_WP_Pay_Gateways_OmniKassa_PaymentMethods::REMBOURS);
             break;
     }
 }