Debug sumup

This commit is contained in:
Laurent Destailleur 2019-12-04 18:06:05 +01:00
parent 5f148be56f
commit e6b4d2f665
3 changed files with 41 additions and 22 deletions

View File

@ -1672,6 +1672,7 @@ CashDeskThirdPartyForSell=Default generic third party to use for sales
CashDeskBankAccountForSell=Default account to use to receive cash payments CashDeskBankAccountForSell=Default account to use to receive cash payments
CashDeskBankAccountForCheque=Default account to use to receive payments by check CashDeskBankAccountForCheque=Default account to use to receive payments by check
CashDeskBankAccountForCB=Default account to use to receive payments by credit cards CashDeskBankAccountForCB=Default account to use to receive payments by credit cards
CashDeskBankAccountForSumup=Default bank account to use to receive payments by SumUp
CashDeskDoNotDecreaseStock=Disable stock decrease when a sale is done from Point of Sale (if "no", stock decrease is done for each sale done from POS, irrespective of the option set in module Stock). CashDeskDoNotDecreaseStock=Disable stock decrease when a sale is done from Point of Sale (if "no", stock decrease is done for each sale done from POS, irrespective of the option set in module Stock).
CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease
StockDecreaseForPointOfSaleDisabled=Stock decrease from Point of Sale disabled StockDecreaseForPointOfSaleDisabled=Stock decrease from Point of Sale disabled

View File

@ -245,20 +245,6 @@ print '<td colspan="2">';
print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1); print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Sumup options
if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAffiliate");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="'.$conf->global->TAKEPOS_SUMUP_AFFILIATE.'"></input>';
print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAppId");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_APPID" value="'.$conf->global->TAKEPOS_SUMUP_APPID.'"></input>';
print "</td></tr>\n";
}
// Custom Receipt // Custom Receipt
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans('CustomReceipt'); print $langs->trans('CustomReceipt');
@ -293,6 +279,32 @@ print "</td></tr>\n";
print '</table>'; print '</table>';
print '</div>'; print '</div>';
// Sumup options
if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
print '<br>';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAffiliate");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="'.$conf->global->TAKEPOS_SUMUP_AFFILIATE.'"></input>';
print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAppId");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_APPID" value="'.$conf->global->TAKEPOS_SUMUP_APPID.'"></input>';
print "</td></tr>\n";
print '</table>';
print '</div>';
}
print '<br>'; print '<br>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';

View File

@ -178,6 +178,7 @@ else print "var received=0;";
} }
function ValidateSumup() { function ValidateSumup() {
console.log("Launch ValidateSumup");
<?php $_SESSION['SMP_CURRENT_PAYMENT'] = "NEW" ?> <?php $_SESSION['SMP_CURRENT_PAYMENT'] = "NEW" ?>
var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>; var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
var amountpayed = $("#change1").val(); var amountpayed = $("#change1").val();
@ -186,7 +187,7 @@ else print "var received=0;";
} }
// Starting sumup app // Starting sumup app
window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo dolibarr_get_const($db, "TAKEPOS_SUMUP_AFFILIATE")?>&app-id=<?php echo dolibarr_get_const($db, "TAKEPOS_SUMUP_APPID")?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php'); window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo $conf->global->TAKEPOS_SUMUP_AFFILIATE ?>&app-id=<?php echo $conf->global->TAKEPOS_SUMUP_APPID ?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
var loop = window.setInterval(function () { var loop = window.setInterval(function () {
$.ajax('/takepos/smpcb.php?status').done(function (data) { $.ajax('/takepos/smpcb.php?status').done(function (data) {
@ -299,10 +300,15 @@ while ($i < count($paiements)) {
$i = $i + 1; $i = $i + 1;
} }
if ($conf->global->TAKEPOS_ENABLE_SUMUP && !empty(dolibarr_get_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]))) { $keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"];
?> if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button> if (!empty($conf->global->$keyforsumupbank)) {
<?php print '<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>';
} else {
$langs->load("errors");
$langs->load("admin");
print '<button type="button" class="calcbutton2 disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
}
} }
$class = ($i == 3) ? "calcbutton3" : "calcbutton2"; $class = ($i == 3) ? "calcbutton3" : "calcbutton2";