[freeside-commits] branch FREESIDE_3_BRANCH updated. d4997594578f91e100f62097fe2349531e0ee523
Ivan
ivan at 420.am
Mon Feb 2 01:34:13 PST 2015
The branch, FREESIDE_3_BRANCH has been updated
via d4997594578f91e100f62097fe2349531e0ee523 (commit)
from e9d371c33b5f53fd078c5f5a7d93e5c36743c8bc (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 d4997594578f91e100f62097fe2349531e0ee523
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Feb 2 01:34:05 2015 -0800
bill now via backoffice API, RT#33220
diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index 609008b..3f3ca87 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -35,9 +35,10 @@ in plaintext.
=over 4
-=item insert_payment
+=item insert_payment OPTION => VALUE, ...
-Adds a new payment to a customers account. Takes a hash reference as parameter with the following keys:
+Adds a new payment to a customers account. Takes a list of keys and values as
+paramters with the following keys:
=over 5
@@ -59,9 +60,10 @@ Amount paid
=item _date
-
Option date for payment
+=back
+
Example:
my $result = FS::API->insert_payment(
@@ -81,8 +83,6 @@ Example:
print "paynum ". $result->{'paynum'};
}
-=back
-
=cut
#enter cash payment
@@ -132,9 +132,10 @@ sub _by_phonenum {
}
-=item insert_credit
+=item insert_credit OPTION => VALUE, ...
-Adds a a credit to a customers account. Takes a hash reference as parameter with the following keys
+Adds a a credit to a customers account. Takes a list of keys and values as
+parameters with the following keys
=over
@@ -154,6 +155,8 @@ Amount of the credit
The date the credit will be posted
+=back
+
Example:
my $result = FS::API->insert_credit(
@@ -172,8 +175,6 @@ Example:
print "crednum ". $result->{'crednum'};
}
-=back
-
=cut
#Enter credit
@@ -205,9 +206,10 @@ sub insert_credit_phonenum {
}
-=item insert_refund
+=item insert_refund OPTION => VALUE, ...
-Adds a a credit to a customers account. Takes a hash reference as parameter with the following keys: custnum,payby,refund
+Adds a a credit to a customers account. Takes a list of keys and values as
+parmeters with the following keys: custnum, payby, refund
Example:
@@ -269,9 +271,10 @@ sub insert_refund_phonenum {
# long-term: package changes?
-=item new_customer
+=item new_customer OPTION => VALUE, ...
-Creates a new customer. Takes a hash reference as parameter with the following keys:
+Creates a new customer. Takes a list of keys and values as parameters with the
+following keys:
=over 4
@@ -401,6 +404,7 @@ Agent specific customer number
Referring customer number
+=back
=cut
@@ -473,11 +477,10 @@ sub new_customer {
}
-=back
-
=item customer_info
-Returns general customer information. Takes a hash reference as parameter with the following keys: custnum and API secret
+Returns general customer information. Takes a list of keys and values as
+parameters with the following keys: custnum, secret
=cut
@@ -538,9 +541,8 @@ sub customer_info {
=item location_info
-Returns location specific information for the customer. Takes a hash reference as parameter with the following keys: custnum,secret
-
-=back
+Returns location specific information for the customer. Takes a list of keys
+and values as paramters with the following keys: custnum, secret
=cut
@@ -564,6 +566,36 @@ sub location_info {
return \%return;
}
+=item bill_now OPTION => VALUE, ...
+
+Bills a single customer now, in the same fashion as the "Bill now" link in the
+UI.
+
+Returns a hash reference with a single key, 'error'. If there is an error,
+the value contains the error, otherwise it is empty.
+
+=cut
+
+sub bill_now {
+ my( $class, %opt ) = @_;
+ my $conf = new FS::Conf;
+ return { 'error' => 'Incorrect shared secret' }
+ unless $opt{secret} eq $conf->config('api_shared_secret');
+
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $opt{custnum} })
+ or return { 'error' => 'Unknown custnum' };
+
+ my $error = $cust_main->bill_and_collect( 'fatal' => 'return',
+ 'retry' => 1,
+ 'check_freq' =>'1d',
+ );
+
+ return { 'error' => $error,
+ };
+
+}
+
+
#Advertising sources?
-----------------------------------------------------------------------
Summary of changes:
FS/FS/API.pm | 70 ++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 51 insertions(+), 19 deletions(-)
More information about the freeside-commits
mailing list