% include( 'elements/edit.html',
'table' => 'payment_gateway',
'name_singular' => 'Payment gateway',
'viewall_dir' => 'browse',
'fields' => $fields,
'field_callback' => $field_callback,
'labels' => {
'gatewaynum' => 'Gateway',
'gateway_namespace' => 'Gateway type',
'gateway_module' => 'Gateway',
'gateway_username' => 'Username',
'gateway_password' => 'Password',
'gateway_action' => 'Action',
'gateway_options' => 'Options (Name/Value pairs,
one element per line)',
'gateway_callback_url' => 'Callback URL',
'gateway_cancel_url' => 'Cancel URL',
},
)
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my $json = JSON::XS->new;
$json->canonical(1);
my %modules = (
'Business::OnlinePayment' => [
'2CheckOut',
'AuthorizeNet',
'BankOfAmerica', #deprecated?
'Beanstream',
'Capstone',
'Cardstream',
'CashCow',
'CyberSource',
'eSec',
'eSelectPlus',
'ElavonVirtualMerchant',
'Exact',
'iAuthorizer',
'Ingotz',
'InternetSecure',
'IPaymentTPG',
'IPPay',
'Iridium',
'Jettis',
'Jety',
'LinkPoint',
'MerchantCommerce',
'Network1Financial',
'OCV',
'OpenECHO',
'PayConnect',
'PayflowPro',
'PaymenTech',
'PaymentsGateway',
'PayPal',
#'PaySystems',
'PlugnPay',
'PPIPayMover',
'Protx', #now SagePay
'PXPost',
'SagePay',
'SecureHostingUPG',
'Skipjack',
'StGeorge',
'SurePay',
'TCLink',
'TransactionCentral',
'TransFirsteLink',
'Vanco',
'viaKLIX',
'VirtualNet',
'WesternACH',
'WorldPay',
],
'Business::OnlineThirdPartyPayment' => [
#'eWayShared', support currently broken
#'Interswitchng',
'PayPal',
'FCMB',
],
'Business::BatchPayment' => [
'KeyBank',
'Paymentech',
'TD_EFT',
],
);
my @actions = (
'Normal Authorization',
'Authorization Only',
'Authorization Only,Post Authorization',
);
my $fields = [ {
field => 'gateway_namespace',
type => 'select',
options => [ qw(
Business::OnlinePayment
Business::BatchPayment
Business::OnlineThirdPartyPayment
) ],
labels => {
'Business::OnlinePayment' => 'Direct',
'Business::BatchPayment' => 'Batch',
'Business::OnlineThirdPartyPayment' => 'Hosted',
},
onchange => 'changeNamespace',
},
{
field => 'gateway_module',
type => 'select',
# does it even make sense to list all modules here?
options => [ sort { lc($a) cmp lc ($b) }
map { @$_ } values %modules ],
},
'gateway_username',
'gateway_password',
{
field => 'gateway_action',
type => 'select',
options => \@actions,
},
{
field => 'gateway_callback_url',
type => 'text',
size => 40,
},
{
field => 'gateway_cancel_url',
type => 'text',
size => 40,
},
{
field => 'gateway_options',
type => 'textarea',
rows => '12',
cols => '40',
curr_value_callback => sub { my($cgi, $object, $fref) = @_;
join("\r", $object->options );
},
},
];
my $field_callback = sub {
my ($cgi, $object, $field_hashref ) = @_;
if ($object->gatewaynum) {
if ( $field_hashref->{field} eq 'gateway_module' ) {
$field_hashref->{type} = 'fixed';
} elsif ( $field_hashref->{field} eq 'gateway_namespace' ) {
$field_hashref->{type} = 'fixed';
$field_hashref->{formatted_value} = $object->namespace_description;
}
}
};
%init>