sub process_message_buyer {
my ($class, $e, $msg_hash, $message, $log_prefix, $eg_inv) = @_;
+ my $vendcode = $msg_hash->{buyer_code};
+
# some vendors encode the account number as the SAN.
# starting with the san value, then the account value,
# treat each as a san, then an acct number until the first success
next unless $buyer;
# some vendors encode the SAN as "$SAN $vendcode"
- my $vendcode;
- ($buyer, $vendcode) = $buyer =~ /(\S+)\s*(\S+)?$/;
+ if (!$vendcode) {
+ ($buyer, $vendcode) = $buyer =~ /(\S+)\s*(\S+)?$/;
+ }
my $addr = $e->search_actor_org_address(
{valid => "t", san => $buyer})->[0];
message_type => qr/^UNH\+[A-z0-9]+\+(\S{6})/,
buyer_san => qr/^NAD\+BY\+([^:]+)::31B/,
buyer_acct => qr/^NAD\+BY\+([^:]+)::91/,
+ buyer_code => qr/^RFF\+API:(\S+)/,
vendor_san => qr/^NAD\+SU\+([^:]+)::31B/,
vendor_acct => qr/^NAD\+SU\+([^:]+)::91/,
purchase_order => qr/^RFF\+ON:(\S+)/,