[freeside-commits] branch FREESIDE_3_BRANCH updated. c41cc3dd17fdb3c80ccc392accec60d6cd092de5
Ivan
ivan at 420.am
Mon Mar 28 16:59:18 PDT 2016
The branch, FREESIDE_3_BRANCH has been updated
via c41cc3dd17fdb3c80ccc392accec60d6cd092de5 (commit)
via 69d47821c9e8e73ad8e29879ee4c5820c10167d6 (commit)
from 6ffd5f96998ad58bb88e99a73033a2d9874eede0 (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 c41cc3dd17fdb3c80ccc392accec60d6cd092de5
Merge: 69d4782 6ffd5f9
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Mar 28 16:59:14 2016 -0700
Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH
commit 69d47821c9e8e73ad8e29879ee4c5820c10167d6
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Mar 28 16:58:26 2016 -0700
freeside inc. web services for address normalizaion and printing (v3 fix), RT#33849
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 04ea1eb..ecf57a6 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2352,12 +2352,18 @@ sub mimebuild_pdf {
);
}
+=item postal_mail_fsinc
+Sends this invoice to the Freeside Internet Services, Inc. print and mail
+service.
+
+=cut
use CAM::PDF;
use LWP::UserAgent;
use HTTP::Request::Common qw( POST );
use JSON::XS;
+use MIME::Base64;
sub postal_mail_fsinc {
my ( $self, %opt ) = @_;
@@ -2389,6 +2395,7 @@ sub postal_mail_fsinc {
} else {
die "Unparsable company_address; contact support\@freeside.biz\n";
}
+ $company_city =~ s/,$//;
my $file = $self->print_pdf(%opt, 'no_addresses' => 1);
my $pages = CAM::PDF->new($file)->numPages;
@@ -2396,7 +2403,7 @@ sub postal_mail_fsinc {
my $ua = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname'=>0 });
my $response = $ua->request( POST $url, [
'support-key' => scalar($conf->config('support-key')),
- 'file' => $file,
+ 'file' => encode_base64($file),
'pages' => $pages,
#from:
@@ -2434,28 +2441,11 @@ sub postal_mail_fsinc {
die $content->{error}."\n"
if $content->{error};
-}
-
-1;
- 'address1' => $bill_location->address1,
- 'address2' => $bill_location->address2,
- 'city' => $bill_location->city,
- 'state' => $bill_location->state,
- 'zip' => $bill_location->zip,
- 'country' => $bill_location->country,
- ]);
-
- die "Print connection error: ". $response->message
- unless $response->is_success;
-
- local $@;
- my $content = eval { decode_json($response->content) };
- die "Print JSON error : $@\n" if $@;
- die $content->{error}."\n"
- if $content->{error};
+ #TODO: store this so we can query for a status later
+ warn "Invoice printed, ID ". $content->{id}. "\n";
- #TODO: get some kind of letter ID back we can later retreive a status on
+ $content->{id};
}
=item _items_sections OPTIONS
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Template_Mixin.pm | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
More information about the freeside-commits
mailing list