PluginProbe
Welcart e-Commerce / 1.4.12
Welcart e-Commerce v1.4.12
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / js / usces_admin_settlement.js

usces_admin_settlement.js in Welcart e-Commerce 1.4.12, at js/usces_admin_settlement.js

133 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // JavaScript
2 (function($) {
3 /*
4 ppset = {
5 get_key : function( pptype ) {
6 alert(pptype);
7
8 //var defer = $.Deferred();
9 if ($.browser.msie && parseInt($.browser.version, 10) <= 9 && window.XDomainRequest) {
10 // Use Microsoft XDR
11 var xdr = new XDomainRequest();
12 xdr.onload = function(){
13 var result = xdr.responseText;
14 alert('XDR ' + result);
15 }
16 xdr.onerror = function(){
17 alert('XDR error');
18 }
19 xdr.open('POST', 'https://dev.welcart.org/nanbu/trunk/wordpress/');
20 xdr.send('paypal=1&type=' + pptype);
21 } else {
22 $.ajax({
23 url: 'https://paypal-demo.ebay.jp/listeners/welcart/listener.php',
24 data: 'paypal=1&type=' + pptype,
25 type: 'POST',
26 dataType: 'xml',
27 crossDomain: true,
28 cache: false
29 }).done(function(data, dataType){
30 alert('success');
31 // var key_value = $(data).find('key').text();
32 // var type_value = $(data).find('type').text();
33 // ppset.put_data( type_value, key_value );
34 }).fail(function(data){
35 alert('error');
36 });
37 }
38 alert('end');
39 return true;
40 },
41
42 put_data : function(pptype, key_value) {
43 alert('OK1');
44
45 // var defer = $.Deferred();
46
47 if( 'ppwp' == pptype ){
48 var agree_paypal_wpp = $("#agree_paypal_wpp:checked").val();
49 var activate = $("input[name='wpp_activate']:checked").val();
50 if( "2" == $(".wp_sandbox:checked").val() ){
51 var operating = 'production';
52 }else{
53 var operating = 'sandbox';
54 }
55 var id = $("#id_paypal_wpp").val();
56 var query = 'key=' + key_value + '&type=' + pptype + '&activate=' + activate + '&operating=' + operating + '&id=' + id;
57
58 if( !id || !agree_paypal_wpp ){
59 alert('NG');
60 return;
61 }
62 }else if( 'ppec' == pptype ){
63 var agree_paypal_ec = $("#agree_paypal_ec:checked").val();
64 var activate = $("input[name='ec_activate']:checked").val();
65 if( "2" == $(".ec_sandbox:checked").val() ){
66 var operating = 'production';
67 }else{
68 var operating = 'sandbox';
69 }
70 var user = $("#user_paypal").val();
71 var pwd = $("#pwd_paypal").val();
72 var signature = $("#signature_paypal").val();
73 var acount = $("#acount_paypal").val();
74 var query = 'key=' + key_value + '&type=' + pptype + '&activate=' + activate + '&operating=' + operating + '&user=' + user + '&pwd=' + pwd + '&signature=' + signature + '&acount=' + acount;
75 if( !user || !pwd || !signature || !acount || !user || !agree_paypal_ec ){
76 return;
77 }
78 }else{
79 alert('OK3');
80 return;
81 }
82 $.ajax({
83 url: 'https://paypal-demo.ebay.jp/listeners/welcart/listener.php',
84 data: query,
85 type: 'POST',
86 cache: false
87 // success:defer.resolve,
88 // error:defer.reject,
89 });
90 // return defer.promise();
91 }
92 };
93 $("#paypal_wpp").click( function(){
94 ppset.get_key( 'ppwp' );
95 return false;
96 });
97 $("#paypal_ec").click( function(){
98
99 ppset.get_key( 'ppec' ).then(
100 function(data) {
101 //console.log(data);//debug
102 var key_value = $(data).find('key').text();
103 var type_value = $(data).find('type').text();
104 ppset.put_data( type_value, key_value );
105 }
106 // ,
107 // function(data) {
108 // //console.log(data);//debug
109 // }
110 );
111 return true;
112 });
113 */
114
115 $(".ec_sandbox").click( function(){
116 if( 1 == $(this).val() ){
117 $("#get_paypal_signature").html('<br />テスト環境(Sandbox)用APIユーザ名、APIパスワード、署名の�
118 報は<a target="_blank" href="https://www.sandbox.paypal.com/jp/ja/cgi-bin/webscr?cmd=_get-api-signature&generic-flow=true">こちら</a>から取得可能です');
119 }else{
120 $("#get_paypal_signature").html('<br />本番環境用APIユーザ名、APIパスワード、署名の�
121 報は<a target="_blank" href="https://www.paypal.com/jp/ja/cgi-bin/webscr?cmd=_get-api-signature&generic-flow=true">こちら</a>から取得可能です');
122 }
123 });
124 if( 1 == $(".ec_sandbox:checked").val() ){
125 $("#get_paypal_signature").html('<br />テスト環境(Sandbox)用APIユーザ名、APIパスワード、署名の�
126 報は<a target="_blank" href="https://www.sandbox.paypal.com/jp/ja/cgi-bin/webscr?cmd=_get-api-signature&generic-flow=true">こちら</a>から取得可能です');
127 }else{
128 $("#get_paypal_signature").html('<br />本番環境用APIユーザ名、APIパスワード、署名の�
129 報は<a target="_blank" href="https://www.paypal.com/jp/ja/cgi-bin/webscr?cmd=_get-api-signature&generic-flow=true">こちら</a>から取得可能です');
130 }
131
132 })(jQuery);
133