NAME

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

VERSION

This document describes version 0.002 of Parse::PayPal::TxFinderReport (from Perl distribution Parse-PayPal-TxFinderReport), released on 2017-07-03.

SYNOPSIS

use Parse::PayPal::TxFinderReport qw(parse_paypal_txfinder_report);

my $res = parse_paypal_txfinder_report(file => );

Sample result when there is a parse error:

[400, "Doesn't find signature in first row"]

Sample result when parse is successful:

[200, "OK", {
    format => "txfinder",
    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 reports which you can retrieve from their website under Reports menu. This module provides routine to parse PayPal transaction finder report into a Perl data structure (from the website under Reports > Transactions > Transaction finder). The CSV format is supported. No official documentation of the format is available, but it's mostly regular CSV.

Some characteristics of this report:

  • Date is MM/DD/YYYY only without hour/minute/second information

  • No transaction status field

FUNCTIONS

parse_paypal_txfinder_report

Usage:

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

Parse PayPal transaction detail report 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):

  • file => filename

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

  • format => str

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

  • string => str

    Instead of files, you can alternatively provide the file contents in strings.

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

Parse::PayPal::TxDetailReport

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

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