/** * Start * * @see Pronamic_WP_Pay_Gateway::start() */ public function start(Pronamic_Pay_Payment $payment) { $order_id = $payment->get_order_id(); $purchase_id = empty($order_id) ? $payment->get_id() : $order_id; // Maximum length for purchase ID is 16 characters, otherwise an error will occur: // ideal_sisow_error - purchaseid too long (16) $purchase_id = substr($purchase_id, 0, 16); $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; $payment_method = $payment->get_method(); if (is_null($payment_method)) { $payment_method = Pronamic_WP_Pay_PaymentMethods::IDEAL; } $this->set_payment_method($payment_method); switch ($payment_method) { case Pronamic_WP_Pay_PaymentMethods::BANK_TRANSFER: $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::OVERBOEKING; break; case Pronamic_WP_Pay_PaymentMethods::IDEAL: $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::IDEAL; break; case Pronamic_WP_Pay_PaymentMethods::BANCONTACT: case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH: $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::MISTER_CASH; break; case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD: $transaction_request->payment = Pronamic_WP_Pay_Gateways_Sisow_PaymentMethods::CREDIT_CARD; break; } $transaction_request->set_purchase_id($purchase_id); $transaction_request->amount = $payment->get_amount(); $transaction_request->issuer_id = $payment->get_issuer(); $transaction_request->test_mode = Pronamic_IDeal_IDeal::MODE_TEST === $this->config->mode; $transaction_request->set_entrance_code($payment->get_entrance_code()); $transaction_request->description = $payment->get_description(); $transaction_request->billing_mail = $payment->get_email(); $transaction_request->return_url = $payment->get_return_url(); $transaction_request->cancel_url = $payment->get_return_url(); $transaction_request->callback_url = $payment->get_return_url(); $transaction_request->notify_url = $payment->get_return_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 * * @see Pronamic_WP_Pay_Gateway::start() */ public function start(Pronamic_Pay_Payment $payment) { // Purchase ID $purchase_id = $payment->format_string($this->config->purchase_id); $payment->set_meta('purchase_id', $purchase_id); // Transaction $transaction = new Pronamic_WP_Pay_Gateways_IDealAdvancedV3_Transaction(); $transaction->set_purchase_id($purchase_id); $transaction->set_amount($payment->get_amount()); $transaction->set_currency($payment->get_currency()); $transaction->set_expiration_period('PT30M'); $transaction->set_language($payment->get_language()); $transaction->set_description($payment->get_description()); $transaction->set_entrance_code($payment->get_entrance_code()); $result = $this->client->create_transaction($transaction, $payment->get_return_url(), $payment->get_issuer()); $error = $this->client->get_error(); if (is_wp_error($error)) { $this->set_error($error); return; } $payment->set_action_url($result->issuer->get_authentication_url()); $payment->set_transaction_id($result->transaction->get_id()); }