NAME

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

VERSION

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

SYNOPSIS

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

 my $res = parse_paypal_txdetail_report(files => ["part1.csv", "part2.csv"]);

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", {
     format => "txdetail_v11",
     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

PayPal provides various kinds reports which you can retrieve from their website under Reports menu. This module provides routine to parse PayPal transaction detail report (from the website under Reports > Transactions > Transactions detail) 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

Usage:

 parse_paypal_txdetail_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):

  • 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.

  • format => str

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

  • strings => array[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

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

Parse::PayPal::TxFinderReport

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.