From c620c64391049b7f9244e41fd520f52d9af3194b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 13 Sep 2018 11:06:18 +0200 Subject: [PATCH 1/5] Fix currency display charge.php --- htdocs/stripe/charge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index b5f0238e9a2..d0b533e34d8 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -198,7 +198,7 @@ if (!$rowid) } print ''; // Amount - print "".price(($charge->amount-$charge->amount_refunded)/100).""; + print "".price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency)).""; // Status print ''; if ($charge->refunded=='1'){ From 5dcbfe0e5609ce35086134543943c56eebfecf79 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Sep 2018 11:18:37 +0200 Subject: [PATCH 2/5] fix $servicestatus --- htdocs/stripe/charge.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index d0b533e34d8..ff2f3cf7096 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -62,11 +62,13 @@ llxHeader('', $langs->trans("StripeChargeList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { $service = 'StripeLive'; + $servicestatus = '1'; } $stripeaccount = $stripe->getStripeAccount($service); From bf38f1a80fa9115ed5482b75789c4b3be9d4c8b1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Sep 2018 15:27:43 +0200 Subject: [PATCH 3/5] fix url in connect mode --- htdocs/stripe/charge.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index ff2f3cf7096..3d55e53dbbb 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -149,11 +149,12 @@ if (!$rowid) } print ''; - // Ref - $url='https://dashboard.stripe.com/test/payments/'.$charge->id; + // Ref + if (! empty($conf->stripe->enabled) && !empty($stripeaccount)) $connect=$stripeaccount.'/'; + $url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; if ($servicestatus) { - $url='https://dashboard.stripe.com/payments/'.$charge->id; + $url='https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; } print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."\n"; // Stripe customer From e9fb2387b02578e9bc9901c6763f5b0bbe88b344 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Sep 2018 17:46:02 +0200 Subject: [PATCH 4/5] link to stripe customer --- htdocs/stripe/charge.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 3d55e53dbbb..3efcd9ca611 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -62,16 +62,16 @@ llxHeader('', $langs->trans("StripeChargeList")); if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) { $service = 'StripeTest'; - $servicestatus = '0'; + $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } else { - $service = 'StripeLive'; - $servicestatus = '1'; + $service = 'StripeLive'; + $servicestatus = '1'; } -$stripeaccount = $stripe->getStripeAccount($service); +$stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); @@ -109,9 +109,9 @@ if (!$rowid) print "\n"; - if ($stripeaccount) + if ($stripeacc) { - $list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeaccount)); + $list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } else { @@ -149,8 +149,10 @@ if (!$rowid) } print ''; - // Ref - if (! empty($conf->stripe->enabled) && !empty($stripeaccount)) $connect=$stripeaccount.'/'; + + if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; + + // Ref $url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; if ($servicestatus) { @@ -158,7 +160,17 @@ if (!$rowid) } print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."\n"; // Stripe customer - print "".$charge->customer."\n"; + print ""; + + if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; + $url='https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; + } + print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.''; + + print "\n"; // Link print ""; if ($societestatic->id > 0) From e0eb43909de286faff826f5439e878db328cccb4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 14 Sep 2018 17:57:47 +0200 Subject: [PATCH 5/5] fix var --- htdocs/stripe/charge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 3efcd9ca611..b9b654e6553 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -89,7 +89,7 @@ if (!$rowid) print ''; $title=$langs->trans("StripeChargeList"); - $title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)'); + $title.=($stripeacc?' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);