473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

hello this my code is not working internet explorer plz give me solution

hello this my code is not working internet explorer plz give me solution

Expand|Select|Wrap|Line Numbers
  1. /**
  2.  * When we click on a card
  3.  */
  4.  $('#btnpay').click(function(){
  5.   const paymentRequest = {
  6.     cardNumber:  $('#cartno').val(),
  7.     expYear: $('#expYear').val(),
  8.     expMonth: $('#expMonth').val(), 
  9.     cvc: $('#cvcno').val(),
  10.     currency: 'GBP', 
  11.     amount: $('#amount').val(),
  12.     nativeElement: document.querySelector('#iframe-payment')
  13.   };
  14.  
  15.   paymentRequest.nativeElement.innerHTML = 'Loading... Please wait... while you are redirecting payment getway ';
  16. $('.frm').hide()
  17.   doPayment(paymentRequest).then((result) => {
  18. $('#formpay').append('<input type="hidden" name="stripeSource" value="'+result.id+'" />');
  19. $('#formpay').submit()
  20.  
  21.   }).catch((error) => {
  22.  
  23.     paymentRequest.nativeElement.innerHTML = 'Ups! We can\t validate your details...';
  24.  
  25.     setTimeout(function() {
  26.       location.reload();
  27.       }, 3000);
  28.   });
  29. })
  30.  
  31.  
  32.  
  33.   function isNumberKey(evt){
  34.  
  35.     var charCode = (evt.which) ? evt.which : event.keyCode
  36.     if (charCode > 31 && (charCode < 48 || charCode > 57))
  37.     return false;
  38.  
  39.  
  40.  
  41. }
  42.  
  43.  
  44. $('#cartno').keyup(function() {
  45.   var length = $(this).val().length;
  46.  
  47.   if(length==16){
  48.  
  49.       $('#expMonth').focus()
  50.   }
  51.  
  52. });
  53.  
  54. $('#expMonth').keyup(function() {
  55.   var length = $(this).val().length;
  56. var firstChar = $(this).val().substr(0, 1);
  57. if(firstChar>1){
  58. $(this).val(0)}
  59.   if(length==2){
  60. $('#expYear').focus()
  61.   }
  62.  
  63.  
  64.  
  65.  
  66. });
  67.  
  68.  
  69. $('#expYear').keyup(function() {
  70.   var length = $(this).val().length;
  71.  
  72.   if(length==2){
  73. $('#cvcno').focus()
  74.   }
  75.  
  76. });
  77.  
  78.  
  79. $('#cvcno').keyup(function() {
  80.   var length = $(this).val().length;
  81.  
  82.   if(length==3){
  83. $('#btnpay').focus()
  84.   }
  85.  
  86. });
