Skip to content

Commit

Permalink
Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 7, 2019
2 parents a0a0c22 + 1520ca9 commit 235a65e
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 142 deletions.
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/paybox.lang
Expand Up @@ -10,7 +10,7 @@ ToComplete=To complete
YourEMail=Email to receive payment confirmation
Creditor=Creditor
PaymentCode=Payment code
PayBoxDoPayment=Pay with Credit or Debit Card (Paybox)
PayBoxDoPayment=Pay with Paybox
ToPay=Do payment
YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card information
Continue=Next
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/paypal.lang
Expand Up @@ -33,3 +33,4 @@ PostActionAfterPayment=Post actions after payments
ARollbackWasPerformedOnPostActions=A rollback was performed on all Post actions. You must complete post actions manually if they are necessary.
ValidationOfPaymentFailed=Validation of payment has failed
CardOwner=Card holder
PayPalBalance=Paypal credit
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/stripe.lang
Expand Up @@ -12,7 +12,7 @@ YourEMail=Email to receive payment confirmation
STRIPE_PAYONLINE_SENDEMAIL=Email notification after a payment attempt (success or fail)
Creditor=Creditor
PaymentCode=Payment code
StripeDoPayment=Pay with Credit or Debit Card (Stripe)
StripeDoPayment=Pay with Stripe
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
Continue=Next
ToOfferALinkForOnlinePayment=URL for %s payment
Expand Down
285 changes: 152 additions & 133 deletions htdocs/public/payment/newpayment.php

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions htdocs/public/stripe/ipn.php
Expand Up @@ -106,7 +106,7 @@

$langs->load("main");

// TODO Do we really need a user in setup just to have an name to fill an email topic when it is a technical system notification email
// TODO Do we really need a user in setup just to have a name to fill an email topic when it is a technical system notification email
$user = new User($db);
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
$user->getrights();
Expand Down Expand Up @@ -297,12 +297,18 @@
$db->query($sql);
$db->commit();
}
elseif ($event->type == 'payment_intent.succeeded') {
// TODO: Redirect to paymentok.php
elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
// TODO: create fees
// TODO: Redirect to paymentok.php
}
elseif ($event->type == 'payment_intent.payment_failed') {
// TODO: Redirect to paymentko.php
}
elseif ($event->type == 'checkout.session.completed') // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
{
// TODO: create fees
// TODO: Redirect to paymentok.php
}
elseif ($event->type == 'charge.succeeded') {
// TODO: create fees
// TODO: Redirect to paymentok.php
Expand Down
5 changes: 3 additions & 2 deletions htdocs/stripe/class/stripe.class.php
Expand Up @@ -242,7 +242,7 @@ public function customerStripe(Societe $object, $key = '', $status = 0, $createi
* Warning. If a payment was tried and failed, a payment intent was created.
* But if we change someting on object to pay (amount or other), reusing same payment intent is not allowed.
* Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay),
* that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old that will not be used)
* that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used)
*
* @param double $amount Amount
* @param string $currency_code Currency code
Expand Down Expand Up @@ -366,14 +366,15 @@ public function getPaymentIntent($amount, $currency_code, $tag, $description = '
global $stripearrayofkeysbyenv;
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);

// Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description"));
//$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array());
} else {
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description", "stripe_account" => $key));
//$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("stripe_account" => $key));
}
//var_dump($paymentintent);
//var_dump($paymentintent->id);

// Store the payment intent
if (is_object($object))
Expand Down
7 changes: 6 additions & 1 deletion htdocs/theme/eldy/global.inc.php
Expand Up @@ -133,7 +133,7 @@
vertical-align: middle;
}
input.buttonpayment, button.buttonpayment, div.buttonpayment {
min-width: 320px;
min-width: 290px;
margin-bottom: 15px;
background-image: none;
line-height: 24px;
Expand All @@ -147,6 +147,11 @@
color: #fff;
border-radius: 4px;
}
.buttonpaymentsmall {
font-size: 0.65em;
padding-left: 5px;
padding-right: 5px;
}
div.buttonpayment input {
background-color: unset;
color: #fff;
Expand Down
5 changes: 4 additions & 1 deletion htdocs/theme/md/style.css.php
Expand Up @@ -353,8 +353,11 @@
vertical-align: middle;
}
input.buttonpayment, button.buttonpayment, div.buttonpayment {
min-width: 320px;
min-width: 290px;
margin-bottom: 15px;
margin-top: 0;
margin-left: 5px;
margin-right: 5px;
background-image: none;
line-height: 24px;
padding: 8px;
Expand Down

0 comments on commit 235a65e

Please sign in to comment.