Merge pull request #9204 from ptibogxiv/patch-32
Fix payment in connect mode
This commit is contained in:
commit
e081e8443b
@ -366,18 +366,19 @@ class Stripe extends CommonObject
|
|||||||
$order = new Commande($this->db);
|
$order = new Commande($this->db);
|
||||||
$order->fetch($item);
|
$order->fetch($item);
|
||||||
$ref = $order->ref;
|
$ref = $order->ref;
|
||||||
$description = "ORD=" . $ref . ".CUS=" . $societe->id;
|
$description = "ORD=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
||||||
} elseif ($origin == invoice) {
|
} elseif ($origin == invoice) {
|
||||||
$invoice = new Facture($this->db);
|
$invoice = new Facture($this->db);
|
||||||
$invoice->fetch($item);
|
$invoice->fetch($item);
|
||||||
$ref = $invoice->ref;
|
$ref = $invoice->ref;
|
||||||
$description = "INV=" . $ref . ".CUS=" . $societe->id;
|
$description = "INV=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
||||||
}
|
}
|
||||||
|
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
"dol_id" => "" . $item . "",
|
"dol_id" => "" . $item . "",
|
||||||
"dol_type" => "" . $origin . "",
|
"dol_type" => "" . $origin . "",
|
||||||
"dol_thirdparty_id" => "" . $societe->id . "",
|
"dol_thirdparty_id" => "" . $societe->id . "",
|
||||||
|
'dol_thirdparty_name' => $societe->name,
|
||||||
'dol_version'=>DOL_VERSION,
|
'dol_version'=>DOL_VERSION,
|
||||||
'dol_entity'=>$conf->entity,
|
'dol_entity'=>$conf->entity,
|
||||||
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
|
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
|
||||||
@ -395,7 +396,9 @@ class Stripe extends CommonObject
|
|||||||
$charge = \Stripe\Charge::create(array(
|
$charge = \Stripe\Charge::create(array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
// "statement_descriptor" => " ",
|
"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
|
||||||
|
"description" => "Stripe payment: ".$description,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source"
|
"source" => "$source"
|
||||||
));
|
));
|
||||||
@ -403,8 +406,9 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
// "statement_descriptor" => " ",
|
"capture" => true,
|
||||||
"description" => "$description",
|
"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,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
@ -424,19 +428,26 @@ class Stripe extends CommonObject
|
|||||||
$fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100);
|
$fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$charge = \Stripe\Charge::create(array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
// "statement_descriptor" => " ",
|
"capture" => true,
|
||||||
"description" => "$description",
|
"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
|
||||||
"metadata" => $metadata,
|
"description" => "Stripe payment: ".$description,
|
||||||
"source" => "$source",
|
"metadata" => $metadata,
|
||||||
"customer" => "$customer",
|
"source" => "$source",
|
||||||
"application_fee" => "$fee"
|
"customer" => "$customer"
|
||||||
), array(
|
);
|
||||||
"idempotency_key" => "$ref",
|
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $fee>0)
|
||||||
"stripe_account" => "$account"
|
{
|
||||||
));
|
$paymentarray["application_fee"] = $fee;
|
||||||
|
}
|
||||||
|
if ($societe->email && $usethirdpartyemailforreceiptemail)
|
||||||
|
{
|
||||||
|
$paymentarray["receipt_email"] = $societe->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref","stripe_account" => "$account"));
|
||||||
}
|
}
|
||||||
if (isset($charge->id)) {}
|
if (isset($charge->id)) {}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user