X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2FSelfService.pm;h=4367aa1e45b0cf095cb89b204b4f220eaad18def;hb=ee2d1447f9130fb9ed20d54f0169ab7a8f87167e;hp=fe17fae5ddc61c2fbdf78f4b6188da5444ce67c6;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index fe17fae5d..4367aa1e4 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -21,41 +21,45 @@ $socket .= '.'.$tag if defined $tag && length($tag); #maybe should ask ClientAPI for this list %autoload = ( - 'passwd' => 'passwd/passwd', - 'chfn' => 'passwd/passwd', - 'chsh' => 'passwd/passwd', - 'login' => 'MyAccount/login', - 'logout' => 'MyAccount/logout', - 'customer_info' => 'MyAccount/customer_info', - 'edit_info' => 'MyAccount/edit_info', #add to ss cgi! - 'invoice' => 'MyAccount/invoice', - 'invoice_logo' => 'MyAccount/invoice_logo', - 'list_invoices' => 'MyAccount/list_invoices', #? - 'cancel' => 'MyAccount/cancel', #add to ss cgi! - 'payment_info' => 'MyAccount/payment_info', - 'process_payment' => 'MyAccount/process_payment', - 'process_prepay' => 'MyAccount/process_prepay', - 'list_pkgs' => 'MyAccount/list_pkgs', #add to ss cgi (added?) - 'list_svcs' => 'MyAccount/list_svcs', #add to ss cgi (added?) - 'list_svc_usage' => 'MyAccount/list_svc_usage', - 'order_pkg' => 'MyAccount/order_pkg', #add to ss cgi! - 'change_pkg' => 'MyAccount/change_pkg', - 'order_recharge' => 'MyAccount/order_recharge', - 'cancel_pkg' => 'MyAccount/cancel_pkg', #add to ss cgi! - 'charge' => 'MyAccount/charge', #? - 'part_svc_info' => 'MyAccount/part_svc_info', - 'provision_acct' => 'MyAccount/provision_acct', - 'provision_external' => 'MyAccount/provision_external', - 'unprovision_svc' => 'MyAccount/unprovision_svc', - 'myaccount_passwd' => 'MyAccount/myaccount_passwd', - 'signup_info' => 'Signup/signup_info', - 'new_customer' => 'Signup/new_customer', - 'agent_login' => 'Agent/agent_login', - 'agent_logout' => 'Agent/agent_logout', - 'agent_info' => 'Agent/agent_info', - 'agent_list_customers' => 'Agent/agent_list_customers', + 'passwd' => 'passwd/passwd', + 'chfn' => 'passwd/passwd', + 'chsh' => 'passwd/passwd', + 'login' => 'MyAccount/login', + 'logout' => 'MyAccount/logout', + 'customer_info' => 'MyAccount/customer_info', + 'edit_info' => 'MyAccount/edit_info', #add to ss cgi! + 'invoice' => 'MyAccount/invoice', + 'invoice_logo' => 'MyAccount/invoice_logo', + 'list_invoices' => 'MyAccount/list_invoices', #? + 'cancel' => 'MyAccount/cancel', #add to ss cgi! + 'payment_info' => 'MyAccount/payment_info', + 'process_payment' => 'MyAccount/process_payment', + 'process_payment_order_pkg' => 'MyAccount/process_payment_order_pkg', + 'process_prepay' => 'MyAccount/process_prepay', + 'list_pkgs' => 'MyAccount/list_pkgs', #add to ss (added?) + 'list_svcs' => 'MyAccount/list_svcs', #add to ss (added?) + 'list_svc_usage' => 'MyAccount/list_svc_usage', + 'list_support_usage' => 'MyAccount/list_support_usage', + 'order_pkg' => 'MyAccount/order_pkg', #add to ss cgi! + 'change_pkg' => 'MyAccount/change_pkg', + 'order_recharge' => 'MyAccount/order_recharge', + 'cancel_pkg' => 'MyAccount/cancel_pkg', #add to ss cgi! + 'charge' => 'MyAccount/charge', #? + 'part_svc_info' => 'MyAccount/part_svc_info', + 'provision_acct' => 'MyAccount/provision_acct', + 'provision_external' => 'MyAccount/provision_external', + 'unprovision_svc' => 'MyAccount/unprovision_svc', + 'myaccount_passwd' => 'MyAccount/myaccount_passwd', + 'signup_info' => 'Signup/signup_info', + 'domain_select_hash' => 'Signup/domain_select_hash', # expose? + 'new_customer' => 'Signup/new_customer', + 'agent_login' => 'Agent/agent_login', + 'agent_logout' => 'Agent/agent_logout', + 'agent_info' => 'Agent/agent_info', + 'agent_list_customers' => 'Agent/agent_list_customers', + 'mason_comp' => 'MasonComponent/mason_comp', ); -@EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector ) ); +@EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector domainselector didselector) ); $ENV{'PATH'} ='/usr/bin:/usr/ucb:/bin'; $ENV{'SHELL'} = '/bin/sh'; @@ -189,11 +193,16 @@ FS::SelfService - Freeside self-service API 'payname' => $payname, 'invoicing_list' => $invoicing_list, 'referral_custnum' => $referral_custnum, + 'agentnum' => $agentnum, 'pkgpart' => $pkgpart, + 'username' => $username, '_password' => $password, 'popnum' => $popnum, - 'agentnum' => $agentnum, + #OR + 'countrycode' => 1, + 'phonenum' => $phonenum, + 'pin' => $pin, } ); @@ -238,10 +247,16 @@ following keys: =item username +Username + =item domain +Domain + =item password +Password + =back Returns a hash reference with the following keys: @@ -285,7 +300,9 @@ the following keys: invnum, date, owed An HTML fragment containing shipping and billing addresses. -=item The following fields are also returned: first last company address1 address2 city county state zip country daytime night fax ship_first ship_last ship_company ship_address1 ship_address2 ship_city ship_state ship_zip ship_country ship_daytime ship_night ship_fax payby payinfo payname month year invoicing_list postal_invoicing +=item The following fields are also returned + +first last company address1 address2 city county state zip country daytime night fax ship_first ship_last ship_company ship_address1 ship_address2 ship_city ship_state ship_zip ship_country ship_daytime ship_night ship_fax payby payinfo payname month year invoicing_list postal_invoicing =back @@ -389,14 +406,24 @@ Exact name on credit card (CARD/DCRD) =item address1 +Address line one + =item address2 +Address line two + =item city +City + =item state +State + =item zip +Zip or postal code + =item payby Customer's current default payment type. @@ -446,6 +473,12 @@ hash reference as parameter with the following keys: =item session_id +Session identifier + +=item amount + +Amount + =item save If true, address and card information entered will be saved for subsequent @@ -459,16 +492,28 @@ payby to DCRD). This option only has meaning if B is set true. =item payname +Name on card + =item address1 +Address line one + =item address2 +Address line two + =item city +City + =item state +State + =item zip +Zip or postal code + =item payinfo Card number @@ -493,7 +538,8 @@ error message on errors =item list_pkgs -Returns package information for this customer. +Returns package information for this customer. For more detail on services, +see L. Takes a hash reference as parameter with a single key: B @@ -501,6 +547,9 @@ Returns a hash reference containing customer package information. The hash refe =over 4 +=item custnum + +Customer number =item cust_pkg HASHREF @@ -508,15 +557,81 @@ Array reference of hash references, each of which has the fields of a cust_pkg record (see L) as well as the fields below. Note these are not the internal FS:: objects, but hash references of columns and values. -=item all fields of part_pkg (XXXpare this down to a secure subset) +=over 4 -=item part_svc - An array of hash references, each of which has the following keys: +=item part_pkg fields + +All fields of part_pkg for this specific cust_pkg (be careful with this +information - it may reveal more about your available packages than you would +like users to know in aggregate) + +=cut + +#XXX pare part_pkg fields down to a more secure subset + +=item part_svc + +An array of hash references indicating information on unprovisioned services +available for provisioning for this specific cust_pkg. Each has the following +keys: =over 4 -=item all fields of part_svc (XXXpare this down to a secure subset) +=item part_svc fields + +All fields of part_svc (be careful with this information - it may reveal more +about your available packages than you would like users to know in aggregate) + +=cut + +#XXX pare part_svc fields down to a more secure subset + +=back + +=item cust_svc + +An array of hash references indicating information on the customer services +already provisioned for this specific cust_pkg. Each has the following keys: + +=over 4 + +=item label + +Array reference with three elements: + +=over 4 + +=item + +Name of this service + +=item + +Meaningful user-specific identifier for the service (i.e. username, domain or mail alias) + +=item + +Table name of this service + +=back + +=item svcnum + +Primary key for this service + +=item svcpart + +Service definition (part_pkg) + +=item pkgnum + +Customer package (cust_pkg) + +=item overlimit -=item avail +Blank if the service is not over limit, or the date the service exceeded its usage limit (as a UNIX timestamp). + +=back =back @@ -526,6 +641,92 @@ Empty on success, or an error message on errors. =back +=item list_svcs + +Returns service information for this customer. + +Takes a hash reference as parameter with a single key: B + +Returns a hash reference containing customer package information. The hash reference contains the following keys: + +=over 4 + +=item custnum + +Customer number + +=item svcs + +An array of hash references indicating information on all of this customer's +services. Each has the following keys: + +=over 4 + +=item svcnum + +Primary key for this service + +=item label + +Name of this service + +=item value + +Meaningful user-specific identifier for the service (i.e. username, domain, or +mail alias). + +=back + +Account (svc_acct) services also have the following keys: + +=item username + +Username + +=item email + +username@domain + +=item seconds + +Seconds remaining + +=item upbytes + +Upload bytes remaining + +=item downbytes + +Download bytes remaining + +=item totalbytes + +Total bytes remaining + +=item recharge_amount + +Cost of a recharge + +=item recharge_seconds + +Number of seconds gained by recharge + +=item recharge_upbytes + +Number of upload bytes gained by recharge + +=item recharge_downbytes + +Number of download bytes gained by recharge + +=item recharge_totalbytes + +Number of total bytes gained by recharge + +=back + +=back + =item order_pkg Orders a package for this customer. @@ -536,8 +737,12 @@ Takes a hash reference as parameter with the following keys: =item session_id +Session identifier + =item pkgpart +pkgpart of package to order + =item svcpart optional svcpart, required only if the package definition does not contain @@ -546,12 +751,20 @@ quantity >1) =item username +Username + =item _password +Password + =item sec_phrase +Optional security phrase + =item popnum +Optional Access number number + =back Returns a hash reference with a single key, B, empty on success, or an @@ -568,8 +781,12 @@ Takes a hash reference as parameter with the following keys: =item session_id +Session identifier + =item pkgpart +pkgpart of package to cancel + =back Returns a hash reference with a single key, B, empty on success, or an @@ -628,21 +845,37 @@ Array reference of acceptable payment types for signup =over 4 -=item CARD (credit card - automatic) +=item CARD + +credit card - automatic + +=item DCRD + +credit card - on-demand - version 1.5+ only + +=item CHEK + +electronic check - automatic + +=item DCHK + +electronic check - on-demand - version 1.5+ only -=item DCRD (credit card - on-demand - version 1.5+ only) +=item LECB -=item CHEK (electronic check - automatic) +Phone bill billing -=item DCHK (electronic check - on-demand - version 1.5+ only) +=item BILL -=item LECB (Phone bill billing) +billing, not recommended for signups -=item BILL (billing, not recommended for signups) +=item COMP -=item COMP (free, definately not recommended for signups) +free, definitely not recommended for signups -=item PREPAY (special billing type: applies a credit (see FS::prepay_credit) and sets billing type to BILL) +=item PREPAY + +special billing type: applies a credit (see FS::prepay_credit) and sets billing type to BILL =back @@ -671,57 +904,121 @@ following keys: =over 4 -=item first - first name (required) +=item first + +first name (required) + +=item last + +last name (required) -=item last - last name (required) +=item ss -=item ss (not typically collected; mostly used for ACH transactions) +(not typically collected; mostly used for ACH transactions) =item company +Company name + =item address1 (required) +Address line one + =item address2 +Address line two + =item city (required) +City + =item county +County + =item state (required) +State + =item zip (required) -=item daytime - phone +Zip or postal code + +=item daytime -=item night - phone +Daytime phone number -=item fax - phone +=item night -=item payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, COMP or PREPAY (see L (required) +Evening phone number -=item payinfo - Card number for CARD/DCRD, account_number@aba_number for CHEK/DCHK, prepaid "pin" for PREPAY, purchase order number for BILL +=item fax -=item paycvv - Credit card CVV2 number (1.5+ or 1.4.2 with CVV schema patch) +Fax number -=item paydate - Expiration date for CARD/DCRD +=item payby + +CARD, DCRD, CHEK, DCHK, LECB, BILL, COMP or PREPAY (see L (required) + +=item payinfo + +Card number for CARD/DCRD, account_number@aba_number for CHEK/DCHK, prepaid "pin" for PREPAY, purchase order number for BILL + +=item paycvv + +Credit card CVV2 number (1.5+ or 1.4.2 with CVV schema patch) + +=item paydate + +Expiration date for CARD/DCRD + +=item payname -=item payname - Exact name on credit card for CARD/DCRD, bank name for CHEK/DCHK +Exact name on credit card for CARD/DCRD, bank name for CHEK/DCHK -=item invoicing_list - comma-separated list of email addresses for email invoices. The special value 'POST' is used to designate postal invoicing (it may be specified alone or in addition to email addresses), +=item invoicing_list -=item referral_custnum - referring customer number +comma-separated list of email addresses for email invoices. The special value 'POST' is used to designate postal invoicing (it may be specified alone or in addition to email addresses), -=item pkgpart - pkgpart of initial package +=item referral_custnum + +referring customer number + +=item agentnum + +Agent number + +=item pkgpart + +pkgpart of initial package =item username +Username + =item _password -=item sec_phrase - security phrase +Password + +=item sec_phrase + +Security phrase + +=item popnum + +Access number (index, not the literal number) + +=item countrycode + +Country code (to be provisioned as a service) -=item popnum - access number (index, not the literal number) +=item phonenum -=item agentnum - agent number +Phone number (to be provisioned as a service) + +=item pin + +Voicemail PIN =back @@ -729,7 +1026,9 @@ Returns a hash reference with the following keys: =over 4 -=item error Empty on success, or an error message on errors. The special error '_decline' is returned for declined transactions; other error messages should be suitable for display to the user (and are customizable in under Sysadmin | View/Edit message catalog) +=item error + +Empty on success, or an error message on errors. The special error '_decline' is returned for declined transactions; other error messages should be suitable for display to the user (and are customizable in under Configuration | View/Edit message catalog) =back @@ -741,19 +1040,35 @@ Takes as input a hashref or list of key/value pairs with the following keys: =item selected_county +Currently selected county + =item selected_state +Currently selected state + =item selected_country -=item prefix - Specify a unique prefix string if you intend to use the HTML output multiple time son one page. +Currently selected country + +=item prefix -=item onchange - Specify a javascript subroutine to call on changes +Specify a unique prefix string if you intend to use the HTML output multiple time son one page. + +=item onchange + +Specify a javascript subroutine to call on changes =item default_state +Default state + =item default_country -=item locales - An arrayref of hash references specifying regions. Normally you can just pass the value of the I field returned by B. +Default country + +=item locales + +An arrayref of hash references specifying regions. Normally you can just pass the value of the I field returned by B. =back @@ -951,7 +1266,11 @@ Takes as input a hashref or list of key/value pairs with the following keys: =item popnum -=item pops - An arrayref of hash references specifying access numbers. Normally you can just pass the value of the I field returned by B. +Access number number + +=item pops + +An arrayref of hash references specifying access numbers. Normally you can just pass the value of the I field returned by B. =back @@ -1082,6 +1401,99 @@ END } +=item domainselector HASHREF | LIST + +Takes as input a hashref or list of key/value pairs with the following keys: + +=over 4 + +=item pkgnum + +Package number + +=item domsvc + +Service number of the selected item. + +=back + +Returns an HTML fragment for domain selection. + +=cut + +sub domainselector { + my $param; + if ( ref($_[0]) ) { + $param = shift; + } else { + $param = { @_ }; + } + my $domsvc= $param->{'domsvc'}; + my $rv = + domain_select_hash(map {$_ => $param->{$_}} qw(pkgnum svcpart pkgpart) ); + my $domains = $rv->{'domains'}; + $domsvc = $rv->{'domsvc'} unless $domsvc; + + return '' + unless scalar(keys %$domains); + + if (scalar(keys %$domains) == 1) { + my $key; + foreach(keys %$domains) { + $key = $_; + } + return 'Domain'. $domains->{$key}. + '' + } + + my $text .= qq!Domain!; + + $text; + +} + +=item didselector HASHREF | LIST + +Takes as input a hashref or list of key/value pairs with the following keys: + +=over 4 + +=item field + +=item svcpart + +=back + +Returns an HTML fragment for DID selection. + +=cut + +sub didselector { + my $param; + if ( ref($_[0]) ) { + $param = shift; + } else { + $param = { @_ }; + } + + my $rv = mason_comp( 'comp'=>'/elements/select-did.html', + 'args'=>[ %$param ], + ); + + #hmm. + $rv->{'error'} || $rv->{'output'}; + +} + =back =head1 RESELLER FUNCTIONS