sub new {
-
my($class,$processor,%data) = @_;
Carp::croak("unspecified processor") unless $processor;
if($params{'type'}) { $self->transaction_type($params{'type'}); }
%{$self->{'_content'}} = %params;
}
- return %{$self->{'_content'}};
+ return exists $self->{'_content'} ? %{$self->{'_content'}} : ();
}
sub required_fields {
# AutoLoader::AUTOLOAD, instead of passing up the chain
sub build_subs {
my $self = shift;
- no warnings 'redefine';
+
foreach(@_) {
+ next if($self->can($_));
eval "sub $_ { my \$self = shift; if(\@_) { \$self->{$_} = shift; } return \$self->{$_}; }";
}
}
my $transaction = new Business::OnlinePayment($processor, %processor_info);
$transaction->content(
- type => 'Visa',
- amount => '49.95',
- cardnumber => '1234123412341238',
- expiration => '0100',
- name => 'John Q Doe',
+ type => 'Visa',
+ amount => '49.95',
+ card_number => '1234123412341238',
+ expiration => '0100',
+ name => 'John Q Doe',
);
$transaction->submit();