Browse Source

Adding ideal_payment_credits. A module that implements

the ideal_payment_api module to allow payments for
general "credits". A user buys "credits" and these
credits are stored in the the db.
tags/service_links_nl_0.1
Bèr Kessels 12 years ago
parent
commit
c47ee96cbb

+ 41
- 0
ideal_payment_credits/.svn/all-wcprops View File

@@ -0,0 +1,41 @@
K 25
svn:wc:ra_dav:version-url
V 75
/svn/webschuur_idb/!svn/ver/7/trunk/sites/all/modules/ideal_payment_credits
END
ideal_payment_credits.info
K 25
svn:wc:ra_dav:version-url
V 102
/svn/webschuur_idb/!svn/ver/7/trunk/sites/all/modules/ideal_payment_credits/ideal_payment_credits.info
END
CHANGELOG.txt
K 25
svn:wc:ra_dav:version-url
V 89
/svn/webschuur_idb/!svn/ver/9/trunk/sites/all/modules/ideal_payment_credits/CHANGELOG.txt
END
ideal_payment_credits.admin.inc
K 25
svn:wc:ra_dav:version-url
V 107
/svn/webschuur_idb/!svn/ver/9/trunk/sites/all/modules/ideal_payment_credits/ideal_payment_credits.admin.inc
END
README.txt
K 25
svn:wc:ra_dav:version-url
V 86
/svn/webschuur_idb/!svn/ver/7/trunk/sites/all/modules/ideal_payment_credits/README.txt
END
ideal_payment_credits.module
K 25
svn:wc:ra_dav:version-url
V 105
/svn/webschuur_idb/!svn/ver/15/trunk/sites/all/modules/ideal_payment_credits/ideal_payment_credits.module
END
ideal_payment_credits.install
K 25
svn:wc:ra_dav:version-url
V 105
/svn/webschuur_idb/!svn/ver/9/trunk/sites/all/modules/ideal_payment_credits/ideal_payment_credits.install
END

+ 245
- 0
ideal_payment_credits/.svn/entries View File

@@ -0,0 +1,245 @@
9

dir
7
https://webschuur.unfuddle.com/svn/webschuur_idb/trunk/sites/all/modules/ideal_payment_credits
https://webschuur.unfuddle.com/svn/webschuur_idb



2009-01-22T14:41:45.035219Z
7
ber


svn:special svn:externals svn:needs-lock


















0
ideal_payment_credits.info
file




2009-02-01T16:38:03.000000Z
93c1a762840b322f1acbc7e6506fc662
2009-01-22T14:41:45.035219Z
7
ber





















204
images
dir
CHANGELOG.txt
file
9



2009-02-01T16:38:03.000000Z
e588f3d9895963de9e0a3cf2232f5916
2009-02-20T15:28:37.194468Z
9
ber
has-props




















285
ideal_payment_credits.admin.inc
file
9



2009-02-01T16:38:03.000000Z
3719a440918b041c209221e945b0a93e
2009-02-20T15:28:37.194468Z
9
ber
has-props




















1599
css
dir
README.txt
file




2009-02-01T16:38:03.000000Z
4939f3335cabd5d991e0a239cfea18bc
2009-01-22T14:41:45.035219Z
7
ber





















1105
ideal_payment_credits.module
file
15



2009-03-03T16:25:23.000000Z
c7497949f136b1c61b361e1e259feda9
2009-03-03T16:33:01.409645Z
15
ber





















6252
ideal_payment_credits.install
file
9



2009-02-15T15:56:06.000000Z
eee9432e144a790af0f039136f4702d2
2009-02-20T15:28:37.194468Z
9
ber





















1842

+ 1
- 0
ideal_payment_credits/.svn/format View File

@@ -0,0 +1 @@
9

+ 5
- 0
ideal_payment_credits/.svn/prop-base/CHANGELOG.txt.svn-base View File

@@ -0,0 +1,5 @@
K 14
svn:executable
V 1
*
END

+ 5
- 0
ideal_payment_credits/.svn/prop-base/ideal_payment_credits.admin.inc.svn-base View File

@@ -0,0 +1,5 @@
K 14
svn:executable
V 1
*
END

+ 9
- 0
ideal_payment_credits/.svn/text-base/CHANGELOG.txt.svn-base View File

@@ -0,0 +1,9 @@

$Id$
-------------------------------------------------------------------------------
ideal_payment_credits 6.4-1.0, YYYY-MM-DD
-------------------------------------------------------------------------------

