Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. doCheckout: function (gateway, type) {
  2. if (!($("input[name='agreement']:checked").length > 0)) {
  3. $(".box .terms p").addClass("error");
  4.  
  5. if(HiveCheckout.hasErroredAlready) {
  6. alert("Please agree to our Terms and Conditions and Privacy Policy.");
  7. }
  8.  
  9. HiveCheckout.hasErroredAlready = true;
  10. return;
  11. }
  12.  
  13. if (!($("input[name='privacyConsent']:checked").length > 0)) {
  14. $(".box .privacyStatement p").addClass("error");
  15.  
  16. if(HiveCheckout.hasErroredAlready) {
  17. alert("Please agree to our Terms and Conditions and Privacy Policy.");
  18. }
  19.  
  20. HiveCheckout.hasErroredAlready = true;
  21. return;
  22. }
  23.  
  24. $("#redirecting").fadeIn();
  25.  
  26. $.post(
  27. "/checkout/pay",
  28. {
  29. gateway: gateway,
  30. type: type,
  31. agreement: true,
  32. privacyConsent: 1
  33. }
  34. ).done(function (data) {
  35. var json = $.parseJSON(data);
  36.  
  37. if (json.type == "error") {
  38. alert("Something went wrong. \"" + json.message + "\". Please refresh and try again, or email accounts@hivemc.com.");
  39. } else if (json.type == "success") {
  40. if (json.gateway == "cashu") {
  41. var cashuForm = $('<form id="mapform" action="https://www.cashu.com/cgi-bin/pcashu.cgi" method="post"></form>');
  42. for (var key in json.data) {
  43. if (json.data.hasOwnProperty(key)) {
  44. cashuForm.append('<input type="hidden" name="' + key + '" value="' + json.data[key] + '" />');
  45. }
  46. }
  47. $('body').append(cashuForm);
  48. cashuForm.submit();
  49. } else {
  50. window.top.location.replace(json.data);
  51. }
  52. }
  53. }).fail(function () {
  54. alert("Failed to send request. Please make sure all addons are disabled such as adblockers. Please refresh and try again, or email accounts@hivemc.com");
  55. });
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement