Compare commits
	
		
			2 Commits
		
	
	
		
			7.x-2.x-de
			...
			add-metada
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c0cb9f8f81 | ||
| 
						 | 
					0675dcb249 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					*.patch
 | 
				
			||||||
@@ -323,6 +323,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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -539,7 +553,6 @@ function uc_stripe_charge($order_id, $amount, $data) {
 | 
				
			|||||||
    return $result;
 | 
					    return $result;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Charge the customer
 | 
					  // Charge the customer
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -548,11 +561,24 @@ function uc_stripe_charge($order_id, $amount, $data) {
 | 
				
			|||||||
      throw new Exception('No customer ID found');
 | 
					      throw new Exception('No customer ID found');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    foreach($order->products as $item){
 | 
				
			||||||
 | 
					      $titles[] = $item->title;
 | 
				
			||||||
 | 
					      $models[] = $item->model;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    $metadata = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!empty($models)) {
 | 
				
			||||||
 | 
					      $metadata['models'] = implode(";", $models);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    if (!empty($titles)) {
 | 
				
			||||||
 | 
					      $metadata['titles'] = implode(";", $titles);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    $params = array(
 | 
					    $params = array(
 | 
				
			||||||
      "amount" => $amount,
 | 
					      "amount" => $amount,
 | 
				
			||||||
      "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" => $metadata,
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    if (!empty($shipping_info)) {
 | 
					    if (!empty($shipping_info)) {
 | 
				
			||||||
      $params['shipping'] = $shipping_info;
 | 
					      $params['shipping'] = $shipping_info;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user