-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PW-1364: added correct amount calculation, added error template page, show error if originKey is missing, added live endpoint url prefix * PW-1364: added foreach to paymentcollection * PW-1364: simplified error tpl * PW-1364: review comments
- Loading branch information
Showing
5 changed files
with
173 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{extends file='page.tpl'} | ||
|
||
{block name='page_content_container'} | ||
<h3>{l s='There was an error' mod='adyen'}</h3> | ||
|
||
<p class="warning"> | ||
{l s='We have noticed that there is a problem with your order.' mod='adyen'} | ||
</p> | ||
|
||
{/block} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,88 @@ | ||
<div class="row"> | ||
<div class="col-xs-12 col-md-6"> | ||
<form action="{$action}" id="payment-form" method="post"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | ||
<script> | ||
$(document).ready(function () { | ||
renderSecureFields(); | ||
}); | ||
function renderSecureFields() { | ||
var locale = "en_US"; | ||
var cardNode = document.getElementById('cardContainer'); | ||
// we can now rely on $ within the safety of our "bodyguard" function | ||
var checkout = new AdyenCheckout({ | ||
locale: locale, | ||
originKey: "{$originKey}", | ||
environment: "{$environment}", | ||
risk: { | ||
enabled: false | ||
} | ||
{if !$originKey} | ||
<form id="payment-form" method="post"> | ||
<h5>There is an error with retrieving the originKey, | ||
please check your API key in the Adyen Module configuration</h5> | ||
</form> | ||
{else} | ||
<div class="row"> | ||
<div class="col-xs-12 col-md-6"> | ||
<form action="{$action}" id="payment-form" method="post"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | ||
<script> | ||
$(document).ready(function () { | ||
renderSecureFields(); | ||
}); | ||
var card = checkout.create('card', { | ||
type: 'card', | ||
hasHolderName: true, | ||
holderNameRequired: true, | ||
onChange: function (state, component) { | ||
console.log(state, component); | ||
if (state.isValid && !component.state.errors.encryptedSecurityCode) { | ||
document.getElementById('holderName').value = state.data.paymentMethod.holderName; | ||
document.getElementById('encryptedCardNumber').value = state.data.paymentMethod.encryptedCardNumber; | ||
document.getElementById('encryptedExpiryMonth').value = state.data.paymentMethod.encryptedExpiryMonth; | ||
document.getElementById('encryptedExpiryYear').value = state.data.paymentMethod.encryptedExpiryYear; | ||
if (state.data.paymentMethod.encryptedSecurityCode) { | ||
document.getElementById('encryptedSecurityCode').value = state.data.paymentMethod.encryptedSecurityCode; | ||
function renderSecureFields() { | ||
var locale = "en_US"; | ||
var cardNode = document.getElementById('cardContainer'); | ||
// we can now rely on $ within the safety of our "bodyguard" function | ||
var checkout = new AdyenCheckout({ | ||
locale: locale, | ||
originKey: "{$originKey}", | ||
environment: "{$environment}", | ||
risk: { | ||
enabled: false | ||
} | ||
}); | ||
var card = checkout.create('card', { | ||
type: 'card', | ||
hasHolderName: true, | ||
holderNameRequired: true, | ||
onChange: function (state, component) { | ||
if (state.isValid && !component.state.errors.encryptedSecurityCode) { | ||
document.getElementById('holderName').value = state.data.paymentMethod.holderName; | ||
document.getElementById('encryptedCardNumber').value = state.data.paymentMethod.encryptedCardNumber; | ||
document.getElementById('encryptedExpiryMonth').value = state.data.paymentMethod.encryptedExpiryMonth; | ||
document.getElementById('encryptedExpiryYear').value = state.data.paymentMethod.encryptedExpiryYear; | ||
if (state.data.paymentMethod.encryptedSecurityCode) { | ||
document.getElementById('encryptedSecurityCode').value = state.data.paymentMethod.encryptedSecurityCode; | ||
} | ||
document.getElementById("allValidcard").value = true; | ||
} else { | ||
resetFields(); | ||
} | ||
document.getElementById("allValidcard").value = true; | ||
} else { | ||
resetFields(); | ||
} | ||
} | ||
}); | ||
card.mount(cardNode); | ||
} | ||
}); | ||
card.mount(cardNode); | ||
} | ||
function resetFields() { | ||
document.getElementById('holderName').value = ""; | ||
document.getElementById('encryptedCardNumber').value = ""; | ||
document.getElementById('encryptedExpiryMonth').value = ""; | ||
document.getElementById('encryptedExpiryYear').value = ""; | ||
document.getElementById('encryptedSecurityCode').value = ""; | ||
document.getElementById("allValidcard").value = ""; | ||
} | ||
</script> | ||
<div class="checkout-container" id="cardContainer"> | ||
<div class="form-div"> | ||
<input type="hidden" name="holderName" id="holderName" | ||
value=""> | ||
<input type="hidden" name="encryptedCardNumber" id="encryptedCardNumber" | ||
value=""> | ||
<input type="hidden" name="encryptedExpiryMonth" id="encryptedExpiryMonth" | ||
value=""> | ||
<input type="hidden" name="encryptedExpiryYear" id="encryptedExpiryYear" | ||
value=""> | ||
<input type="hidden" name="encryptedSecurityCode" id="encryptedSecurityCode" | ||
value=""> | ||
<input type="hidden" class="required-entry" name="allValidcard" id="allValidcard" value=""> | ||
<input type="hidden" name="payment[screen_width]" id="screenWidth" value=""> | ||
<input type="hidden" name="payment[screen_height]" id="screenHeight" value=""> | ||
<input type="hidden" name="payment[color_depth]" id="colorDepth" value=""> | ||
<input type="hidden" name="payment[time_zone_offset]" id="timeZoneOffset" value=""> | ||
<input type="hidden" name="payment[language]" id="language" value=""> | ||
<input type="hidden" name="payment[java_enabled]" id="javaEnabled" value=""> | ||
function resetFields() { | ||
document.getElementById('holderName').value = ""; | ||
document.getElementById('encryptedCardNumber').value = ""; | ||
document.getElementById('encryptedExpiryMonth').value = ""; | ||
document.getElementById('encryptedExpiryYear').value = ""; | ||
document.getElementById('encryptedSecurityCode').value = ""; | ||
document.getElementById("allValidcard").value = ""; | ||
} | ||
</script> | ||
<div class="checkout-container" id="cardContainer"> | ||
<div class="form-div"> | ||
<input type="hidden" name="holderName" id="holderName" | ||
value=""> | ||
<input type="hidden" name="encryptedCardNumber" id="encryptedCardNumber" | ||
value=""> | ||
<input type="hidden" name="encryptedExpiryMonth" id="encryptedExpiryMonth" | ||
value=""> | ||
<input type="hidden" name="encryptedExpiryYear" id="encryptedExpiryYear" | ||
value=""> | ||
<input type="hidden" name="encryptedSecurityCode" id="encryptedSecurityCode" | ||
value=""> | ||
<input type="hidden" class="required-entry" name="allValidcard" id="allValidcard" value=""> | ||
<input type="hidden" name="payment[screen_width]" id="screenWidth" value=""> | ||
<input type="hidden" name="payment[screen_height]" id="screenHeight" value=""> | ||
<input type="hidden" name="payment[color_depth]" id="colorDepth" value=""> | ||
<input type="hidden" name="payment[time_zone_offset]" id="timeZoneOffset" value=""> | ||
<input type="hidden" name="payment[language]" id="language" value=""> | ||
<input type="hidden" name="payment[java_enabled]" id="javaEnabled" value=""> | ||
</div> | ||
</div> | ||
</div> | ||
{if $prestashop16} | ||
<button type="submit" class="button btn btn-default standard-checkout button-medium"><span> | ||
{if $prestashop16} | ||
<button type="submit" class="button btn btn-default standard-checkout button-medium"><span> | ||
{l s='Pay' mod='adyen'} <i class="icon-chevron-right right"></i> </span></button> | ||
{/if} | ||
</form> | ||
{/if} | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
{/if} |