Skip to content

Commit

Permalink
distinct action URLs for wallet management pages
Browse files Browse the repository at this point in the history
end button for manageWebWallet
  • Loading branch information
PaylineGitHub committed Sep 9, 2017
1 parent 9daeadd commit 7f6e9f9
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 10 deletions.
4 changes: 4 additions & 0 deletions examples/arraySet/walletUrls.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
$array['notificationURL'] = $_POST['walletNotificationURL'];
$array['returnURL'] = $_POST['walletReturnURL'];
$array['cancelURL'] = $_POST['walletCancelURL'];
19 changes: 18 additions & 1 deletion examples/demos/wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,22 @@
echo "<script src='".PaylineSDK::PROD_WDGT_JS."'></script>";
break;
}
?>
?>
<script type='text/javascript'>
function executeUrlAction(token,action) {
if(action == 'cancel'){
var actionUrl = Payline.Models.Contexts.ContextManager.getCurrentContext().getCancelUrl();
}else if(action == 'return'){
var actionUrl = Payline.Models.Contexts.ContextManager.getCurrentContext().getReturnUrl();
}

//Execution du endToken
Payline.Api.endToken(null, function() {
//Redirection
window.location.href = actionUrl;
}, null, false);
}
</script>
<!--SCRIPTS END-->
</head>

Expand Down Expand Up @@ -111,6 +126,8 @@
include('../wallet/'.$_POST['submit'].'.php');
}elseif(isset($_POST['PaRes'])){ // back from ACS with 3D Secure authentication data
include('../wallet/3DS_walletPayment.php');
}elseif(isset($_GET['token']) || (isset($_GET['paylinetoken']) && isset($_GET['e']))){
include('../wallet/'.$_GET['e'].'.php');
}else{
?>
<div id="demo">
Expand Down
18 changes: 18 additions & 0 deletions examples/fieldset/walletUrls.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<fieldset>
<h4>Wallet action URL's</h4>
<div class="row">
<label for="walletNotificationURL">Notification url</label>
<input type="text" name="walletNotificationURL" id="walletNotificationURL" value="<?php echo $_SESSION['WLT_NOTIFICATION_URL']?>">
<span class="help">(valid url like http:// or https://)</span>
</div>
<div class="row">
<label for="walletReturnURL">Return url</label>
<input type="text" name="walletReturnURL" id="walletReturnURL" value="<?php echo $_SESSION['WLT_RETURN_URL']?>">
<span class="help">(valid url like http:// or https://)</span>
</div>
<div class="row">
<label for="walletCancelURL">Cancel url</label>
<input type="text" name="walletCancelURL" id="walletCancelURL" value="<?php echo $_SESSION['WLT_CANCEL_URL']?>">
<span class="help">(valid url like http:// or https://)</span>
</div>
</fieldset>
1 change: 1 addition & 0 deletions examples/index/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ function deleteCss(){
</div>
</fieldset>
<?php include '../fieldset/urls.php';?>
<?php include '../fieldset/walletUrls.php';?>
<fieldset>
<h4>Widget customization</h4>
<div class="row">
Expand Down
12 changes: 12 additions & 0 deletions examples/index/updateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@
fwrite($handle, '$_SESSION[\'CANCEL_URL\'] = \''.$_POST['cancelURL'].'\';'.$nextLine);
}

if($_POST['walletReturnURL'] == ''){
fwrite($handle, '$_SESSION[\'WLT_RETURN_URL\'] = \''.$kitRoot.'examples/demos/wallet.php?e=getWebWallet'.'\';'.$nextLine);
}else{
fwrite($handle, '$_SESSION[\'WLT_RETURN_URL\'] = \''.$_POST['walletReturnURL'].'\';'.$nextLine);
}
fwrite($handle, '$_SESSION[\'WLT_NOTIFICATION_URL\'] = \''.$_POST['walletNotificationURL'].'\';'.$nextLine);
if($_POST['walletCancelURL'] == ''){
fwrite($handle, '$_SESSION[\'WLT_CANCEL_URL\'] = \''.$kitRoot.'examples/demos/wallet.php?e=getWebWallet'.'\';'.$nextLine);
}else{
fwrite($handle, '$_SESSION[\'WLT_CANCEL_URL\'] = \''.$_POST['walletCancelURL'].'\';'.$nextLine);
}

$noCssFlag = true;
if(isset($_FILES['inCss']) && $_FILES['inCss']['name'] != ''){
$noCssFlag = false;
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/createWebWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
include '../arraySet/webOptions.php';

// URL
include '../arraySet/urls.php';
include '../arraySet/walletUrls.php';

// PRIVATE DATA (optional)
include '../arraySet/privateDataList.php';
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/createWebWalletForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
include '../fieldset/owner.php';
include '../fieldset/webOptions.php';
include '../fieldset/privateDataList.php';
include '../fieldset/urls.php';
include '../fieldset/walletUrls.php';
?>

<input type="submit" name="submit" class="submit" value="createWebWallet">
Expand Down
14 changes: 11 additions & 3 deletions examples/wallet/getWebWallet.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?php
include '../initSDK.php';

//Token
$array['token'] = $_POST['token'];
// GET TOKEN
if(isset($_POST['token'])){
$array['token'] = $_POST['token'];
}elseif(isset($_GET['token'])){
$array['token'] = $_GET['token'];
}elseif(isset($_GET['paylinetoken'])){
$array['token'] = $_GET['paylinetoken'];
}else{
echo 'Missing TOKEN';
}

//VERSION
$array['version'] = $_POST['version'];
$array['version'] = isset($_POST['version']) ? $_POST['version'] : $_SESSION['WS_VERSION'];

// EXECUTE
$response = $payline->getWebWallet($array);
Expand Down
6 changes: 5 additions & 1 deletion examples/wallet/manageWebWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
include '../arraySet/webOptions.php';

// URL
include '../arraySet/urls.php';
include '../arraySet/walletUrls.php';

// PRIVATE DATA (optional)
include '../arraySet/privateDataList.php';
Expand All @@ -44,6 +44,10 @@
} else { // affichage du wigdet
echo "<span>&nbsp;</span>";
echo "<div id='PaylineWidget' data-token='".$response['token']."' data-template='".$_POST['data-template']."' ></div>";
echo "<div class='PaylineWidget pl-pay-btn-container' style='text-align:center;'>";
echo "<button class='PaylineWidget pl-pay-btn' type='button' onclick=\"executeUrlAction('".$response['token']."','return')\">Terminer</button>";
echo "</div>";

}
} elseif(isset($response)) {
echo '<span>ERROR : '.$response['result']['code']. ' '.$response['result']['longMessage'].' </span>';
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/manageWebWalletForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
include '../fieldset/owner.php';
include '../fieldset/webOptions.php';
include '../fieldset/privateDataList.php';
include '../fieldset/urls.php';
include '../fieldset/walletUrls.php';
include '../fieldset/merchantName.php';
?>
<fieldset>
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/updateWebWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
include '../arraySet/webOptions.php';

// URL
include '../arraySet/urls.php';
include '../arraySet/walletUrls.php';

// PRIVATE DATA (optional)
include '../arraySet/privateDataList.php';
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/updateWebWalletForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
include '../fieldset/buyer.php';
include '../fieldset/webOptions.php';
include '../fieldset/privateDataList.php';
include '../fieldset/urls.php';
include '../fieldset/walletUrls.php';
?>

<input type="submit" name="submit" class="submit" value="updateWebWallet">
Expand Down

0 comments on commit 7f6e9f9

Please sign in to comment.