May 19 '18 #1
9 1446
gits
5,390 Expert Mod 4TB
what exactly is not working?
May 22 '18 #2
trigger is not working on internet explorer
error on this line doPayment(paymentRequest).then((result) => {
plz giving me right solution
May 22 '18 #3
gits
5,390 Expert Mod 4TB
which version of IE is it? i suspect that it doesnt support promises so you would need to include some code to polyfill the promise-construct or u can use babel to transpile the code.
May 22 '18 #4
this code not working on IE 11 version please give me any solution
May 22 '18 #5
gits
5,390 Expert Mod 4TB
i gave you 2 possible hints to solve that issue - u can use babel for transpiling or use something like this:

https://github.com/taylorhakes/promise-polyfill

note: this is just an example - there are many more such implementations that can be used.
May 22 '18 #6
i used babel but i get other error 'Promise' is undefined in api file



this file


Expand|Select|Wrap|Line Numbers
  1. /**
  2.  * This is the main function - The only one that we should call from outside this file
  3.  */
  4. function doPayment(paymentRequest) {
  5.   return new Promise((resolve, reject) => {
  6.     const onCreateCardCallback = create3DSecure(paymentRequest, resolve, reject);
  7.     return Stripe.source.create({
  8.       type: 'card',
  9.       card: {
  10.         number: paymentRequest.cardNumber,
  11.         cvc: paymentRequest.cvc,
  12.         exp_month: paymentRequest.expMonth,
  13.         exp_year: paymentRequest.expYear
  14.       }
  15.     }, onCreateCardCallback);
  16.   });
  17. }
  18.  
  19. function create3DSecure(paymentRequest, resolve, reject) {
  20.   return (status, cardResponse) => {
  21.  
  22.  
  23.     if (status !== 200 || cardResponse.error) {  // problem
  24.       reject(cardResponse.error);
  25.     } else if (cardResponse.card.three_d_secure === 'not_supported' && cardResponse.status === 'chargeable') {
  26.       resolve(cardResponse);
  27.     } else if(cardResponse.card.three_d_secure === 'optional' || cardResponse.card.three_d_secure === 'required') {
  28.       const onCreate3DSecureCallback = createIframe(paymentRequest, resolve, reject);
  29.  
  30.       Stripe.source.create({
  31.         type: 'three_d_secure',
  32.         amount: paymentRequest.amount,
  33.         currency: paymentRequest.currency,
  34.         three_d_secure: { card: cardResponse.id },
  35.         redirect: { return_url:'demo.com'}
  36.       }, onCreate3DSecureCallback);
  37.     }
  38.     else {
  39.       reject(cardResponse);
  40.     }
  41.   };
  42. }
  43.  
  44. function createIframe(paymentRequest, resolve, reject) {
  45.   return (status, stripe3dsResponse) => {
  46.  
  47.     if (status !== 200 || stripe3dsResponse.error) {  // problem
  48.       reject(stripe3dsResponse.error);
  49.     } else {
  50.       paymentRequest.nativeElement.innerHTML =
  51.         '<iframe style="width:100%; height:622px;" frameborder="0" src="' + stripe3dsResponse.redirect.url + '"></iframe>';
  52.  
  53.       const onPollCallbackReal = onPollCallback(paymentRequest, resolve, reject);
  54.       Stripe.source.poll(stripe3dsResponse.id, stripe3dsResponse.client_secret, onPollCallbackReal);
  55.     }
  56.   };
  57. }
  58.  
  59. function onPollCallback(paymentRequest, resolve, reject) {
  60.   return (status, source) => {
  61.  
  62.  
  63.     if (status !== 200 || source.error) {
  64.  
  65.       reject(source.error);
  66.     } else if (source.status === 'canceled' || source.status === 'consumed' || source.status === 'failed') {
  67.  
  68.       reject(source.status);
  69.     } else if (source.three_d_secure.authenticated &&  source.status === 'chargeable') {
  70.  
  71.  
  72.       resolve(source);
  73.     }
  74.   };
  75. }
May 22 '18 #7
gits
5,390 Expert Mod 4TB
this most likely means that the Browser doesnt know of a Promise object
May 22 '18 #8
what i do on this error please give me any solution thank you for helping to me
May 22 '18 #9
gits
5,390 Expert Mod 4TB
there is a call:
Expand|Select|Wrap|Line Numbers
  1. new Promise
obviously that Object is not defined anywhere - so the browser doesnt know that object and u need some polyfill - either the babel one or another. for babel u can start checking here:

https://babeljs.io/docs/plugins/transform-runtime/
May 22 '18 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tim Stevens | last post by:
Hello, This is the first time I have had to resort to posting on here, as Ive always been able to find a solution to my problems in the past by browsing postings by others. So, to start with I...
2
by: David | last post by:
Hello. Can anybody tell me do I open any web page from my code in Internet Explorer? Or how can I just run any program from my code?
6
by: pradeep_TP | last post by:
I am facing a strange problem with my web site. Afer reinstalling the web application on the web server, I am getting a dialog box for each page. The dialog box has the following information. ...
6
by: Test | last post by:
Hi everyone, is there a possibility to get the html source code of an Internet Explorer window that I have only the name/title of? In my case it's not possible to use the...
9
by: Etayki | last post by:
Hi! I am new to VB.net and I am using the Visual Basic 2005 Express Edition I have two questions: 1. I am trying to write an application that will automate Internet Explorer and store data...
2
by: bharat dhaneshwari | last post by:
hi, I want to know that if in our application we have one textbox and one button then when we write any website's name ,how will it should opened in the Internet explorer. give me some well...
0
by: jlackyashdya | last post by:
hi, i m developing a xml based image gallery. i wrote code for generating thumbnails using loader component. its working fine locally. but when i upload it , In Mozilla firefox browser its working...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
2
by: xavierp | last post by:
I just created a website which works fine on Firefox, Opera and Safari but some reason it just has a white tag when i try to open it up in Internet Explorer. I'm only in year 8 so it probably my...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.