[freeside-commits] branch master updated. 72891d1753adf47e0318049c19a501c89c24f0cd

Mark Wells mark at 420.am
Wed Jul 24 12:56:55 PDT 2013


The branch, master has been updated
       via  72891d1753adf47e0318049c19a501c89c24f0cd (commit)
      from  35f3cb28e5d3fee1bc1a892acb9cc2d90f55d365 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 72891d1753adf47e0318049c19a501c89c24f0cd
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Jul 24 12:56:21 2013 -0700

    NG selfservice webpay interface, #23579

diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm
index 50b2056..6f37ce8 100644
--- a/FS/FS/ClientAPI_XMLRPC.pm
+++ b/FS/FS/ClientAPI_XMLRPC.pm
@@ -122,6 +122,8 @@ sub ss2clientapi {
   'process_payment_change_pkg' => 'MyAccount/process_payment_change_pkg',
   'process_payment_order_renew' => 'MyAccount/process_payment_order_renew',
   'process_prepay'            => 'MyAccount/process_prepay',
+  'start_thirdparty'          => 'MyAccount/start_thirdparty',
+  'finish_thirdparty'         => 'MyAccount/finish_thirdparty',
   'realtime_collect'          => 'MyAccount/realtime_collect',
   'list_pkgs'                 => 'MyAccount/list_pkgs',     #add to ss (added?)
   'list_svcs'                 => 'MyAccount/list_svcs',     #add to ss (added?)
diff --git a/ng_selfservice/elements/post_thirdparty.php b/ng_selfservice/elements/post_thirdparty.php
new file mode 100644
index 0000000..a543be9
--- /dev/null
+++ b/ng_selfservice/elements/post_thirdparty.php
@@ -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.';
+} ?>
diff --git a/ng_selfservice/payment_finish.php b/ng_selfservice/payment_finish.php
new file mode 100644
index 0000000..413f497
--- /dev/null
+++ b/ng_selfservice/payment_finish.php
@@ -0,0 +1,34 @@
+<? $title ='Payment Confirmation'; include('elements/header.php'); ?>
+<? $current_menu = ''; include('elements/menu.php'); ?>
+<?
+  $params = $_GET;
+  $params['session_id'] = $_COOKIE['session_id'];
+
+  //print_r($params);
+  $payment_results = $freeside->finish_thirdparty($params);
+
+  if ( isset($payment_results['error']) ) {
+    $error = $payment_results['error'];
+    include('elements/error.php');
+  } else {
+?>
+<TABLE>
+  <TR>
+    <TH COLSPAN=2><FONT SIZE=+1><B>Your payment details</B></FONT></TH>
+  </TR>
+  <TR>
+<TR>
+  <TD ALIGN="right">Payment #</TD>
+  <TD BGCOLOR="#ffffff"><B><? echo($payment_results['paynum']); ?></B></TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Payment amount</TH>
+  <TD BGCOLOR="#ffffff"><B>$<? printf('%.2f', $payment_results['paid']); ?></B>
+  </TD>
+</TR>
+<TR>
+  <TD ALIGN="right">Processing #</TD>
+  <TD BGCOLOR="#ffffff"><B><? echo($payment_results['order_number']); ?></B>
+  </TD>
+</TR>
+<? } ?>
diff --git a/ng_selfservice/payment_paypal.php b/ng_selfservice/payment_paypal.php
index a226089..feb852d 100644
--- a/ng_selfservice/payment_paypal.php
+++ b/ng_selfservice/payment_paypal.php
@@ -1,5 +1,41 @@
 <? $title ='PayPal Payment'; include('elements/header.php'); ?>
 <? $current_menu = 'payment_paypal.php'; include('elements/menu.php'); ?>
-PayPal payment
+<?
+if ( isset($_POST['amount']) && $_POST['amount'] ) {
+
+  $payment_results = $freeside->start_thirdparty(array(
+    'session_id'  => $_COOKIE['session_id'],
+    'method'      => 'PAYPAL',
+    'amount'      => $_POST['amount'],
+  ));
+
+  include('elements/post_thirdparty.php');
+
+} else {
+
+  $payment_info = $freeside->payment_info( array(
+    'session_id' => $_COOKIE['session_id'],
+  ) );
+
+  $tr_amount_fee = $freeside->mason_comp(array(
+    'session_id'  => $_COOKIE['session_id'],
+    'comp'        => '/elements/tr-amount_fee.html',
+    'args'        => [ 'amount', $payment_info['balance'] ],
+  ));
+  $tr_amount_fee = $tr_amount_fee['output'];
+
+  include('elements/error.php'); ?>
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="payment_paypal.php">
+  <TABLE>
+  <TR>
+    <TD ALIGN="right">Amount Due</TD>
+    <TD>$<? echo sprintf('%.2f', $payment_info['balance']); ?></TD>
+  </TR>
+  <? echo $tr_amount_fee; ?>
+  </TABLE>
+  <BR>
+  <INPUT TYPE="submit" NAME="process" VALUE="Start payment">
+</FORM>
+<? } ?>
 <? include('elements/menu_footer.php'); ?>
 <? include('elements/footer.php'); ?>
diff --git a/ng_selfservice/payment_webpay.php b/ng_selfservice/payment_webpay.php
index 638761d..ff82078 100644
--- a/ng_selfservice/payment_webpay.php
+++ b/ng_selfservice/payment_webpay.php
@@ -1,5 +1,41 @@
 <? $title ='Webpay Payment'; include('elements/header.php'); ?>
 <? $current_menu = 'payment_webpay.php'; include('elements/menu.php'); ?>
-Webpay
+<?
+if ( isset($_POST['amount']) && $_POST['amount'] ) {
+
+  $payment_results = $freeside->start_thirdparty(array(
+    'session_id'  => $_COOKIE['session_id'],
+    'method'      => 'CC',
+    'amount'      => $_POST['amount'],
+  ));
+
+  include('elements/post_thirdparty.php');
+
+} else {
+
+  $payment_info = $freeside->payment_info( array(
+    'session_id' => $_COOKIE['session_id'],
+  ) );
+
+  $tr_amount_fee = $freeside->mason_comp(array(
+    'session_id'  => $_COOKIE['session_id'],
+    'comp'        => '/elements/tr-amount_fee.html',
+    'args'        => [ 'amount', $payment_info['balance'] ],
+  ));
+  $tr_amount_fee = $tr_amount_fee['output'];
+
+  include('elements/error.php'); ?>
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="payment_webpay.php">
+  <TABLE>
+  <TR>
+    <TD ALIGN="right">Amount Due</TD>
+    <TD>$<? echo sprintf('%.2f', $payment_info['balance']); ?></TD>
+  </TR>
+  <? echo $tr_amount_fee; ?>
+  </TABLE>
+  <BR>
+  <INPUT TYPE="submit" NAME="process" VALUE="Start payment">
+</FORM>
+<? } ?>
 <? include('elements/menu_footer.php'); ?>
 <? include('elements/footer.php'); ?>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/ClientAPI_XMLRPC.pm                   |    2 +
 ng_selfservice/elements/post_thirdparty.php |   29 ++++++++++++++++++++
 ng_selfservice/payment_finish.php           |   34 ++++++++++++++++++++++++
 ng_selfservice/payment_paypal.php           |   38 ++++++++++++++++++++++++++-
 ng_selfservice/payment_webpay.php           |   38 ++++++++++++++++++++++++++-
 5 files changed, 139 insertions(+), 2 deletions(-)
 create mode 100644 ng_selfservice/elements/post_thirdparty.php
 create mode 100644 ng_selfservice/payment_finish.php




More information about the freeside-commits mailing list