[freeside-commits] branch FREESIDE_3_BRANCH updated. 6bb484c1877f2436de835981527bd5c2fd02df1d
Ivan
ivan at 420.am
Wed Apr 26 13:15:19 PDT 2017
The branch, FREESIDE_3_BRANCH has been updated
via 6bb484c1877f2436de835981527bd5c2fd02df1d (commit)
from f9080ff94784f66cca0e94458a98d87af262474d (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 6bb484c1877f2436de835981527bd5c2fd02df1d
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Apr 26 13:15:16 2017 -0700
add list_payments and payment_receipt self-service API calls, RT#75517
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 099406f..c432bb8 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1601,6 +1601,42 @@ sub list_invoices {
};
}
+sub list_payments {
+ my $p = shift;
+ my $session = _cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or return { 'error' => "unknown custnum $custnum" };
+
+ return { 'error' => '',
+ 'balance' => $cust_main->balance,
+ 'money_char' => FS::Conf->new->config("money_char") || '$',
+ 'payments' => [ map $_->SSAPI_getinfo, $cust_main->cust_pay ],
+ };
+}
+
+sub payment_receipt {
+ my $p = shift;
+ my $session = _cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $cust_pay = qsearchs('cust_pay', { 'custnum' => $custnum,
+ 'paynum' => $p->{'paynum'},
+ }
+ )
+ or return { 'error' => "unknown payment ". $p->{'paynum'} };
+
+ return {
+ 'error' => '',
+ %{ $cust_pay->SSAPI_getinfo },
+ };
+}
+
sub cancel {
my $p = shift;
my $session = _cache->get($p->{'session_id'})
diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm
index 0420d1a..a82a82f 100644
--- a/FS/FS/ClientAPI_XMLRPC.pm
+++ b/FS/FS/ClientAPI_XMLRPC.pm
@@ -127,6 +127,8 @@ sub ss2clientapi {
'legacy_invoice_pdf' => 'MyAccount/legacy_invoice_pdf',
'invoice_logo' => 'MyAccount/invoice_logo',
'list_invoices' => 'MyAccount/list_invoices', #?
+ 'list_payments' => 'MyAccount/list_payments',
+ 'payment_receipt' => 'MyAccount/payment_receipt',
'cancel' => 'MyAccount/cancel', #add to ss cgi!
'payment_info' => 'MyAccount/payment_info',
'payment_info_renew_info' => 'MyAccount/payment_info_renew_info',
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 56de582..bd59161 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1106,6 +1106,30 @@ sub unapplied_sql {
}
+=item SSAPI_getinfo
+
+=cut
+
+sub SSAPI_getinfo {
+ #my( $self, %opt ) = @_;
+ my $self = shift;
+
+ +{ 'paynum' => $self->paynum,
+ '_date' => $self->_date,
+ 'date' => time2str("%b %o, %Y", $self->_date),
+ 'date_short' => time2str("%m-%d-%Y", $self->_date),
+ 'paid' => sprintf('%.2f', $self->paid),
+ 'payby' => $self->payby,
+ 'paycardtype' => $self->paycardtype,
+ 'paymask' => $self->paymask,
+ 'processor' => $self->processor,
+ 'auth' => $self->auth,
+ 'order_number' => $self->order_number,
+ };
+
+}
+
+
# _upgrade_data
#
# Used by FS::Upgrade to migrate to a new database.
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index c95e056..9c6afbd 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -48,6 +48,8 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'legacy_invoice_pdf' => 'MyAccount/legacy_invoice_pdf',
'invoice_logo' => 'MyAccount/invoice_logo',
'list_invoices' => 'MyAccount/list_invoices', #?
+ 'list_payments' => 'MyAccount/list_payments',
+ 'payment_receipt' => 'MyAccount/payment_receipt',
'cancel' => 'MyAccount/cancel', #add to ss cgi!
'payment_info' => 'MyAccount/payment_info',
'payment_info_renew_info' => 'MyAccount/payment_info_renew_info',
-----------------------------------------------------------------------
Summary of changes:
FS/FS/ClientAPI/MyAccount.pm | 36 ++++++++++++++++++++++++++
FS/FS/ClientAPI_XMLRPC.pm | 2 ++
FS/FS/cust_pay.pm | 24 +++++++++++++++++
fs_selfservice/FS-SelfService/SelfService.pm | 2 ++
4 files changed, 64 insertions(+)
More information about the freeside-commits
mailing list