Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
bea988bc4c | |||
e17d91d6e3 | |||
19038bc7a0 | |||
d95fa6e721 | |||
06a97cf9c9 | |||
6a7858b6fa | |||
c5dc6d041b | |||
0b3a964634 | |||
db9d45834a | |||
aea105c1ab | |||
c0cb9f8f81 | |||
6324febf04 | |||
b0c82fbcc5 | |||
0675dcb249 | |||
8493a9c1f7 | |||
c2a752501f |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
|
|
||||||
*.patch
|
*.patch
|
@ -6,10 +6,3 @@ dependencies[] = libraries
|
|||||||
package = Ubercart - payment
|
package = Ubercart - payment
|
||||||
core = 7.x
|
core = 7.x
|
||||||
php = 5.3
|
php = 5.3
|
||||||
|
|
||||||
|
|
||||||
; Information added by Drupal.org packaging script on 2019-09-13
|
|
||||||
version = "7.x-3.1+1-dev"
|
|
||||||
core = "7.x"
|
|
||||||
project = "uc_stripe"
|
|
||||||
datestamp = "1568380086"
|
|
||||||
|
@ -437,6 +437,20 @@ function uc_stripe_settings_form() {
|
|||||||
'#default_value' => variable_get('uc_stripe_poweredby', FALSE),
|
'#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;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,6 +617,7 @@ function uc_stripe_charge($order_id, $amount, $data) {
|
|||||||
"currency" => strtolower($order->currency),
|
"currency" => strtolower($order->currency),
|
||||||
"customer" => $stripe_customer_id,
|
"customer" => $stripe_customer_id,
|
||||||
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
||||||
|
"metadata" => make_metadata($order),
|
||||||
"payment_method" => $stripe_payment_method_id,
|
"payment_method" => $stripe_payment_method_id,
|
||||||
"payment_method_types" => ['card'],
|
"payment_method_types" => ['card'],
|
||||||
"confirm" => true,
|
"confirm" => true,
|
||||||
@ -1001,6 +1016,7 @@ function _uc_stripe_confirm_payment(){
|
|||||||
$params = array(
|
$params = array(
|
||||||
'payment_method' => $data['payment_method_id'],
|
'payment_method' => $data['payment_method_id'],
|
||||||
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
"description" => t("Order #@order_id", array("@order_id" => $order_id)),
|
||||||
|
"metadata" => make_metadata($order),
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'currency' => strtolower($order->currency),
|
'currency' => strtolower($order->currency),
|
||||||
'confirmation_method' => 'manual',
|
'confirmation_method' => 'manual',
|
||||||
@ -1077,6 +1093,7 @@ function _uc_stripe_create_stripe_customer($order, $payment_method_id = NULL){
|
|||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'description' => "OrderID: {$order->order_id}",
|
'description' => "OrderID: {$order->order_id}",
|
||||||
|
"metadata" => make_metadata($order),
|
||||||
'email' => "$order->primary_email"
|
'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
|
* @param string $stripe_id
|
||||||
|
Reference in New Issue
Block a user