NEW Online payment of invoice and subscription record the payment
automatically.
This commit is contained in:
parent
d569adea2f
commit
0cfa19ee09
@ -1250,7 +1250,7 @@ class Adherent extends CommonObject
|
||||
* @param int $date Date of effect of subscription
|
||||
* @param double $amount Amount of subscription (0 accepted for some members)
|
||||
* @param int $accountid Id bank account
|
||||
* @param string $operation Type operation (if Id bank account provided)
|
||||
* @param string $operation Type of payment (if Id bank account provided). Example: 'CB', ...
|
||||
* @param string $label Label operation (if Id bank account provided)
|
||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||
* @param string $emetteur_nom Name of cheque writer
|
||||
@ -1288,7 +1288,8 @@ class Adherent extends CommonObject
|
||||
$subscription->dateh=$date; // Date of new subscription
|
||||
$subscription->datef=$datefin; // End data of new subscription
|
||||
$subscription->amount=$amount;
|
||||
$subscription->note=$label;
|
||||
$subscription->note=$label; // deprecated
|
||||
$subscription->note_public=$label;
|
||||
|
||||
$rowid=$subscription->create($user);
|
||||
if ($rowid > 0)
|
||||
|
||||
@ -2242,7 +2242,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Validate
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
|
||||
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
|
||||
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
|
||||
{
|
||||
$sql.= ", datef='".$this->db->idate($this->date)."'";
|
||||
|
||||
@ -31,4 +31,5 @@ ErrorSeverityCode=Error Severity Code
|
||||
OnlinePaymentSystem=Online payment system
|
||||
PaypalLiveEnabled=Paypal live enabled (otherwise test/sandbox mode)
|
||||
PaypalImportPayment=Import Paypal payments
|
||||
PostActionAfterPayment=Post actions after payments
|
||||
PostActionAfterPayment=Post actions after payments
|
||||
ARollbackWasPerformedOnPostActions=A rollback was performed on all Post actions. You must complete post actions manually if they are necessary.
|
||||
@ -342,7 +342,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
|
||||
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
|
||||
|
||||
$nvpstr = '';
|
||||
$nvpstr = $nvpstr . "&VERSION=98.0";
|
||||
//$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call
|
||||
$nvpstr = $nvpstr . "&RETURNURL=" . urlencode($returnURL);
|
||||
$nvpstr = $nvpstr . "&CANCELURL=" . urlencode($cancelURL);
|
||||
if (! empty($conf->global->PAYPAL_ALLOW_NOTES))
|
||||
@ -592,7 +592,7 @@ function hash_call($methodName,$nvpStr)
|
||||
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
|
||||
|
||||
// TODO problem with triggers
|
||||
$API_version="56";
|
||||
$API_version="98.0";
|
||||
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha')) // We can force sand box with param 'forcesandbox'
|
||||
{
|
||||
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
|
||||
|
||||
@ -272,6 +272,9 @@ $postactionmessages = array();
|
||||
if ($ispaymentok)
|
||||
{
|
||||
// Set permission for the anonymous user
|
||||
if (empty($user->rights->societe)) $user->rights->societe=new stdClass();
|
||||
if (empty($user->rights->facture)) $user->rights->facture=new stdClass();
|
||||
if (empty($user->rights->adherent)) { $user->rights->adherent=new stdClass(); $user->rights->adherent->cotisation=new stdClass(); }
|
||||
$user->rights->societe->creer = 1;
|
||||
$user->rights->facture->creer = 1;
|
||||
$user->rights->adherent->cotisation->creer = 1;
|
||||
@ -318,14 +321,14 @@ if ($ispaymentok)
|
||||
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datesubscription,$defaultdelay,$defaultdelayunit),-1,'d');
|
||||
$paymentdate=$now;
|
||||
$amount = $FinalPaymentAmt;
|
||||
$label='Online subscription '.dol_print_date($now, 'standard');
|
||||
$label='Online subscription '.dol_print_date($now, 'standard').' using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
|
||||
|
||||
// Payment informations
|
||||
$accountid = 0;
|
||||
if ($paymentmethod == 'paybox') $accountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'paypal') $accountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
if ($paymentmethod == 'stripe') $accountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
$operation=$paymentTypeId; // Payment mode
|
||||
$operation=$paymentType; // Payment mode code
|
||||
$num_chq='';
|
||||
$emetteur_nom='';
|
||||
$emetteur_banque='';
|
||||
@ -460,7 +463,7 @@ if ($ispaymentok)
|
||||
}
|
||||
$paiement->paiementid = $paymentTypeId;
|
||||
$paiement->num_paiement = '';
|
||||
$paiement->note_public = 'Online payment using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
|
||||
$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -556,7 +559,7 @@ if ($ispaymentok)
|
||||
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||
if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br><br>\n";
|
||||
|
||||
$key='ONLINE_PAYMENT_MESSAGE_OK';
|
||||
if (! empty($conf->global->$key)) print $conf->global->$key;
|
||||
@ -635,12 +638,16 @@ if ($ispaymentok)
|
||||
{
|
||||
$content.=' * '.$postactionmessage.'<br>'."\n";
|
||||
}
|
||||
if ($ispostactionok < 0)
|
||||
{
|
||||
$content.= $langs->transnoentities("ARollbackWasPerformedOnPostActions");
|
||||
}
|
||||
$content.='<br>'."\n";
|
||||
|
||||
$content.="<br>\n";
|
||||
$content.='<u>'.$companylangs->transnoentitiesnoconv("TechnicalInformation").":</u><br>\n";
|
||||
$content.=$companylangs->transnoentitiesnoconv("OnlinePaymentSystem").': <strong>'.$paymentmethod."</strong><br>\n";
|
||||
$content.=$companylangs->transnoentitiesnoconv("TransactionId").': <strong>'.$TRANSACTIONID."</strong><br>\n";
|
||||
$content.=$companylangs->transnoentitiesnoconv("ThisIsTransactionId").': <strong>'.$TRANSACTIONID."</strong><br>\n";
|
||||
$content.=$companylangs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n";
|
||||
$content.="<br>\n";
|
||||
$content.="tag=".$fulltag."<br>\ntoken=".$onlinetoken."<br>\npaymentType=".$paymentType."<br>\ncurrencycodeType=".$currencyCodeType."<br>\npayerId=".$payerID."<br>\nipaddress=".$ipaddress."<br>\nFinalPaymentAmt=".$FinalPaymentAmt."<br>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user