-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscript-1.js
More file actions
141 lines (109 loc) · 4.41 KB
/
script-1.js
File metadata and controls
141 lines (109 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
!!! DO NOT UPDATE UNLESS YOU ARE FAMILIAR WITH JAVASCRIPT !!!
*/
//Visa Checkout Information place your own API key here
var apikey = "[Visa Checkout API Key]";
var visacheckoutpaymentdata;
// CyberSource Data populate with your CyberSource MID
var cybsmid = "[CyberSource Merchnat ID]";
var callID;
var tamount;
var currency;
function successFunction(payment) {
document.getElementById("edata").innerHTML = "Encrypted Data: <br>" + JSON.stringify(payment,null,2);
$("#encryptedData").show("slow");
$("#visaRetriveCallID").show("slow");
visacheckoutpaymentdata = payment;
}
// This parses the information from the Visa Checkout response payload needed for the CyberSource request
$("#visaGetCallIDButton").click(function(){
$("#CallIDResult").show("slow");
$("#visaCYBSauth").show("slow");
callID = visacheckoutpaymentdata.callid;
tamount = visacheckoutpaymentdata.vInitRequest.paymentRequest.total;
currency = visacheckoutpaymentdata.vInitRequest.paymentRequest.currencyCode;
document.getElementById("CallIDResult").innerHTML = "CallID Data: "+ callID + "<br>" + "paymentRequest total: " + tamount
+ "<br>" + "paymentRequest currencyCode: " + currency;
})
/* Formatting SOAP auth request
Example
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.130">
<merchantID>[CyberSource MID]</merchantID>
<merchantReferenceCode>[Merchnat assigned code]</merchantReferenceCode>
<purchaseTotals>
<currency>[Currency Code]</currency>
<grandTotalAmount>[Total Amount]</grandTotalAmount>
</purchaseTotals>
<ccAuthService run="true">
<commerceIndicator>internet</commerceIndicator>
</ccAuthService>
<paymentSolution>visacheckout</paymentSolution>
<vc>
<orderID>[VisaCheckout CallID]</orderID>
</vc>
</requestMessage>
*/
$("#visaCYBSsoapButton").click(function(){
$("#resultAuth").show("slow");
document.getElementById("resultAuth").innerHTML ='<textarea rows="20" cols="60" style="border:none;">'+' '+
'<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.130">'+' '+
'<merchantID>'+cybsmid+'</merchantID>'+' '+
'<merchantReferenceCode>123456</merchantReferenceCode>'+' '+
'<purchaseTotals>'+' '+
'<currency>'+currency+'</currency>'+' '+
'<grandTotalAmount>'+tamount+'</grandTotalAmount>'+' '+
'</purchaseTotals>'+' '+
'<ccAuthService run="true">'+' '+
'<commerceIndicator>internet</commerceIndicator>'+' '+
'</ccAuthService>'+' '+
'<paymentSolution>visacheckout</paymentSolution>'+' '+
'<vc>'+' '+
'<orderID>'+callID+'</orderID>'+' '+
'</vc>'+' '+
'</requestMessage>'+' '+
'</textarea>';
})
/* Formatting Simple Order auth request
Example
ccAuthService_run=true
merchantID=[CyberSource MID]
merchantReferenceCode=[Merchnat assigned code]
purchaseTotals_currency=[Currency Code]
purchaseTotals_grandTotalAmount=[Total Amount]
paymentSolution=visacheckout
vc_orderID=[VisaCheckout CallID]
*/
$("#visaCYBSsonvpButton").click(function(){
$("#resultAuth").show("slow");
document.getElementById("resultAuth").innerHTML ='<textarea rows="20" cols="60" style="border:none;">'+' '+
"ccAuthService_run=true" +' '+
"merchantID=" +cybsmid +' '+
"merchantReferenceCode=123456"+' '+
"purchaseTotals_currency="+currency +' '+
"purchaseTotals_grandTotalAmount="+tamount +' '+
"paymentSolution=visacheckout"+' '+
"vc_orderID="+callID+' '+
'</textarea>';
})
/* Formatting SCMP auth request
Example
ics_applications=ics_auth
merchant_id=[CyberSource MID]
merchant_ref_number=[Merchant assigned code]
currency=[Currency Code]
grand_total_amount=[Total Amount]
payment_solution=visacheckout
vc_order_id=[VisaCheckout CallID]
*/
$("#visaCYBSscmpnvpButton").click(function(){
$("#resultAuth").show("slow");
document.getElementById("resultAuth").innerHTML ='<textarea rows="20" cols="60" style="border:none;">'+' '+
"ics_applications=ics_auth"+' '+
"merchant_id=" +cybsmid+' '+
"merchant_ref_number=123456"+' '+
"currency="+currency+' '+
"grand_total_amount=" +tamount+' '+
"payment_solution=visacheckout"+' '+
"vc_order_id="+callID+' '+
'</textarea>';
})