More logs

This commit is contained in:
Laurent Destailleur 2018-09-01 16:51:40 +02:00
parent d8fb18e6a9
commit c17233a409
2 changed files with 24 additions and 13 deletions

View File

@ -1347,7 +1347,7 @@ class Adherent extends CommonObject
* @param string $num_chq Numero cheque (if Id bank account provided) * @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer * @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque * @param string $emetteur_banque Name of bank of cheque
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty and we request an option that generate invoice. * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)

View File

@ -87,10 +87,8 @@ if (empty($paymentmethod))
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used'); dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
exit; exit;
} }
else
{ dol_syslog("***** paymentok.php is called paymentmethod=".$paymentmethod." FULLTAG=".$FULLTAG." REQUEST_URI=".$_SERVER["REQUEST_URI"], LOG_DEBUG, 0, '_payment');
dol_syslog("paymentmethod=".$paymentmethod);
}
$validpaymentmethod=array(); $validpaymentmethod=array();
@ -194,7 +192,7 @@ if (! empty($conf->paypal->enabled))
// From env // From env
$ipaddress = $_SESSION['ipaddress']; $ipaddress = $_SESSION['ipaddress'];
dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal'); dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
// Validate record // Validate record
if (! empty($paymentType)) if (! empty($paymentType))
@ -266,6 +264,9 @@ $fulltag = $FULLTAG;
$tmptag=dolExplodeIntoArray($fulltag,'.','='); $tmptag=dolExplodeIntoArray($fulltag,'.','=');
dol_syslog("ispaymentok=".$ispaymentok, LOG_DEBUG, 0, '_payment');
// Make complementary actions // Make complementary actions
$ispostactionok = 0; $ispostactionok = 0;
$postactionmessages = array(); $postactionmessages = array();
@ -372,6 +373,8 @@ if ($ispaymentok)
// Create subscription // Create subscription
if (! $error) if (! $error)
{ {
dol_syslog("Call ->subscription to create subscription", LOG_DEBUG, 0, '_payment');
$crowid=$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); $crowid=$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
if ($crowid <= 0) if ($crowid <= 0)
{ {
@ -389,7 +392,9 @@ if ($ispaymentok)
if (! $error) if (! $error)
{ {
$autocreatethirdparty = 1; dol_syslog("Call ->subscriptionComplementaryActions", LOG_DEBUG, 0, '_payment');
$autocreatethirdparty = 1; // will create thirdparty if member not yet linked to a thirdparty
$result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty); $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty);
if ($result < 0) if ($result < 0)
@ -416,7 +421,7 @@ if ($ispaymentok)
{ {
$thirdparty_id = $object->fk_soc; $thirdparty_id = $object->fk_soc;
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment');
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = 0; $servicestatus = 0;
@ -436,6 +441,8 @@ if ($ispaymentok)
if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
{ {
dol_syslog("No stripe profile found, so we add it", LOG_DEBUG, 0, '_payment');
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id $ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
$stripecu = $ch->customer; // value 'cus_....' $stripecu = $ch->customer; // value 'cus_....'
@ -462,9 +469,11 @@ if ($ispaymentok)
$db->rollback(); $db->rollback();
} }
// Send email // Send email to member
if (! $error) if (! $error)
{ {
dol_syslog("Send email to customer to ".$object->email." if we have to (sendalsoemail = ".$sendalsoemail.")", LOG_DEBUG, 0, '_payment');
// Send confirmation Email // Send confirmation Email
if ($object->email && $sendalsoemail) if ($object->email && $sendalsoemail)
{ {
@ -691,7 +700,9 @@ if ($ispaymentok)
$tmptag=dolExplodeIntoArray($fulltag,'.','='); $tmptag=dolExplodeIntoArray($fulltag,'.','=');
// Send an email dol_syslog("Send email to customer to admins if we have to (sendemail = ".$sendemail.")", LOG_DEBUG, 0, '_payment');
// Send an email to admin
if ($sendemail) if ($sendemail)
{ {
$companylangs = new Translate('', $conf); $companylangs = new Translate('', $conf);