function pay($amount, $description, $bank_id) { require_once 'ideal.class.php'; //$amount = 118; // Het af te rekenen bedrag in centen (!!!) //$description = 'Testbetaling'; // Beschrijving die consument op zijn/haar afschrift ziet. $return_url = $this->return_url; // URL waarnaar de consument teruggestuurd wordt na de betaling $report_url = $this->report_url; // URL die Mollie aanvraagt (op de achtergrond) na de betaling om de status naar op te sturen if (!in_array('ssl', stream_get_transports())) { echo "<h1>Foutmelding</h1>"; echo "<p>Uw PHP installatie heeft geen SSL ondersteuning. SSL is nodig voor de communicatie met de Mollie iDEAL API.</p>"; exit; } $iDEAL = new iDEAL_Payment($this->partnerID); if ($this->testMode) { $iDEAL->setTestMode(); } if (isset($bank_id) and !empty($bank_id)) { if ($iDEAL->createPayment($bank_id, $amount, $description, $return_url, $report_url)) { /* Hier kunt u de aangemaakte betaling opslaan in uw database, bijv. met het unieke transactie_id Het transactie_id kunt u aanvragen door $iDEAL->getTransactionId() te gebruiken. Hierna wordt de consument automatisch doorgestuurd naar de gekozen bank. */ $data = array('transactionId' => $iDEAL->getTransactionId(), 'bankUrl' => $iDEAL->getBankURL()); return $data; //header("Location: " . $iDEAL->getBankURL()); //exit; } else { /* Er is iets mis gegaan bij het aanmaken bij de betaling. U kunt meer informatie vinden over waarom het mis is gegaan door $iDEAL->getErrorMessage() en/of $iDEAL->getErrorCode() te gebruiken. */ $data = array('error' => true, 'msg' => $iDEAL->getErrorMessage()); return $data; } } }
function mollieideal_link($params) { $gatewaypartnerid = $params['partnerid']; if (empty($params['customDescription'])) { $gatewaydescription = $params['description']; } $return_url = $params['returnurl']; $report_url = $params['systemurl'] . "/modules/gateways/callback/mollieideal.php?invoiceid=" . urlencode($params['invoiceid']) . "&amount=" . urlencode($params['amount']) . "&fee=" . urlencode($params['fee']); $invoiceid = $params['invoiceid']; $description = $params['description']; $amount = $params['amount']; $currency = $params['currency']; $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $email = $params['clientdetails']['email']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $phone = $params['clientdetails']['phonenumber']; $companyname = $params['companyname']; $systemurl = $params['systemurl']; $currency = $params['currency']; if (!in_array("ssl", stream_get_transports())) { $code = "<h1>Foutmelding</h1>"; $code .= "<p>Uw PHP installatie heeft geen SSL ondersteuning. SSL is nodig voor de communicatie met de Mollie iDEAL API.</p>"; return $code; } $iDEAL = new iDEAL_Payment($gatewaypartnerid); if (isset($_POST['bank_id']) && !empty($_POST['bank_id'])) { $idealAmount = $amount * 100; if ($iDEAL->createPayment($_POST['bank_id'], $idealAmount, $gatewaydescription, $return_url, $report_url)) { header("Location: " . $iDEAL->getBankURL()); exit; } else { $code = "<p>De betaling kon niet aangemaakt worden.</p>"; $code .= "<p><strong>Foutmelding:</strong> " . $iDEAL->getErrorMessage() . "</p>"; return $code; } } $bank_array = $iDEAL->getBanks(); if ($bank_array == false) { return "<p>Er is een fout opgetreden bij het ophalen van de banklijst: " . $iDEAL->getErrorMessage() . "</p>"; } $code = "<form method=\"post\">\n\t<select name=\"bank_id\">\n\t\t<option value=\"\">Kies uw bank</option>"; foreach ($bank_array as $bank_id => $bank_name) { $code .= "<option value=\"" . $bank_id . "\">" . $bank_name . "</option>"; } $code .= "</select>\n\t<input type=\"submit\" name=\"submit\" value=\"Betaal via iDEAL\" />\n</form>"; return $code; }
// Het af te rekenen bedrag in centen (!!!) $description = 'Testbetaling'; // Beschrijving die consument op zijn/haar afschrift ziet. $return_url = 'http://www.domein.nl/return.php'; // URL waarnaar de consument teruggestuurd wordt na de betaling $report_url = 'http://www.domein.nl/report.php'; // URL die Mollie aanvraagt (op de achtergrond) na de betaling om de status naar op te sturen if (!in_array('ssl', stream_get_transports())) { echo "<h1>Foutmelding</h1>"; echo "<p>Uw PHP installatie heeft geen SSL ondersteuning. SSL is nodig voor de communicatie met de Mollie iDEAL API.</p>"; exit; } $iDEAL = new iDEAL_Payment($partner_id); //$iDEAL->setTestMode(); if (isset($_POST['bank_id']) and !empty($_POST['bank_id'])) { if ($iDEAL->createPayment($_POST['bank_id'], $amount, $description, $return_url, $report_url)) { /* Hier kunt u de aangemaakte betaling opslaan in uw database, bijv. met het unieke transactie_id Het transactie_id kunt u aanvragen door $iDEAL->getTransactionId() te gebruiken. Hierna wordt de consument automatisch doorgestuurd naar de gekozen bank. */ header("Location: " . $iDEAL->getBankURL()); exit; } else { /* Er is iets mis gegaan bij het aanmaken bij de betaling. U kunt meer informatie vinden over waarom het mis is gegaan door $iDEAL->getErrorMessage() en/of $iDEAL->getErrorCode() te gebruiken. */ echo '<p>De betaling kon niet aangemaakt worden.</p>'; echo '<p><strong>Foutmelding:</strong> ', $iDEAL->getErrorMessage(), '</p>'; exit; } } /*
function showEndForm($pmconfigs, $order) { $mainframe =& JFactory::getApplication(); $jshopConfig =& JSFactory::getConfig(); $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number); $notify_url = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_ideal&no_lang=1"; $return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_ideal"; $cancel_return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=pm_ideal"; $params_data = $order->getPaymentParamsData(); $bank_id = $params_data['bank_id']; $amount = intval($order->order_total * 100); $iDEAL = new iDEAL_Payment($pmconfigs['partnerid']); if ($pmconfigs['testmode']) { $iDEAL->setTestMode(); } if ($iDEAL->createPayment($bank_id, $amount, $item_name, $return, $notify_url)) { $order1 =& JTable::getInstance('order', 'jshop'); $order1->load($order->order_id); $order1->transaction = $iDEAL->getTransactionId(); $order1->store(); header("Location: " . $iDEAL->getBankURL()); exit; } else { saveToLog("payment.log", "Error: Order ID " . $order->order_id . ". CODE: " . $iDEAL->getErrorCode() . ". MSG: " . $iDEAL->getErrorMessage()); JError::raiseWarning("", $iDEAL->getErrorMessage()); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); exit; } }
public function transmitRequestXML($xml, $request) { require_once dirname(__FILE__) . '/lib/cls.ideal.php'; $response = array(); $response['valid'] = false; $description = substr(AECToolbox::rewriteEngineRQ($this->settings['description'], $request), 0, 29); $report_url = AECToolbox::deadsureURL("index.php?option=com_acctexp&task=mollie_idealnotification"); $return_url = $request->int_var['return_url']; $amount = $request->int_var['amount'] * 100; $mollieIdeal = new iDEAL_Payment($this->settings['partner_id']); if ($this->settings['testmode']) { $mollieIdeal->setTestmode(true); } else { $mollieIdeal->setTestmode(false); } if ($mollieIdeal->createPayment($request->int_var['params']['bank_id'], $amount, $description, $return_url, $report_url)) { // ...Request valid transaction id from Mollie and store it... $request->invoice->secondary_ident = $mollieIdeal->getTransactionId(); $request->invoice->storeload(); // Redirect to issuer bank aecRedirect($mollieIdeal->getBankURL()); } else { // error handling $this->___logError("iDEAL_Payment::createPayment failed", $mollieIdeal->getErrorCode(), $mollieIdeal->getErrorMessage()); return $response; } return null; }
function espresso_process_ideal($payment_data) { global $org_options, $wpdb; $ideal_mollie_settings = get_option('event_espresso_ideal_mollie_settings'); require_once 'ideal.class.php'; $partner_id = $ideal_mollie_settings['ideal_mollie_partner_id']; $payment_data = apply_filters('filter_hook_espresso_prepare_payment_data_for_gateways', $payment_data); $payment_data = apply_filters('filter_hook_espresso_get_total_cost', $payment_data); //amount needs to be in cents $amount = (int) ($payment_data['total_cost'] * 100); $iDEAL = new iDEAL_Payment($partner_id); if ($ideal_mollie_settings['ideal_mollie_use_sandbox']) { $iDEAL->setTestMode(); } if ($ideal_mollie_settings['force_ssl_return']) { $home = str_replace("http://", "https://", home_url()); } else { $home = home_url(); } if (!empty($_POST['bank_id'])) { $return_url = $home . '/?page_id=' . $org_options['return_url'] . '&id=' . $payment_data['attendee_id'] . '&r_id=' . $payment_data['registration_id'] . '&type=ideal'; $report_url = $home . '/?page_id=' . $org_options['notify_url'] . '&id=' . $payment_data['attendee_id'] . '&r_id=' . $payment_data['registration_id'] . '&event_id=' . $payment_data['event_id'] . '&attendee_action=post_payment&form_action=payment&ideal=1'; //Find the correct amount so that unsavory characters don't change it in the previous form $description = stripslashes_deep($payment_data['event_name']); if ($iDEAL->createPayment($_POST['bank_id'], $amount, $description, $return_url, $report_url)) { header("Location: " . $iDEAL->getBankURL()); exit; } else { echo '<p>De betaling kon niet aangemaakt worden.</p>'; echo '<p><strong>Foutmelding:</strong> ', $iDEAL->getErrorMessage(), '</p>'; } } elseif (isset($_POST['bank_id']) && $_POST['bank_id'] == '') { echo "<p>" . __("Please use your browser's back button and select a bank.", 'event_espresso'); } $bank_array = $iDEAL->getBanks(); if ($bank_array == false) { echo '<p>Er is een fout opgetreden bij het ophalen van de banklijst: ', $iDEAL->getErrorMessage(), '</p>'; } ?> <div id="ideal-payment-option-dv" class="payment-option-dv"> <a id="ideal-payment-option-lnk" class="payment-option-lnk display-the-hidden" rel="ideal-payment-option-form" style="cursor:pointer;"> <img alt="Pay using a Credit Card" src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> gateways/pay-by-credit-card.png"> </a> <div id="ideal-payment-option-form-dv" class="hide-if-js"> <div class="event-display-boxes"> <div class = "event_espresso_form_wrapper"> <form id="ideal-mollie-form" class="ee-forms" method="post" action="<?php echo $home . '/?page_id=' . $org_options['notify_url']; ?> "> <fieldset id="ideal-billing-info-dv"> <h4 class="section-title"><?php _e('Select Bank', 'event_espresso'); ?> </h4> <p> <select id ="bank_id" name="bank_id" class="required"> <option value=''>Kies uw bank</option> <?php foreach ($bank_array as $bank_id => $bank_name) { ?> <option value="<?php echo $bank_id; ?> "><?php echo $bank_name; ?> </option> <?php } ?> </select> </p> </fieldset> <input name="amount" type="hidden" value="<?php echo $amount; ?> " /> <input name="ideal" type="hidden" value="1" /> <input name="id" type="hidden" value="<?php echo $payment_data['attendee_id']; ?> " /> <p class="event_form_submit"> <input id="submit_ideal" type="submit" class="submit-payment-btn" name="submit" value="Betaal via iDEAL" /> </p> </form> </div> <br/> <p class="choose-diff-pay-option-pg"> <a class="hide-the-displayed" rel="ideal-payment-option-form" style="cursor:pointer;"><?php _e('Choose a different payment option', 'event_espresso'); ?> </a> </p> </div> </div> </div> <?php }
function espresso_process_ideal($payment_data) { global $org_options, $wpdb; $ideal_mollie_settings = get_option('event_espresso_ideal_mollie_settings'); require_once 'ideal.class.php'; $partner_id = $ideal_mollie_settings['ideal_mollie_partner_id']; $payment_data = apply_filters('filter_hook_espresso_prepare_payment_data_for_gateways', $payment_data); $payment_data = apply_filters('filter_hook_espresso_get_total_cost', $payment_data); //amount needs to be in cents $amount = (int) ($payment_data['total_cost'] * 100); $iDEAL = new iDEAL_Payment($partner_id); if ($ideal_mollie_settings['ideal_mollie_use_sandbox']) { $iDEAL->setTestMode(); } if (isset($_POST['bank_id']) and !empty($_POST['bank_id'])) { $return_url = home_url() . '/?page_id=' . $org_options['return_url'] . '&id=' . $payment_data['attendee_id']; $report_url = home_url() . '/?page_id=' . $org_options['notify_url'] . '&id=' . $payment_data['attendee_id'] . '&event_id=' . $payment_data['event_id'] . '&attendee_action=post_payment&form_action=payment&ideal=1'; //Find the correct amount so that unsavory characters don't change it in the previous form $description = stripslashes_deep($payment_data['event_name']); if ($iDEAL->createPayment($_POST['bank_id'], $amount, $description, $return_url, $report_url)) { header("Location: " . $iDEAL->getBankURL()); exit; } else { echo '<p>De betaling kon niet aangemaakt worden.</p>'; echo '<p><strong>Foutmelding:</strong> ', $iDEAL->getErrorMessage(), '</p>'; } } elseif (isset($_POST['bank_id']) && $_POST['bank_id'] == '') { echo "<p>" . __("Please use your browser's back button and select a bank.", 'event_espresso'); } $bank_array = $iDEAL->getBanks(); if ($bank_array == false) { echo '<p>Er is een fout opgetreden bij het ophalen van de banklijst: ', $iDEAL->getErrorMessage(), '</p>'; } ?> <div class="event-display-boxes"> <form id="ideal-mollie-form" class="ee-forms" method="post" action="<?php echo home_url() . '/?page_id=' . $org_options['notify_url']; ?> "> <select id ="bank_id" name="bank_id" class="required"> <option value=''>Kies uw bank</option> <?php foreach ($bank_array as $bank_id => $bank_name) { ?> <option value="<?php echo $bank_id; ?> "><?php echo $bank_name; ?> </option> <?php } ?> </select> <input name="amount" type="hidden" value="<?php echo $amount; ?> " /> <input name="ideal" type="hidden" value="1" /> <input name="id" type="hidden" value="<?php echo $payment_data['attendee_id']; ?> " /> <input id="submit" type="submit" class="btn_event_form_submit payment-submit" name="submit" value="Betaal via iDEAL" /> </form> </div> <?php }