Skip to content

Commit 9ad1db5

Browse files
author
Nick
committed
Hypercharge Payment Gateway v 2.0.2
Initial commit to GitHub
1 parent b7f203c commit 9ad1db5

File tree

439 files changed

+34548
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

439 files changed

+34548
-0
lines changed

Frontend/HyperchargePaymentWpf/Bootstrap.php

Lines changed: 609 additions & 0 deletions
Large diffs are not rendered by default.

Frontend/HyperchargePaymentWpf/Controllers/frontend/Hyperchargewpf.php

Lines changed: 544 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#confirm .personal-information .payment_method .hyperchargedata { left: 240px }
2+
#confirm .personal-information .payment_method .hyperchargedata label {
3+
display: block;
4+
float: left;
5+
width: 150px;
6+
padding-top: 6px;
7+
}
8+
#confirm .personal-information .payment_method .hyperchargedata .text { width: 315px }
9+
#confirm .personal-information .payment_method .hyperchargedata input#cvv { width:3em !important; }
10+
#confirm .personal-information .payment_method .hyperchargedata .cvv-what-is-this {
11+
font-size:11px;
12+
cursor:help;
13+
margin-left:10px;
14+
}
15+
16+
.tool-tip { right:30px; }
17+
.tool-tip { border:1px solid #7BA7C9; background:#EAF6FF; padding:15px 20px; position:absolute; z-index:9999; }
18+
.tool-tip .btn-close { margin:-9px -14px 0; text-align:right; }
19+
.tool-tip .btn-close a { display:block; margin:0 0 0 auto; width:15px; height:15px; background:url(../images/btn_window_close.gif) 100% 0 no-repeat; text-align:left; text-indent:-999em; overflow:hidden; }
20+
.tool-tip .tool-tip-content { padding:5px; }
21+
22+
.errorlist {
23+
color: #eb340a;
24+
white-space:nowrap;
25+
}
26+
27+
.grid_13 .error h2 {
28+
color: #8a1f11;
29+
margin: 0 0 10px 0;
30+
padding: 0 0 0px 0;
31+
border-bottom: 1px solid #df7373;
32+
font-weight: bold;
33+
}
34+
35+
/*body .outer-select {
36+
width: 150px !important;
37+
}*/
226 Bytes
Loading
18.8 KB
Loading
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
(function($) {
2+
onSubmitForm = function(event) {
3+
var checked_method = $("input[name='register[payment]']:checked").parents('.method').find('.hyperchargedata').children('.hypercharge'),
4+
form = $("input[name='register[payment]']:checked").parents('form'),
5+
field, shopware_redirect_url, shopware_failed_redirect_url,
6+
json = '{ "payment": { ';
7+
8+
if (checked_method.attr('id') == undefined) {
9+
//this is not a Hypercharge payment method
10+
return true;
11+
}
12+
//validate mandatory fields
13+
if(!form.validation()){
14+
return false;
15+
}
16+
//create JSON data
17+
field = '.' + checked_method.attr('id') + '-field';
18+
checked_method.find(field).each(function(index, item) {
19+
json += "\"" + item.id + "\" : \"" + $(item).val() + "\",";
20+
});
21+
json += "\"payment_method\" : \"" + checked_method.attr('id').replace("hyperchargemobile-", "") + "\" } }";
22+
23+
var data = jQuery.parseJSON(json);
24+
25+
//submit 1 to Hypercharge via Shopware
26+
shopware_redirect_url = checked_method.find('#hyperchargemobile_shopware_redirect').val();
27+
shopware_failed_redirect_url = checked_method.find('#hyperchargemobile_shopware_failed_redirect').val();
28+
sendFormToShopware(shopware_redirect_url, shopware_failed_redirect_url, data);
29+
30+
return false;
31+
}
32+
33+
function sendFormToShopware(formUrl, errorUrl, data) {
34+
jQuery.support.cors = true;
35+
jQuery.ajax({
36+
url: formUrl,
37+
type: 'POST',
38+
dataType: 'json',
39+
success: function(result) {
40+
if (result.success) {
41+
sendFormToHypercharge(result.redirect_url, result.return_success_url, errorUrl, data);
42+
}
43+
return;
44+
},
45+
error: function(jqXHR, tranStatus, errorThrown) {
46+
alert(errorThrown.message);
47+
//window.location.href = errorUrl;
48+
}
49+
});
50+
}
51+
52+
function sendFormToHypercharge(formUrl, successUrl, errorUrl, data) {
53+
jQuery.support.cors = true;
54+
jQuery.ajax({
55+
url: formUrl,
56+
type: 'POST',
57+
crossDomain: true,
58+
data: data,
59+
dataType: 'jsonp xml',
60+
success: function(result) {
61+
window.location.href = successUrl;
62+
return true;
63+
},
64+
error: function(jqXHR, tranStatus, errorThrown) {
65+
if (jqXHR.status == 200) {
66+
//window.location.href = successUrl;
67+
//we will not do the redirection to success action anymore because we need to submit the current form (for AGB)
68+
$('#confirm .actions input').parents("form").submit();
69+
return;
70+
} else {
71+
alert(errorThrown.message);
72+
window.location.href = errorUrl;
73+
return;
74+
}
75+
}
76+
});
77+
}
78+
79+
$(document).ready(function() {
80+
$('#confirm .actions input').bind('click', onSubmitForm);
81+
});
82+
})(jQuery);
83+
84+
function toggleToolTip(value) {
85+
if (value) {
86+
jQuery("#payment-tool-tip").show();
87+
} else {
88+
jQuery("#payment-tool-tip").hide();
89+
}
90+
return false;
91+
}

0 commit comments

Comments
 (0)