package BookPub::Import::Importer::Odilo::Version2;

use strict;

use lib '/app/tools/bookpub/lib';
use base 'BookPub::Import::Importer::Odilo';

sub currencyCode {
    my $self = shift;
    my $currency = $self->_getByFieldName('currencyCode') || return;

    # currencyCode format: Net Sale (CCC) where CCC is the currency code
    #
    if ( $currency =~ / \((\w{3})\)/i ) {
        $currency = $1;
    }

    return $currency;
}

sub rListPriceCurrency {
    my $self = shift;
    my $currency = $self->_getByFieldName('rListPriceCurrency') || return;

    # currencyCode format: DLP (CCC) where CCC is the currency code
    #
    if ( $currency =~ / \((\w{3})\)$/i ) {
        $currency = $1;
    }

    return $currency;
}

1;
