NG selfservice webpay interface, #23579
[freeside.git] / ng_selfservice / elements / post_thirdparty.php
diff --git a/ng_selfservice/elements/post_thirdparty.php b/ng_selfservice/elements/post_thirdparty.php
new file mode 100644 (file)
index 0000000..a543be9
--- /dev/null
@@ -0,0 +1,29 @@
+<?
+if ( $payment_results['error'] ) {
+  // an error at this stage isn't meaningful to the user
+  $error = 'Internal error communicating with payment processor.';
+} elseif ( isset($payment_results['url']) ) {
+  $url = $payment_results['url'];
+?>
+<H3>Redirecting to payment processor...</H3>
+<DIV STYLE="display:none">
+<FORM ID="autoform" METHOD="POST" ENCTYPE="multipart/form-data" ACTION="<?
+  echo($url);
+?>">
+<?
+if (isset($payment_results['post_params'])) {
+  foreach ($payment_results['post_params'] as $key => $value) {
+    echo("<INPUT TYPE=\"hidden\" NAME=\"$key\" VALUE=\"$value\">\n");
+  }
+} ?>
+  <INPUT TYPE="submit" VALUE="submit">
+</FORM>
+</DIV>
+<SCRIPT TYPE="text/javascript">
+window.onload = function() {
+  document.getElementById('autoform').submit();
+}
+</SCRIPT>
+<? } else {
+  $error = 'Internal error: no redirect URL.';
+} ?>