add capture option in payment function
Conflicts: htdocs/stripe/class/stripe.class.php
This commit is contained in:
parent
82580cadf6
commit
ef4659c518
@ -335,18 +335,19 @@ class Stripe extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Create charge with public/payment/newpayment.php, stripe/card.php, cronjobs or REST API
|
* Create charge with public/payment/newpayment.php, stripe/card.php, cronjobs or REST API
|
||||||
*
|
*
|
||||||
* @param int $amount Amount to pay
|
* @param int $amount Amount to pay
|
||||||
* @param string $currency EUR, GPB...
|
* @param string $currency EUR, GPB...
|
||||||
* @param string $origin Object type to pay (order, invoice, contract...)
|
* @param string $origin Object type to pay (order, invoice, contract...)
|
||||||
* @param int $item Object id to pay
|
* @param int $item Object id to pay
|
||||||
* @param string $source src_xxxxx or card_xxxxx
|
* @param string $source src_xxxxx or card_xxxxx
|
||||||
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
|
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
|
||||||
* @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount()
|
* @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount()
|
||||||
* @param int $status Status (0=test, 1=live)
|
* @param int $status Status (0=test, 1=live)
|
||||||
* @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email
|
* @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email
|
||||||
|
* @param boolean $capture Set capture flag to true (take payment) or false (wait)
|
||||||
* @return Stripe
|
* @return Stripe
|
||||||
*/
|
*/
|
||||||
public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0)
|
public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -417,9 +418,9 @@ class Stripe extends CommonObject
|
|||||||
$charge = \Stripe\Charge::create(array(
|
$charge = \Stripe\Charge::create(array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source"
|
"source" => "$source"
|
||||||
));
|
));
|
||||||
@ -427,9 +428,9 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"description" => "Stripe payment: ".$description,
|
||||||
"description" => "Stripe payment: ".$description,
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
@ -452,9 +453,9 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user