NAME

Parse::PayPal::TxDetailReport::Old - Parse PayPal transaction detail report (older version, 2015 and earlier) into data structure

VERSION

This document describes version 0.002 of Parse::PayPal::TxDetailReport::Old (from Perl distribution Parse-PayPal-TxDetailReport-Old), released on 2018-11-07.

SYNOPSIS

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

my $res = parse_paypal_txdetail_report(
    file => "report.csv",
    #date_format => 'DD/MM/YYYY', # optional, default is MM/DD/YYYY
);

Sample result when there is a parse error:

[400, "Doesn't look like old transaction detail format, I expect first row to be column names and first column header to be Date"]

Sample result when parse is successful:

[200, "OK", {
    format => "txdetail_old",
    transactions           => [
        {
            "3PL Reference ID"                   => "",
            "Auction Buyer ID"                   => "",
            "Auction Closing Date"               => "",
            "Auction Site"                       => "",
            "Authorization Review Status"        => 1,
            ...
            "Transaction Completion Date"        => 1467273397,
            ...
        },
        ...
    ],
}]

DESCRIPTION

PayPal provides various kinds of reports which you can retrieve from their website under Reports menu. This module provides routine to parse PayPal old transaction detail report (2015 and earlier). Both the tab-separated format and comma-separated (CSV) format are supported.

FUNCTIONS

parse_paypal_old_txdetail_report

Usage:

parse_paypal_old_txdetail_report(%args) -> [status, msg, payload, meta]

Parse PayPal transaction detail report (older version, 2015 and earlier) into data structure.

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.

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • date_format => str (default: "MM/DD/YYYY")

  • file => filename

    File can all be in tab-separated or comma-separated (CSV) format.

  • format => str

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

  • string => str

    Instead of file, you can alternatively provide the file content in string.

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 (payload) 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

Parse::PayPal::TxDetailReport

Parse::PayPal::TxFinderReport

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 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.