From feef0e4c2b4bd6b776b25f5a1bd6fdbf63fd08b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 17 Aug 2005 22:23:46 +0000 Subject: infrastructure for easier schema changes, and: add payment_gateway, payment_gateway_option and agent_payment_gateway tables, add paystart_month, paystart_year, payissue and payip fields to cust_main, add preliminary gateway and gateway override editing to web UI, use payment gateway override when processing payments (card type, not taxclass yet) --- httemplate/browse/agent.cgi | 25 +++ httemplate/browse/payment_gateway.html | 70 ++++++ httemplate/docs/upgrade10.html | 347 ++--------------------------- httemplate/edit/agent_payment_gateway.html | 64 ++++++ httemplate/edit/payment_gateway.html | 108 +++++++++ httemplate/index.html | 2 + 6 files changed, 288 insertions(+), 328 deletions(-) create mode 100644 httemplate/browse/payment_gateway.html create mode 100644 httemplate/edit/agent_payment_gateway.html create mode 100644 httemplate/edit/payment_gateway.html (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index fd360ab3c..e3c4022d4 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -36,6 +36,7 @@ full offerings (via their type).

Reports Registration codes Prepaid cards + Payment Gateway Overrides Freq. Prog. @@ -174,6 +175,30 @@ foreach my $agent ( sort {
Generate cards + + + <% foreach my $override ( + # sort { } want taxclass-full stuff first? and default cards (empty cardtype) + qsearch('agent_payment_gateway', { 'agentnum' => $agent->agentnum } ) + ) { + %> + + + + <% } %> + + + +
+ <%= $override->cardtype || 'Default' %> to <%= $override->payment_gateway->gateway_module %> (<%= $override->payment_gateway->gateway_username %>) + <%= $override->taxclass + ? ' for '. $override->taxclass. ' only' + : '' + %> + (delete) +
(add override)
+ + <%= $agent->freq %> <%= $agent->prog %> diff --git a/httemplate/browse/payment_gateway.html b/httemplate/browse/payment_gateway.html new file mode 100644 index 000000000..bb7f31514 --- /dev/null +++ b/httemplate/browse/payment_gateway.html @@ -0,0 +1,70 @@ +<% + + my %search; + if ( $cgi->param('showdisabled') ) { + %search = (); + } else { + %search = ( 'disabled' => '' ); + } + +%> +<%= header('Payment gateways', menubar( + 'Main Menu' => $p, + 'Agents' => $p. 'browse/agent.cgi', +)) %> + +Add a new payment gateway

+ +<%= $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled gateways )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled gateways )'; } +%> + +<%= table() %> + + param('showdisabled') ? 1 : 2 %>># + Gateway + Username + Password + Action + Options + + +<% foreach my $payment_gateway ( qsearch( 'payment_gateway', \%search ) ) { %> + + + <%= $payment_gateway->gatewaynum %> + <% if ( !$cgi->param('showdisabled') ) { %> + <%= $payment_gateway->disabled ? 'DISABLED' : '' %> + <% } %> + <%= $payment_gateway->gateway_module %> + <%= !$payment_gateway->disabled + ? ' (disable)' + : '' + %> + + <%= $payment_gateway->gateway_username %> + - + <%= $payment_gateway->gateway_action %> + + + <% my %options = $payment_gateway->options; + foreach my $option ( keys %options ) { + %> + + + + + <% } %> +
<%= $option %>:<%= $options{$option} %>
+ + + +<% } %> + + + + + diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 1faaedee0..e1eb76881 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -5,6 +5,8 @@ NOTE: Version numbering has been simplified. 1.5.7 is the version after 1.5.0pre6. It is still a development version - releases with odd numbered middle parts (NN in x.NN.x) are development versions, like Perl or Linux. +If migrating from 1.5.7, see README.1.5.8 instead + If migrating from 1.5.0pre6, see README.1.5.7 instead install DBD::Pg 1.32, 1.41 or later (not 1.40) (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with this patch and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm) @@ -23,326 +25,15 @@ Spreadsheet::WriteExcel, IO-stringy (IO::Scalar), Frontier::RPC INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 20, 'svc_external-id', 'en_US', 'External ID' ); INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 21, 'svc_external-title', 'en_US', 'Title' ); -CREATE TABLE cust_bill_pkg_detail ( - detailnum serial, - pkgnum int NOT NULL, - invnum int NOT NULL, - detail varchar(80), - PRIMARY KEY (detailnum) -); -CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum ); - -CREATE TABLE part_virtual_field ( - vfieldpart int NOT NULL, - dbtable varchar(32) NOT NULL, - name varchar(32) NOT NULL, - check_block text, - list_source text, - length integer, - label varchar(80), - PRIMARY KEY (vfieldpart) -); - -CREATE TABLE virtual_field ( - recnum integer NOT NULL, - vfieldpart integer NOT NULL, - value varchar(128) NOT NULL, - PRIMARY KEY (vfieldpart, recnum) -); - -CREATE TABLE router ( - routernum serial, - routername varchar(80), - svcnum int, - PRIMARY KEY (routernum) -); - -CREATE TABLE part_svc_router ( - svcrouternum serial, - svcpart int NOT NULL, - routernum int NOT NULL, - PRIMARY KEY (svcrouternum) -); - -CREATE TABLE addr_block ( - blocknum serial, - routernum int NOT NULL, - ip_gateway varchar(15) NOT NULL, - ip_netmask int NOT NULL, - PRIMARY KEY (blocknum) -); -CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum ); - -CREATE TABLE svc_broadband ( - svcnum int NOT NULL, - blocknum int NOT NULL, - speed_up int NOT NULL, - speed_down int NOT NULL, - ip_addr varchar(15), - PRIMARY KEY (svcnum) -); - -CREATE TABLE acct_snarf ( - snarfnum serial, - svcnum int NOT NULL, - machine varchar(255) NULL, - protocol varchar(80) NULL, - username varchar(80) NULL, - _password varchar(80) NULL, - PRIMARY KEY (snarfnum) -); -CREATE INDEX acct_snarf1 ON acct_snarf ( svcnum ); - -CREATE TABLE svc_external ( - svcnum int NOT NULL, - id int, - title varchar(80), - PRIMARY KEY (svcnum) -); - -ALTER TABLE part_pkg ADD COLUMN taxclass varchar(80) NULL; -ALTER TABLE h_part_pkg ADD COLUMN taxclass varchar(80) NULL; - -CREATE TABLE cust_pay_refund ( - payrefundnum serial NOT NULL, - paynum int NOT NULL, - refundnum int NOT NULL, - _date int NOT NULL, - amount decimal(10,2) NOT NULL, - PRIMARY KEY (payrefundnum) -); -CREATE INDEX cust_pay_refund1 ON cust_pay_refund(paynum); -CREATE INDEX cust_pay_refund2 ON cust_pay_refund(refundnum); - -CREATE TABLE cust_pay_void ( - paynum int NOT NULL, - custnum int NOT NULL, - paid decimal(10,2) NOT NULL, - _date int, - payby char(4) NOT NULL, - payinfo varchar(80), - paybatch varchar(80), - closed char(1), - void_date int, - reason varchar(80), - otaker varchar(32) NOT NULL, - PRIMARY KEY (paynum) -); -CREATE INDEX cust_pay_void1 ON cust_pay_void(custnum); - -CREATE TABLE part_pkg_option ( - optionnum serial, - pkgpart int not null, - optionname varchar(80) not null, - optionvalue text NULL, - PRIMARY KEY (optionnum) -); -CREATE INDEX part_pkg_option1 ON part_pkg_option ( pkgpart ); -CREATE INDEX part_pkg_option2 ON part_pkg_option ( optionname ); - -CREATE TABLE rate ( - ratenum serial NOT NULL, - ratename varchar(80) NOT NULL, - PRIMARY KEY (ratenum) -); - -CREATE TABLE rate_detail ( - ratedetailnum serial NOT NULL, - ratenum int NOT NULL, - orig_regionnum int NULL, - dest_regionnum int NOT NULL, - min_included int NOT NULL, - min_charge decimal(10,2) NOT NULL, - sec_granularity int NOT NULL, - PRIMARY KEY (ratedetailnum) -); -CREATE UNIQUE INDEX rate_detail1 ON rate_detail ( ratenum, orig_regionnum, dest_regionnum ); - -CREATE TABLE rate_region ( - regionnum serial NOT NULL, - regionname varchar(80) NOT NULL, - PRIMARY KEY (regionnum) -); - -CREATE TABLE rate_prefix ( - prefixnum serial NOT NULL, - regionnum int NOT NULL, - countrycode varchar(3) NOT NULL, - npa varchar(6) NULL, - nxx varchar(3) NULL, - PRIMARY KEY (prefixnum) -); -CREATE INDEX rate_prefix1 ON rate_prefix ( countrycode ); -CREATE INDEX rate_prefix2 ON rate_prefix ( regionnum ); - -CREATE TABLE reg_code ( - codenum serial NOT NULL, - code varchar(80) NOT NULL, - agentnum int NOT NULL, - PRIMARY KEY (codenum) -); -CREATE UNIQUE INDEX reg_code1 ON reg_code ( agentnum, code ); -CREATE INDEX reg_code2 ON reg_code ( agentnum ); - -CREATE TABLE reg_code_pkg ( - codepkgnum serial, - codenum int NOT NULL, - pkgpart int NOT NULL, - PRIMARY KEY (codepkgnum) -); -CREATE UNIQUE INDEX reg_code_pkg1 ON reg_code_pkg ( codenum, pkgpart ); -CREATE INDEX reg_code_pkg2 ON reg_code_pkg ( codenum ); - -CREATE TABLE clientapi_session ( - sessionnum serial NOT NULL, - sessionid varchar(80) NOT NULL, - namespace varchar(80) NOT NULL, - PRIMARY KEY (sessionnum) -); -CREATE UNIQUE INDEX clientapi_session1 ON clientapi_session ( sessionid, namespace ); - -CREATE TABLE clientapi_session_field ( - fieldnum serial NOT NULL, - sessionnum int NOT NULL, - fieldname varchar(80) NOT NULL, - fieldvalue text NULL, - PRIMARY KEY (fieldnum) -); -CREATE UNIQUE INDEX clientapi_session_field1 ON clientapi_session_field ( sessionnum, fieldname ); - DROP INDEX cust_bill_pkg1; -ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL; -ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL; -ALTER TABLE cust_main_county ADD taxname varchar(80) NULL; -ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL; -ALTER TABLE cust_main_county ADD setuptax char(1) NULL; -ALTER TABLE h_cust_main_county ADD setuptax char(1) NULL; -ALTER TABLE cust_main_county ADD recurtax char(1) NULL; -ALTER TABLE h_cust_main_county ADD recurtax char(1) NULL; -ALTER TABLE cust_pkg ADD last_bill int NULL; -ALTER TABLE h_cust_pkg ADD last_bill int NULL; -ALTER TABLE agent ADD disabled char(1) NULL; -ALTER TABLE h_agent ADD disabled char(1) NULL; -ALTER TABLE agent ADD username varchar(80) NULL; -ALTER TABLE h_agent ADD username varchar(80) NULL; -ALTER TABLE agent ADD _password varchar(80) NULL; -ALTER TABLE h_agent ADD _password varchar(80) NULL; -ALTER TABLE cust_main ADD paycvv varchar(512) NULL; -ALTER TABLE h_cust_main ADD paycvv varchar(512) NULL; -ALTER TABLE cust_main ADD paymask varchar(80) NULL; -ALTER TABLE h_cust_main ADD paymask varchar(80) NULL; -ALTER TABLE part_referral ADD disabled char(1) NULL; -ALTER TABLE h_part_referral ADD disabled char(1) NULL; -CREATE INDEX part_referral1 ON part_referral ( disabled ); -ALTER TABLE pkg_svc ADD primary_svc char(1) NULL; -ALTER TABLE h_pkg_svc ADD primary_svc char(1) NULL; -ALTER TABLE svc_forward ADD src varchar(255) NULL; -ALTER TABLE h_svc_forward ADD src varchar(255) NULL; -ALTER TABLE part_pkg ADD promo_code varchar(80) NULL; -ALTER TABLE h_part_pkg ADD promo_code varchar(80) NULL; -CREATE INDEX part_pkg2 ON part_pkg ( promo_code ); -CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code ); -ALTER TABLE prepay_credit ADD agentnum integer NULL; -ALTER TABLE h_prepay_credit ADD agentnum integer NULL; - -ALTER TABLE type_pkgs ADD typepkgnum int; -ALTER TABLE type_pkgs ALTER COLUMN typepkgnum SET DEFAULT nextval('public.type_pkgs_typepkgnum_seq'::text); -CREATE SEQUENCE type_pkgs_typepkgnum_seq; -UPDATE type_pkgs SET typepkgnum = nextval('public.type_pkgs_typepkgnum_seq'::text) WHERE typepkgnum IS NULL; -ALTER TABLE type_pkgs ALTER typepkgnum SET NOT NULL; -ALTER TABLE type_pkgs ADD PRIMARY KEY (typepkgnum); -ALTER TABLE h_type_pkgs ADD typepkgnum int; - -ALTER TABLE cust_bill_pkg ADD billpkgnum int; -ALTER TABLE cust_bill_pkg ALTER COLUMN billpkgnum SET DEFAULT nextval('public.cust_bill_pkg_billpkgnum_seq'::text); -CREATE SEQUENCE cust_bill_pkg_billpkgnum_seq; -UPDATE cust_bill_pkg SET billpkgnum = nextval('public.cust_bill_pkg_billpkgnum_seq'::text) WHERE billpkgnum IS NULL; -ALTER TABLE cust_bill_pkg ALTER billpkgnum SET NOT NULL; -ALTER TABLE cust_bill_pkg ADD PRIMARY KEY (billpkgnum); -ALTER TABLE h_cust_bill_pkg ADD billpkgnum int; - -ALTER TABLE pkg_svc ADD pkgsvcnum int; -ALTER TABLE pkg_svc ALTER COLUMN pkgsvcnum SET DEFAULT nextval('public.pkg_svc_pkgsvcnum_seq'::text); -CREATE SEQUENCE pkg_svc_pkgsvcnum_seq; -UPDATE pkg_svc SET pkgsvcnum = nextval('public.pkg_svc_pkgsvcnum_seq'::text) WHERE pkgsvcnum IS NULL; -ALTER TABLE pkg_svc ALTER pkgsvcnum SET NOT NULL; -ALTER TABLE pkg_svc ADD PRIMARY KEY (pkgsvcnum); -ALTER TABLE h_pkg_svc ADD pkgsvcnum int; - On recent Pg versions: ALTER TABLE cust_main ALTER COLUMN payinfo varchar(512) NULL; ALTER TABLE h_cust_main ALTER COLUMN payinfo varchar(512) NULL; Or on older Pg versions that don't support altering columns directly: - +(write me) On recent Pg versions: @@ -368,25 +59,25 @@ If you created your database with a version before 1.4.2, dump database, edit: - domain_record and h_domain_record: increase recdata from 80 to 255 then reload -optionally: - - CREATE INDEX cust_main6 ON cust_main ( daytime ); - CREATE INDEX cust_main7 ON cust_main ( night ); - CREATE INDEX cust_main8 ON cust_main ( fax ); - CREATE INDEX cust_main9 ON cust_main ( ship_daytime ); - CREATE INDEX cust_main10 ON cust_main ( ship_night ); - CREATE INDEX cust_main11 ON cust_main ( ship_fax ); - CREATE INDEX agent2 ON agent ( disabled ); - CREATE INDEX part_bill_event2 ON part_bill_event ( disabled ); - CREATE INDEX cust_pay4 ON cust_pay (_date); +mandatory again: - serial columns +make install-perl-modules to install the new libraries and CLI utilities +run "freeside-upgrade username" to create the remaining new tables and columns -mandatory again: +optionally: -dbdef-create username -create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf svc_external cust_pay_refund cust_pay_void part_pkg_option rate rate_detail rate_region rate_prefix reg_code reg_code_pkg -dbdef-create username +CREATE INDEX cust_main6 ON cust_main ( daytime ); +CREATE INDEX cust_main7 ON cust_main ( night ); +CREATE INDEX cust_main8 ON cust_main ( fax ); +CREATE INDEX cust_main9 ON cust_main ( ship_daytime ); +CREATE INDEX cust_main10 ON cust_main ( ship_night ); +CREATE INDEX cust_main11 ON cust_main ( ship_fax ); +CREATE INDEX agent2 ON agent ( disabled ); +CREATE INDEX part_bill_event2 ON part_bill_event ( disabled ); +CREATE INDEX cust_pay4 ON cust_pay (_date); +CREATE INDEX part_referral1 ON part_referral ( disabled ); +CREATE INDEX part_pkg2 ON part_pkg ( promo_code ); +CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code ); apache - fix sections to include .html also diff --git a/httemplate/edit/agent_payment_gateway.html b/httemplate/edit/agent_payment_gateway.html new file mode 100644 index 000000000..61d29e0e9 --- /dev/null +++ b/httemplate/edit/agent_payment_gateway.html @@ -0,0 +1,64 @@ +<% + +$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum"; +my $agent = qsearchs('agent', { 'agentnum' => $1 } ); +die "agentnum $1 not found" unless $agent; + +#my @agent_payment_gateway; +if ( $cgi->param('error') ) { +} + +my $action = 'Add'; + +%> + +<%= header("$action payment gateway override for ". $agent->agent, menubar( + 'Main Menu' => $p, + #'View all payment gateways' => $p. 'browse/payment_gateway.html', + 'View all agents' => $p. 'browse/agent.html', +)) %> + +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +<% } %> + +
+ + +Use gateway +

