[interchange/gateway_log] GatewayLog Miscellaneous
Mark Johnson <[email protected]> Thu, 23 Nov 2017 17:28:24 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 98a43f0164d93298c1c08f1121f7d6339e926907 Author: Mark Johnson <[email protected]> Date: Thu Nov 23 12:26:24 2017 -0500 GatewayLog Miscellaneous * Allow arbitrary attributes to be added to the Vend::Payment::GatewayLog object. * Pull email field in PaypalExpress directly from $Values as in testing $actual and $opt->{actual} were undefined. lib/Vend/Payment/GatewayLog.pm | 15 ++++++++++----- lib/Vend/Payment/PaypalExpress.pm | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) --- diff --git a/lib/Vend/Payment/GatewayLog.pm b/lib/Vend/Payment/GatewayLog.pm index 3c9e4bb..cf7a4cc 100644 --- a/lib/Vend/Payment/GatewayLog.pm +++ b/lib/Vend/Payment/GatewayLog.pm @@ -9,23 +9,27 @@ sub new { my ($class, $opt) = @_; #::logDebug("Called in class $class, with opt hash %s", ::uneval($opt)); my $self = bless ({}, $class); - $self->init($opt); + $self->init(%{$opt || {}}); $Vend::Payment::Global_Timeout = undef; return $self; } sub init { my $self = shift; - my $opt = shift; - $self->{_log_table} = $opt->{LogTable} || 'gateway_log'; - $self->{_enabled} = $opt->{Enabled} || ''; - $self->{_source} = $opt->{Source} || ''; + my %opt = @_; + $self->{_log_table} = delete ($opt{LogTable}) || 'gateway_log'; + $self->{_enabled} = delete ($opt{Enabled}) || ''; + $self->{_source} = delete ($opt{Source}) || ''; unless (length ($self->{_source})) { my $host = `hostname -s`; chomp ($self->{_source} = $host); } + if (my @k = keys %opt) { + @$self{@k} = @opt{@k}; + } + return 1; } @@ -120,6 +124,7 @@ sub write { my $self = shift; my $data = shift; +#::logDebug('Ready to write: %s', ::uneval($data)); eval { my $table = $self->table; my $db = ::database_exists_ref($table) diff --git a/lib/Vend/Payment/PaypalExpress.pm b/lib/Vend/Payment/PaypalExpress.pm index 8d16b5a..794c656 100644 --- a/lib/Vend/Payment/PaypalExpress.pm +++ b/lib/Vend/Payment/PaypalExpress.pm @@ -1262,7 +1262,7 @@ EOB Vend::Payment::PaypalExpress -> new({ order_number => $opt->{order_id}, - email => $opt->{actual}{email}, + email => $::Values->{email} || '', amount => $amount, Enabled => charge_param('gwl_enabled'), LogTable => charge_param('gwl_table'),