Update stripe.class.php

This commit is contained in:
ptibogxiv 2019-02-12 19:42:34 +01:00 committed by GitHub
parent 8f3ffc6520
commit 7d5ea4fc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,17 +239,17 @@ class Stripe extends CommonObject
} }
/** /**
* Get the Stripe payment intent * Get the Stripe payment intent
* *
* @param Societe $object Object tp pay on Stripe * @param Societe $object Object tp pay on Stripe
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int $status Status (0=test, 1=live) * @param int $status Status (0=test, 1=live)
* @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt
* @param int $mode automatic=automatic payment, manual=need confirmation * @param int $mode automatic=automatic payment, manual=need confirmation
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found
*/ */
public function getPaymentIntent($object, $customer, $key=null, $status=0, $usethirdpartyemailforreceiptemail=0, $mode='automatic') public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic')
{ {
global $conf, $user; global $conf, $user;
@ -269,7 +269,7 @@ class Stripe extends CommonObject
$sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site"; // key_account is cus_.... $sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site"; // key_account is cus_....
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi"; $sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
$sql.= " WHERE pi.fk_facture = " . $object->id; $sql.= " WHERE pi.fk_facture = " . $object->id;
$sql.= " AND pi.sourcetype = '" . $object->element . "'"; $sql.= " AND pi.sourcetype = '" . $object->element . "'";
$sql.= " AND pi.entity IN (".getEntity('societe').")"; $sql.= " AND pi.entity IN (".getEntity('societe').")";
$sql.= " AND pi.ext_payment_site = '" . $service . "'"; $sql.= " AND pi.ext_payment_site = '" . $service . "'";
@ -311,7 +311,7 @@ class Stripe extends CommonObject
$fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100);
} }
$description=$object->element.$object->ref; $description=$object->element.$object->ref;
$dataforintent = array( $dataforintent = array(
"amount" => $stripeamount, "amount" => $stripeamount,
@ -329,7 +329,7 @@ class Stripe extends CommonObject
if ($societe->email && $usethirdpartyemailforreceiptemail) if ($societe->email && $usethirdpartyemailforreceiptemail)
{ {
$dataforintent["receipt_email"] = $societe->email; $dataforintent["receipt_email"] = $societe->email;
} }
try { try {
// Force to use the correct API key // Force to use the correct API key