- Initial release

+ 36
- 0
ideal_payment_credits/.svn/text-base/README.txt.svn-base View File

@@ -0,0 +1,36 @@
$Id$
ideal_payment_credits
Provided by http://webschuur.com
Developed by Bèr Kessels
-------------------------------------------------------------------------------
INSTALLATION
-------------------------------------------------------------------------------
todo
-------------------------------------------------------------------------------
PERMISSIONS
-------------------------------------------------------------------------------
permission
- description
-------------------------------------------------------------------------------
PUBLIC API
-------------------------------------------------------------------------------
todo
-------------------------------------------------------------------------------
CONVENTIONS
-------------------------------------------------------------------------------
todo




+ 49
- 0
ideal_payment_credits/.svn/text-base/ideal_payment_credits.admin.inc.svn-base View File

@@ -0,0 +1,49 @@
<?php
// $Id$

/**
* @file
* helper file for admin pages
* @author Bèr Kessels <ber@webschuur.com >
* @link http://webschuur.com
* @package ideal_payment_credits
*/

function ideal_payment_credits_settings() {
$form['ideal_payment_credits_path_error'] = array(
'#type' => 'textfield',
'#title' => t('Error path'),
'#description' => t('Drupal path where to return on error'),
'#default_value' => variable_get('ideal_payment_credits_path_error', ''),
);

$form['ideal_payment_credits_path_success'] = array(
'#type' => 'textfield',
'#title' => t('Success path'),
'#description' => t('Drupal path where to return on success. Most often a "thank you" page.'),
'#default_value' => variable_get('ideal_payment_credits_path_success', ''),
);

return system_settings_form($form);
}

function ideal_payment_credits_staffel() {
for ($i = 1; $i <= 10; $i++) {
$form['ideal_payment_credits_staffel_amount_'. $i] = array(
'#type' => 'textfield',
'#title' => t('A batch of'),
'#default_value' => variable_get('ideal_payment_credits_staffel_amount_'. $i, ''),
'#size' => 5,
'#prefix' => '<div class="container-inline">',
);
$form['ideal_payment_credits_staffel_costs_'. $i] = array(
'#type' => 'textfield',
'#title' => t('credits will cost %curr', array('%curr' => variable_get('ideal_payment_api_currency', 'EUR'))),
'#default_value' => variable_get('ideal_payment_credits_staffel_costs_'. $i, ''),
'#size' => 7,
'#suffix' => '</div>',
);
}

return system_settings_form($form);
}

+ 6
- 0
ideal_payment_credits/.svn/text-base/ideal_payment_credits.info.svn-base View File

@@ -0,0 +1,6 @@
; $Id$
name = iDEAL payment credits
description = use ideal_payment_api to buy credits for node_creation_credits module
core = 6.x
dependencies[] = ideal_payment_api
dependencies[] = node_creation_credits

+ 68
- 0
ideal_payment_credits/.svn/text-base/ideal_payment_credits.install.svn-base View File

@@ -0,0 +1,68 @@
<?php
// $Id$

/**
* @file
* Only users with credits can create certain nodes.
* @author Bèr Kessels <ber@webschuuur.com>
* @link http://webschuur.cp,
* @package node_creation_credits
*/

