Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

order-payonline.pl 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/perl
  2. use CGI;
  3. use Digest::SHA qw(sha1_hex);
  4. my $query = new CGI;
  5. my $reference = $query->param("reference");
  6. my $language = $query->param("language");
  7. $reference =~ s/\W//g; # Only numbers and characters to aviod cross site scripting
  8. $language =~ s/\W//g;
  9. my $lang = substr($language, 0, 2);
  10. my $amount = substr($reference, 9, 3);
  11. my $amount_f = sprintf("%.2f", $amount);
  12. my $amount100 = $amount * 100;
  13. # -----------------------------------------------------------------------------
  14. # Generate form for ConCardis payment
  15. # -----------------------------------------------------------------------------
  16. my $passphrase = "Only4TestingPurposes";
  17. my $shastring =
  18. "ACCEPTURL=http://fsfe.org/order/thankyou.$lang.html$passphrase" .
  19. "AMOUNT=$amount100$passphrase" .
  20. "CANCELURL=http://fsfe.org/order/cancel.$lang.html$passphrase" .
  21. "CURRENCY=EUR$passphrase" .
  22. "LANGUAGE=$language$passphrase" .
  23. "ORDERID=$reference$passphrase" .
  24. "PMLISTTYPE=2$passphrase" .
  25. "PSPID=40F00871$passphrase" .
  26. "TP=https://fsfe.org/order/tmpl-concardis.$lang.html$passphrase";
  27. my $shasum = uc(sha1_hex($shastring));
  28. my $form = " <!-- payment parameters -->\n" .
  29. " <input type=\"hidden\" name=\"PSPID\" value=\"40F00871\"/>\n" .
  30. " <input type=\"hidden\" name=\"orderID\" value=\"$reference\"/>\n" .
  31. " <input type=\"hidden\" name=\"amount\" value=\"$amount100\"/>\n" .
  32. " <input type=\"hidden\" name=\"currency\" value=\"EUR\"/>\n" .
  33. " <input type=\"hidden\" name=\"language\" value=\"$language\"/>\n" .
  34. " <!-- interface template -->\n" .
  35. " <input type=\"hidden\" name=\"TP\" value=\"https://fsfe.org/order/tmpl-concardis.$lang.html\"/>\n" .
  36. " <input type=\"hidden\" name=\"PMListType\" value=\"2\"/>\n" .
  37. " <!-- post-payment redirection -->\n" .
  38. " <input type=\"hidden\" name=\"accepturl\" value=\"http://fsfe.org/order/thankyou.$lang.html\"/>\n" .
  39. " <input type=\"hidden\" name=\"cancelurl\" value=\"http://fsfe.org/order/cancel.$lang.html\"/>\n" .
  40. " <!-- SHA1 signature -->\n" .
  41. " <input type=\"hidden\" name=\"SHASign\" value=\"$shasum\"/>";
  42. # -----------------------------------------------------------------------------
  43. # Lead user to "thankyou" page
  44. # -----------------------------------------------------------------------------
  45. print "Content-type: text/html\n\n";
  46. open TEMPLATE, "/srv/www/html/global/order/tmpl-thankyou." . $lang . ".html";
  47. while (<TEMPLATE>) {
  48. s/:AMOUNT:/$amount_f/g;
  49. s/:REFERENCE:/$reference/g;
  50. s/:FORM:/$form/g;
  51. print;
  52. }
  53. close TEMPLATE;