/** * 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()); }
/** * 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(); } }
/** * 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); } }
/** * 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; } }