/**
* Implementation of hook_schema().
*/
function ideal_payment_credits_schema() {
$schema = array();

$schema['ideal_payment_credits_orders'] = array(
'description' => t('Contains the orders for payments.'),
'fields' => array(
'id' => array(
'description' => t('Primary identifier.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'users_uid' => array(
'description' => t('Foreign key to the users table. Users uid.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
'amount' => array(
'description' => t('Contains the amount of credits that were ordered.'),
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => 0),
'price' => array(
'description' => t('Contains the total price for the ordered credits.'),
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => 0),
'created_at' => array(
'description' => t('The Unix timestamp when the row was created.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
'updated_at' => array(
'description' => t('The Unix timestamp when the row was updated.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
),
'indexes' => array(
'users_uid' => array('users_uid'),
),
'primary key' => array('id'),
);

return $schema;
}

/**
* Implementation of hook_install().
*/
function ideal_payment_credits_install() {
drupal_install_schema('ideal_payment_credits');
}

+ 197
- 0
ideal_payment_credits/.svn/text-base/ideal_payment_credits.module.svn-base View File

@@ -0,0 +1,197 @@
<?php
// $Id$

/**
* @file
* use ideal_payment_api to buy credits for node_creation_credits module
* @author Bèr Kessels <ber@webschuur.com >
* @link http://webschuur.com
* @package ideal_payment_credits
*/

/* -----------------------------------------------------------------

Hook Implementations

------------------------------------------------------------------ */

/**
* Implementation of hook_perm().
*/
function ideal_payment_credits_perm() {
return array('administer ideal_payment_credits');
}

/**
* Implementation of hook_ideal_payed. Inserts the credits into the system when payment was successfull.
* @param $order_data
* @return unknown_type
*/
function ideal_payment_credits_ideal_payed($order_data) {
$order = ideal_payment_credits_order_get($order_data['order_id']);
node_creation_credits_add($order->users_uid, $order->amount, 'ideal payment');
}

/**
* Implementation of hook_menu().
*/
function ideal_payment_credits_menu() {
$items = array();

$items['admin/settings/ideal_payment_credits_settings'] = array(
'title' => t('Ideal payment credits settings'),
'description' => t('Settings for error page and success page for iDEAL'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_settings'),
'access arguments' => array('administer ideal_payment_credits'),
'file' => 'ideal_payment_credits.admin.inc',
);
$items['admin/settings/ideal_payment_credits_staffel'] = array(
'title' => t('Ideal payment staffel'),
'description' => t('Staffel. Define how much batches of credits cost.'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_staffel'),
'access arguments' => array('administer ideal_payment_credits'),
'file' => 'ideal_payment_credits.admin.inc',
);
$items['ideal_payment_credits/order'] = array(
'title' => t('Add credits'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_order_page'),
'access arguments' => array('make iPAPI payments'),
);
$items['ideal_payment_credits/bank'] = array(
'title' => t('Add credits'),
'page callback' => 'ideal_payment_credits_bank_page',
'access callback' => 'ideal_payment_credits_has_session',
'type' => MENU_CALLBACK, //user has passed and saved the form in ../order
);
return $items;
}

/**
* Implementation of hook_theme().
*/
function ideal_payment_credits_theme($existing, $type, $theme, $path) {
return array(
'forum_topic_navigation' => array(
'arguments' => array('node' => NULL),
),
);
}

/**
* Menu callback function: renders the payment page!
*/
function ideal_payment_credits_order_page($form_state) {

//Accountname
global $user;
$form['info']['username'] = array(
'#value' => t('Account name: !username', array('!username' => theme('username', $user))),
'#suffix' => '<br />',
);
$form['info']['user'] = array(
'#type' => 'value',
'#value' => $user,
);
//Current amount
$form['info']['amount'] = array(
'#value' => t('Current amount: %amount', array('%amount' => node_creation_credits_get_amount_for_user($user))),
);
foreach (ideal_payment_credits_get_staffel() as $amount => $costs) {
$options[$costs] = t('%amount at €%costs' , array('%amount' => $amount, '%costs' => $costs));
}
$form['amount'] = array(
'#type' => 'radios',
'#title' => t('Buy credits'),
'#options' => $options,
);
$form['actions'] = array(
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Pay with iDEAL'),
);

return $form;
}

function ideal_payment_credits_order_page_submit($form, &$form_state) {
$values = $form_state['values']; //less writing
$staffel = ideal_payment_credits_get_staffel();
$price = $values['amount'];
$amount = array_search($price, $staffel);
$order_id = ideal_payment_credits_order_insert($values['user']->uid, $amount, $price);

//Fill TransReq session var
$_SESSION['ideal_payment_credits_order_data'] = array(
'order_id' => $order_id,
'order_total' => $price,
'amount' => $amount,
);
$form_state['redirect'] = 'ideal_payment_credits/bank';
}

function ideal_payment_credits_bank_page() {
$order_desc = t('@number credits for @sitename', array('@number' => $_SESSION['ideal_payment_credits_order_data']['amount'], '@sitename' => variable_get('site_name', '')));
$order_id = $_SESSION['ideal_payment_credits_order_data']['order_id'];
$order_total = $_SESSION['ideal_payment_credits_order_data']['order_total'];
$path_back_error = variable_get('ideal_payment_credits_path_error', '');
$path_back_succes = variable_get('ideal_payment_credits_path_success', '');
return ideal_payment_api_payment_page($order_id, $order_desc, $order_total, $path_back_error, $path_back_succes);
}

/**
* return an array of staffelcosts
*/
function ideal_payment_credits_get_staffel() {
$staffel = array();
for ($i = 1; $i <= 10; $i++) {
if (($amount = variable_get('ideal_payment_credits_staffel_amount_'. $i, '')) &&
($costs = variable_get('ideal_payment_credits_staffel_costs_'. $i, ''))) {
$staffel[$amount] = $costs;
}
}
return $staffel;
}

function ideal_payment_credits_order_insert($users_uid, $amount, $price) {
$now = time();
db_query('INSERT into {ideal_payment_credits_orders}
(users_uid, amount, price, created_at, updated_at) VALUES
(%d, %d, %d, %d, %d)',
$users_uid, $amount, $price, $now, $now);

return db_last_insert_id('ideal_payment_credits_orders', 'id');
}

/**
* Gets an order by its id from the database
* @param $order_id
* @return $order object
*/
function ideal_payment_credits_order_get($order_id) {
$res = db_query('SELECT * FROM {ideal_payment_credits_orders} WHERE id = %d', $order_id);

return db_fetch_object($res);
}

function ideal_payment_credits_has_session() {
if (isset($_SESSION['ideal_payment_credits_order_data']) || isset($_SESSION['ideal_payment_api_order_data'])) {
return TRUE;
}
else {
return FALSE;
}
}

+ 9
- 0
ideal_payment_credits/CHANGELOG.txt View File

@@ -0,0 +1,9 @@

$Id$
-------------------------------------------------------------------------------
ideal_payment_credits 6.4-1.0, YYYY-MM-DD
-------------------------------------------------------------------------------

- Initial release

+ 36
- 0
ideal_payment_credits/README.txt View File

@@ -0,0 +1,36 @@
$Id$
ideal_payment_credits
Provided by http://webschuur.com
Developed by Bèr Kessels
-------------------------------------------------------------------------------
INSTALLATION
-------------------------------------------------------------------------------
todo
-------------------------------------------------------------------------------
PERMISSIONS
-------------------------------------------------------------------------------
permission
- description
-------------------------------------------------------------------------------
PUBLIC API
-------------------------------------------------------------------------------
todo
-------------------------------------------------------------------------------
CONVENTIONS
-------------------------------------------------------------------------------
todo




+ 5
- 0
ideal_payment_credits/css/.svn/all-wcprops View File

@@ -0,0 +1,5 @@
K 25
svn:wc:ra_dav:version-url
V 79
/svn/webschuur_idb/!svn/ver/7/trunk/sites/all/modules/ideal_payment_credits/css
END

+ 35
- 0
ideal_payment_credits/css/.svn/entries View File

@@ -0,0 +1,35 @@
9

dir
7
https://webschuur.unfuddle.com/svn/webschuur_idb/trunk/sites/all/modules/ideal_payment_credits/css
https://webschuur.unfuddle.com/svn/webschuur_idb



2009-01-22T14:41:45.035219Z
7
ber


svn:special svn:externals svn:needs-lock


















0

+ 1
- 0
ideal_payment_credits/css/.svn/format View File

@@ -0,0 +1 @@
9

+ 49
- 0
ideal_payment_credits/ideal_payment_credits.admin.inc View File

@@ -0,0 +1,49 @@
<?php
// $Id$

/**
* @file
* helper file for admin pages
* @author Bèr Kessels <ber@webschuur.com >
* @link http://webschuur.com
* @package ideal_payment_credits
*/

function ideal_payment_credits_settings() {
$form['ideal_payment_credits_path_error'] = array(
'#type' => 'textfield',
'#title' => t('Error path'),
'#description' => t('Drupal path where to return on error'),
'#default_value' => variable_get('ideal_payment_credits_path_error', ''),
);

$form['ideal_payment_credits_path_success'] = array(
'#type' => 'textfield',
'#title' => t('Success path'),
'#description' => t('Drupal path where to return on success. Most often a "thank you" page.'),
'#default_value' => variable_get('ideal_payment_credits_path_success', ''),
);

return system_settings_form($form);
}

function ideal_payment_credits_staffel() {
for ($i = 1; $i <= 10; $i++) {
$form['ideal_payment_credits_staffel_amount_'. $i] = array(
'#type' => 'textfield',
'#title' => t('A batch of'),
'#default_value' => variable_get('ideal_payment_credits_staffel_amount_'. $i, ''),
'#size' => 5,
'#prefix' => '<div class="container-inline">',
);
$form['ideal_payment_credits_staffel_costs_'. $i] = array(
'#type' => 'textfield',
'#title' => t('credits will cost %curr', array('%curr' => variable_get('ideal_payment_api_currency', 'EUR'))),
'#default_value' => variable_get('ideal_payment_credits_staffel_costs_'. $i, ''),
'#size' => 7,
'#suffix' => '</div>',
);
}

return system_settings_form($form);
}

+ 6
- 0
ideal_payment_credits/ideal_payment_credits.info View File

@@ -0,0 +1,6 @@
; $Id$
name = iDEAL payment credits
description = use ideal_payment_api to buy credits for node_creation_credits module
core = 6.x
dependencies[] = ideal_payment_api
dependencies[] = node_creation_credits

+ 68
- 0
ideal_payment_credits/ideal_payment_credits.install View File

@@ -0,0 +1,68 @@
<?php
// $Id$

/**
* @file
* Only users with credits can create certain nodes.
* @author Bèr Kessels <ber@webschuuur.com>
* @link http://webschuur.cp,
* @package node_creation_credits
*/

/**
* Implementation of hook_schema().
*/
function ideal_payment_credits_schema() {
$schema = array();

$schema['ideal_payment_credits_orders'] = array(
'description' => t('Contains the orders for payments.'),
'fields' => array(
'id' => array(
'description' => t('Primary identifier.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'users_uid' => array(
'description' => t('Foreign key to the users table. Users uid.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
'amount' => array(
'description' => t('Contains the amount of credits that were ordered.'),
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => 0),
'price' => array(
'description' => t('Contains the total price for the ordered credits.'),
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => 0),
'created_at' => array(
'description' => t('The Unix timestamp when the row was created.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
'updated_at' => array(
'description' => t('The Unix timestamp when the row was updated.'),
'type' => 'int',
'not null' => TRUE,
'default' => 0),
),
'indexes' => array(
'users_uid' => array('users_uid'),
),
'primary key' => array('id'),
);

return $schema;
}

/**
* Implementation of hook_install().
*/
function ideal_payment_credits_install() {
drupal_install_schema('ideal_payment_credits');
}

+ 197
- 0
ideal_payment_credits/ideal_payment_credits.module View File

@@ -0,0 +1,197 @@
<?php
// $Id$

/**
* @file
* use ideal_payment_api to buy credits for node_creation_credits module
* @author Bèr Kessels <ber@webschuur.com >
* @link http://webschuur.com
* @package ideal_payment_credits
*/

/* -----------------------------------------------------------------

Hook Implementations

------------------------------------------------------------------ */

/**
* Implementation of hook_perm().
*/
function ideal_payment_credits_perm() {
return array('administer ideal_payment_credits');
}

/**
* Implementation of hook_ideal_payed. Inserts the credits into the system when payment was successfull.
* @param $order_data
* @return unknown_type
*/
function ideal_payment_credits_ideal_payed($order_data) {
$order = ideal_payment_credits_order_get($order_data['order_id']);
node_creation_credits_add($order->users_uid, $order->amount, 'ideal payment');
}

/**
* Implementation of hook_menu().
*/
function ideal_payment_credits_menu() {
$items = array();

$items['admin/settings/ideal_payment_credits_settings'] = array(
'title' => t('Ideal payment credits settings'),
'description' => t('Settings for error page and success page for iDEAL'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_settings'),
'access arguments' => array('administer ideal_payment_credits'),
'file' => 'ideal_payment_credits.admin.inc',
);
$items['admin/settings/ideal_payment_credits_staffel'] = array(
'title' => t('Ideal payment staffel'),
'description' => t('Staffel. Define how much batches of credits cost.'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_staffel'),
'access arguments' => array('administer ideal_payment_credits'),
'file' => 'ideal_payment_credits.admin.inc',
);
$items['ideal_payment_credits/order'] = array(
'title' => t('Add credits'),
'page callback' => 'drupal_get_form',
'page arguments' => array('ideal_payment_credits_order_page'),
'access arguments' => array('make iPAPI payments'),
);
$items['ideal_payment_credits/bank'] = array(
'title' => t('Add credits'),
'page callback' => 'ideal_payment_credits_bank_page',
'access callback' => 'ideal_payment_credits_has_session',
'type' => MENU_CALLBACK, //user has passed and saved the form in ../order
);
return $items;
}

/**
* Implementation of hook_theme().
*/
function ideal_payment_credits_theme($existing, $type, $theme, $path) {
return array(
'forum_topic_navigation' => array(
'arguments' => array('node' => NULL),
),
);
}

/**
* Menu callback function: renders the payment page!
*/
function ideal_payment_credits_order_page($form_state) {

//Accountname
global $user;
$form['info']['username'] = array(
'#value' => t('Account name: !username', array('!username' => theme('username', $user))),
'#suffix' => '<br />',
);
$form['info']['user'] = array(
'#type' => 'value',
'#value' => $user,
);
//Current amount
$form['info']['amount'] = array(
'#value' => t('Current amount: %amount', array('%amount' => node_creation_credits_get_amount_for_user($user))),
);
foreach (ideal_payment_credits_get_staffel() as $amount => $costs) {
$options[$costs] = t('%amount at €%costs' , array('%amount' => $amount, '%costs' => $costs));
}
$form['amount'] = array(
'#type' => 'radios',
'#title' => t('Buy credits'),
'#options' => $options,
);
$form['actions'] = array(
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Pay with iDEAL'),
);

return $form;
}

function ideal_payment_credits_order_page_submit($form, &$form_state) {
$values = $form_state['values']; //less writing
$staffel = ideal_payment_credits_get_staffel();
$price = $values['amount'];
$amount = array_search($price, $staffel);
$order_id = ideal_payment_credits_order_insert($values['user']->uid, $amount, $price);

//Fill TransReq session var
$_SESSION['ideal_payment_credits_order_data'] = array(
'order_id' => $order_id,
'order_total' => $price,
'amount' => $amount,
);
$form_state['redirect'] = 'ideal_payment_credits/bank';
}

function ideal_payment_credits_bank_page() {
$order_desc = t('@number credits for @sitename', array('@number' => $_SESSION['ideal_payment_credits_order_data']['amount'], '@sitename' => variable_get('site_name', '')));
$order_id = $_SESSION['ideal_payment_credits_order_data']['order_id'];
$order_total = $_SESSION['ideal_payment_credits_order_data']['order_total'];
$path_back_error = variable_get('ideal_payment_credits_path_error', '');
$path_back_succes = variable_get('ideal_payment_credits_path_success', '');
return ideal_payment_api_payment_page($order_id, $order_desc, $order_total, $path_back_error, $path_back_succes);
}

/**
* return an array of staffelcosts
*/
function ideal_payment_credits_get_staffel() {
$staffel = array();
for ($i = 1; $i <= 10; $i++) {
if (($amount = variable_get('ideal_payment_credits_staffel_amount_'. $i, '')) &&
($costs = variable_get('ideal_payment_credits_staffel_costs_'. $i, ''))) {
$staffel[$amount] = $costs;
}
}
return $staffel;
}

function ideal_payment_credits_order_insert($users_uid, $amount, $price) {
$now = time();
db_query('INSERT into {ideal_payment_credits_orders}
(users_uid, amount, price, created_at, updated_at) VALUES
(%d, %d, %d, %d, %d)',
$users_uid, $amount, $price, $now, $now);

return db_last_insert_id('ideal_payment_credits_orders', 'id');
}

/**
* Gets an order by its id from the database
* @param $order_id
* @return $order object
*/
function ideal_payment_credits_order_get($order_id) {
$res = db_query('SELECT * FROM {ideal_payment_credits_orders} WHERE id = %d', $order_id);

return db_fetch_object($res);
}

function ideal_payment_credits_has_session() {
if (isset($_SESSION['ideal_payment_credits_order_data']) || isset($_SESSION['ideal_payment_api_order_data'])) {
return TRUE;
}
else {
return FALSE;
}
}

+ 5
- 0
ideal_payment_credits/images/.svn/all-wcprops View File

@@ -0,0 +1,5 @@
K 25
svn:wc:ra_dav:version-url
V 82
/svn/webschuur_idb/!svn/ver/7/trunk/sites/all/modules/ideal_payment_credits/images
END

+ 35
- 0
ideal_payment_credits/images/.svn/entries View File

@@ -0,0 +1,35 @@
9

dir
7
https://webschuur.unfuddle.com/svn/webschuur_idb/trunk/sites/all/modules/ideal_payment_credits/images
https://webschuur.unfuddle.com/svn/webschuur_idb



2009-01-22T14:41:45.035219Z
7
ber


svn:special svn:externals svn:needs-lock


















0

+ 1
- 0
ideal_payment_credits/images/.svn/format View File

@@ -0,0 +1 @@
9