28 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
31 $langs->load(
"stripe@stripe");
44 private $config = array();
48 public $results = array();
72 global $db, $conf, $user, $langs, $form;
74 if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha')))
76 $service =
'StripeTest';
77 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
79 $service =
'StripeLive';
82 if (is_array($parameters) && !empty($parameters))
84 foreach ($parameters as $key=>$value)
91 if (is_object($object) && $object->element ==
'societe')
93 $this->resprints .=
'<tr><td>';
94 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
95 $this->resprints .= $langs->trans(
'StripeCustomer');
96 $this->resprints .=
'<td><td class="right">';
98 $this->resprints .=
'</td></tr></table>';
99 $this->resprints .=
'</td>';
100 $this->resprints .=
'<td colspan="3">';
102 if ($stripe->getStripeAccount($service) && $object->client != 0) {
103 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
104 $this->resprints .= $customer->id;
106 $this->resprints .= $langs->trans(
"NoStripe");
108 $this->resprints .=
'</td></tr>';
109 } elseif (is_object($object) && $object->element ==
'member') {
110 $this->resprints .=
'<tr><td>';
111 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
112 $this->resprints .= $langs->trans(
'StripeCustomer');
113 $this->resprints .=
'<td><td class="right">';
114 $this->resprints .=
'</td></tr></table>';
115 $this->resprints .=
'</td>';
116 $this->resprints .=
'<td colspan="3">';
118 if ($stripe->getStripeAccount($service) && $object->fk_soc > 0) {
119 $object->fetch_thirdparty();
120 $customer = $stripe->customerStripe($object->thirdparty, $stripe->getStripeAccount($service));
121 $this->resprints .= $customer->id;
123 $this->resprints .= $langs->trans(
"NoStripe");
125 $this->resprints .=
'</td></tr>';
127 $this->resprints .=
'<tr><td>';
128 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
129 $this->resprints .= $langs->trans(
'SubscriptionStripe');
130 $this->resprints .=
'<td><td class="right">';
131 $this->resprints .=
'</td></tr></table>';
132 $this->resprints .=
'</td>';
133 $this->resprints .=
'<td colspan="3">';
136 $object->fetch_thirdparty();
137 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
138 $this->resprints .= $customer->id;
140 $this->resprints .= $langs->trans(
"NoStripe");
142 $this->resprints .=
'</td></tr>';
143 } elseif (is_object($object) && $object->element ==
'adherent_type') {
144 $this->resprints .=
'<tr><td>';
145 $this->resprints .=
'<table width="100%" class="nobordernopadding"><tr><td>';
146 $this->resprints .= $langs->trans(
'PlanStripe');
147 $this->resprints .=
'<td><td class="right">';
149 $this->resprints .=
'</td></tr></table>';
150 $this->resprints .=
'</td>';
151 $this->resprints .=
'<td colspan="3">';
154 $object->fetch_thirdparty();
155 $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service));
156 $this->resprints .= $customer->id;
158 $this->resprints .= $langs->trans(
"NoStripe");
160 $this->resprints .=
'</td></tr>';
175 global $db, $conf, $user, $langs, $form;
176 if (is_object($object) && $object->element ==
'facture') {
178 $sql =
'SELECT pf.amount';
179 $sql .=
' FROM '.MAIN_DB_PREFIX.
'paiement_facture as pf';
180 $sql .=
' WHERE pf.fk_facture = '.$object->id;
182 $result = $this->
db->query($sql);
185 $num = $this->
db->num_rows($result);
188 $objp = $this->
db->fetch_object($result);
189 $totalpaye += $objp->amount;
196 $resteapayer = $object->total_ttc - $totalpaye;
201 if ($resteapayer > 0)
203 if ($stripe->getStripeAccount($conf->entity))
205 $langs->load(
"withdrawals");
206 print '<a class="butActionDelete" href="'.dol_buildpath(
'/stripeconnect/payment.php?facid='.$object->id.
'&action=create', 1).
'" title="'.
dol_escape_htmltag($langs->trans(
"StripeConnectPay")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
208 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
210 } elseif ($resteapayer == 0)
212 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
215 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
217 } elseif (is_object($object) && $object->element ==
'invoice_supplier') {
218 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeConnectPay")).
'">'.$langs->trans(
"StripeConnectPay").
'</a>';
219 } elseif (is_object($object) && $object->element ==
'member') {
220 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"StripeAutoSubscription")).
'">'.$langs->trans(
"StripeAutoSubscription").
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class Actions Stripe Connect.
$conf db
API class for accounts.
__construct($db)
Constructor.
formObjectOptions($parameters, &$object, &$action)
formObjectOptions
const STATUS_DRAFT
Draft status.
addMoreActionsButtons($parameters, &$object, &$action)
addMoreActionsButtons
const STATUS_ABANDONED
Classified abandoned and no payment done.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...