+ +for +

+ +(optional) when invoice contains only items of taxclass +

+ + +
+ + diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html new file mode 100644 index 000000000..837d0c408 --- /dev/null +++ b/httemplate/edit/payment_gateway.html @@ -0,0 +1,108 @@ +<% + +my $payment_gateway; +if ( $cgi->param('error') ) { + $payment_gateway = new FS::payment_gateway ( { + map { $_, scalar($cgi->param($_)) } fields('payment_gateway') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $payment_gateway = qsearchs( 'payment_gateway', { 'gatewaynum' => $1 } ); +} else { #adding + $payment_gateway = new FS::payment_gateway {}; +} +my $action = $payment_gateway->gatewaynum ? 'Edit' : 'Add'; +#my $hashref = $payment_gateway->hashref; + +%> + +<%= header("$action Payment gateway", menubar( + 'Main Menu' => $p, + 'View all payment gateways' => $p. 'browse/payment_gateway.html', +)) %> + +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +<% } %> + +
+ +Gateway #<%= $payment_gateway->gatewaynum || "(NEW)" %> + +<%= ntable('#cccccc', 2, '') %> + + + Gateway: + + + + + + Username: + + + + + Password: + + + + + Action: + + + + + + + Options: + + + + + +
"> +
+ + + diff --git a/httemplate/index.html b/httemplate/index.html index 067fec5d1..82a028126 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -244,6 +244,8 @@ Billing