Compare commits
17 Commits
7.x-3.1
...
add-metada
Author | SHA1 | Date | |
---|---|---|---|
bea988bc4c | |||
01a5a1b15f | |||
e17d91d6e3 | |||
19038bc7a0 | |||
d95fa6e721 | |||
06a97cf9c9 | |||
6a7858b6fa | |||
c5dc6d041b | |||
0b3a964634 | |||
c0cb9f8f81 | |||
017b4b731c | |||
0675dcb249 | |||
90baa97458 | |||
562e2a3698 | |||
ee03f3243d | |||
8493a9c1f7 | |||
c2a752501f |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.patch
|
@ -6,10 +6,3 @@ dependencies[] = libraries
|
||||
package = Ubercart - payment
|
||||
core = 7.x
|
||||
php = 5.3
|
||||
|
||||
|
||||
; Information added by Drupal.org packaging script on 2019-08-08
|
||||
version = "7.x-3.1"
|
||||
core = "7.x"
|
||||
project = "uc_stripe"
|
||||
datestamp = "1565244191"
|
||||
|
@ -96,7 +96,7 @@ function uc_stripe_install() {
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function uc_stripe_uninstall() {
|
||||
variable_del('uc_stripe_authenticaiton_required_email');
|
||||
variable_del('uc_stripe_authentication_required_email');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,8 +123,8 @@ function uc_stripe_schema() {
|
||||
),
|
||||
'completed' => array(
|
||||
'description' => 'Competion status of this pending order',
|
||||
'type' => 'int',
|
||||
'not null' => TRUE
|
||||
'type' => 'int',
|
||||
'not null' => TRUE
|
||||
),
|
||||
'hash' => array (
|
||||
'description' => 'The unqiue has of order and payment id',
|
||||
@ -234,8 +234,7 @@ function _uc_stripe_move_customer_id(&$sandbox) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* create table to track orders that require extra authentication verification.
|
||||
* Creates table to track orders that require extra authentication verification.
|
||||
*/
|
||||
function uc_stripe_update_7301() {
|
||||
|
||||
@ -267,17 +266,27 @@ function uc_stripe_update_7301() {
|
||||
'type' => 'varchar',
|
||||
'length' => '100',
|
||||
'not null' => TRUE
|
||||
)
|
||||
),
|
||||
),
|
||||
'unique keys' => array(
|
||||
'hash' => array(
|
||||
'hash'
|
||||
)
|
||||
),
|
||||
'primary key' => array(
|
||||
'id'
|
||||
)
|
||||
'primary key' => array('id'),
|
||||
);
|
||||
|
||||
db_create_table('uc_stripe_pending_auth', $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes typo in variable uc_stripe_authenticaiton_required_email.
|
||||
*/
|
||||
function uc_stripe_update_7302() {
|
||||
$typo_var_name = 'uc_stripe_authenticaiton_required_email';
|
||||
$value = variable_get($typo_var_name, '');
|
||||
if (!empty($value)) {
|
||||
variable_set('uc_stripe_authentication_required_email', $value);
|
||||
variable_del($typo_var_name);
|
||||
}
|
||||
}
|
||||
|
@ -416,10 +416,10 @@ function uc_stripe_settings_form() {
|
||||
|
||||
$email_text = _uc_stripe_get_authentication_required_email_text();
|
||||
|
||||
$form['uc_stripe_settings']['uc_stripe_authenticaiton_required_email'] = array(
|
||||
$form['uc_stripe_settings']['uc_stripe_authentication_required_email'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Email for Recurring payment authentication'),
|
||||
'#default_value' => variable_get('uc_stripe_authenticaiton_required_email', $email_text),
|
||||
'#default_value' => variable_get('uc_stripe_authentication_required_email', $email_text),
|
||||
'#description' => t('If your site uses recurring payments, some transactions will require the customer to return to the site and authenticate before the subscrption payment can be processed.')
|
||||
);
|
||||
|
||||
@ -436,6 +436,20 @@ function uc_stripe_settings_form() {
|
||||
'#description' => 'Show "powered by Stripe" in checkout.',
|
||||
'#default_value' => variable_get('uc_stripe_poweredby', FALSE),
|
||||
);
|
||||
|
||||
$form['uc_stripe_settings']['uc_stripe_metadata_titles'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Metadata: Title'),
|
||||
'#description' => t('Include order item title(s) in Stripe metadata.'),
|
||||
'#default_value' => variable_get('uc_stripe_metadata_titles', FALSE),
|
||||
);
|
||||
|
||||
$form['uc_stripe_settings']['uc_stripe_metadata_models'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Metadata: Model'),
|
||||
'#description' => t('Include item model(s) (SKU(s)) in Stripe metadata.'),
|
||||
'#default_value' => variable_get('uc_stripe_metadata_models', FALSE),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -603,6 +617,7 @@ function uc_stripe_charge($order_id, $amount, $data) {
|
||||
"currency" => strtolower($order->currency),
|
||||
"customer" => $stripe_customer_id,
|
||||
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
||||
"metadata" => make_metadata($order),
|
||||
"payment_method" => $stripe_payment_method_id,
|
||||
"payment_method_types" => ['card'],
|
||||
"confirm" => true,
|
||||
@ -753,7 +768,7 @@ function uc_stripe_renew($order, &$fee) {
|
||||
))->execute();
|
||||
|
||||
// Prepare email to alert user that authentication is required.
|
||||
$params['body'] = variable_get('uc_stripe_authenticaiton_required_email', _uc_stripe_get_authentication_required_email_text());
|
||||
$params['body'] = variable_get('uc_stripe_authentication_required_email', _uc_stripe_get_authentication_required_email_text());
|
||||
$params['user'] = user_load($order->uid);
|
||||
$params['hash'] = $hash;
|
||||
drupal_mail('uc_stripe', 'authentication_required', $params['user']->mail,language_default(), $params);
|
||||
@ -1001,6 +1016,7 @@ function _uc_stripe_confirm_payment(){
|
||||
$params = array(
|
||||
'payment_method' => $data['payment_method_id'],
|
||||
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
||||
"metadata" => make_metadata($order),
|
||||
'amount' => $amount,
|
||||
'currency' => strtolower($order->currency),
|
||||
'confirmation_method' => 'manual',
|
||||
@ -1077,6 +1093,7 @@ function _uc_stripe_create_stripe_customer($order, $payment_method_id = NULL){
|
||||
|
||||
$params = array(
|
||||
'description' => "OrderID: {$order->order_id}",
|
||||
"metadata" => make_metadata($order),
|
||||
'email' => "$order->primary_email"
|
||||
);
|
||||
|
||||
@ -1103,6 +1120,25 @@ function _uc_stripe_create_stripe_customer($order, $payment_method_id = NULL){
|
||||
|
||||
}
|
||||
|
||||
function make_metadata($order){
|
||||
//Get item titles and models
|
||||
foreach($order->products as $item){
|
||||
$titles[] = $item->title;
|
||||
$models[] = $item->model;
|
||||
}
|
||||
$metadata = array();
|
||||
|
||||
if (!empty($models) and variable_get('uc_stripe_metadata_models', FALSE)) {
|
||||
$metadata['models'] = implode(";", $models);
|
||||
}
|
||||
if (!empty($titles) and variable_get('uc_stripe_metadata_titles', FALSE)) {
|
||||
$metadata['titles'] = implode(";", $titles);
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $stripe_id
|
||||
|
Reference in New Issue
Block a user