NAME

Parse::PayPal::TxDetailReport - Parse PayPal transaction detail report into data structure

VERSION

This document describes version 0.001 of Parse::PayPal::TxDetailReport (from Perl distribution Parse-PayPal-TxDetailReport), released on 2016-07-21.

SYNOPSIS

use Parse::PayPal::TxDetailReport qw(parse_paypal_txdetail_report);

my $res = parse_paypal_txdetail_report(files => []);

Sample result when there is a parse error:

[400, "Version (10) not supported, only version 11 supported"]

Sample result when parse is successful:

[200, "OK", {
    account_id => "...",
    report_generation_date => 1467375872,
    report_version         => 11,
    reporting_window       => "A",
    transactions           => [
        {
            "3PL Reference ID"                   => "",
            "Auction Buyer ID"                   => "",
            "Auction Closing Date"               => "",
            "Auction Site"                       => "",
            "Authorization Review Status"        => 1,
            ...
            "Transaction Completion Date"        => 1467273397,
            ...
        },
        ...
    ],
}]

DESCRIPTION

This module provides routine to parse PayPal transaction detail report into a Perl data structure. Version 11 is supported. Multiple files are supported. Both the tab-separated format and comma-separated (CSV) format are supported.

FUNCTIONS

parse_paypal_txdetail_report(%args) -> [status, msg, result, meta]

Parse PayPal transaction detail report into data structure.

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • files => array[filename]

    Files can all be in tab-separated or comma-separated (CSV) format but cannot be mixed. If there are multiple files, they must be ordered.

    The result will be a hashref. The main key is transactions which will be an arrayref of hashrefs.

    Dates will be converted into Unix timestamps.

  • format => str

    If unspecified, will be deduced from the first filename's extension (/csv/ for CSV, or /txt|tsv/ for tab-separated).

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

BUGS

Please report all bug reports or feature requests to mailto:stevenharyanto@gmail.com.

SEE ALSO

https://www.paypal.com

Specification of transaction detail report format: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/PP_LRD_Gen_TransactionDetailReport.pdf

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.