Giter VIP home page Giter VIP logo

apple-reporter's People

Contributors

aaronbean avatar adrian-gierakowski avatar birulyupg avatar cemulate avatar legoless avatar tyscorp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apple-reporter's Issues

apple-reporter suddenly stopped working

I get this error while trying to retrieveAccessToken, I only get this error when my password is correct (I get a password error when it's not good)

Unhandled rejection AppleReporterError: An unexpected error occurred. Try again later.
    at xmlErrorThrower (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\apple-reporter\dist\util.js:27:11)
    at tryCatcher (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\promise.js:517:31)
    at Promise._settlePromise (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\promise.js:574:18)
    at Promise._settlePromise0 (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\promise.js:619:10)
    at Promise._settlePromises (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\promise.js:699:18)
    at _drainQueueStep (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\async.js:138:12)
    at _drainQueue (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\async.js:131:9)
    at Async._drainQueues (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\Sandoche\00 - Projects\John-doe-accountant\node_modules\bluebird\js\release\async.js:17:14)    
    at processImmediate (internal/timers.js:439:21)

It happens when I run this code

const AppleReporter = require("apple-reporter");

const reporter = new AppleReporter({
    userid: "xxx",
    password: "xxx",
    tokenOptions: {
        forceRetrieve: true,
        generateNewIfNeeded: true
    }
});


reporter.retrieveAccessToken({ forceRetrieve: true, generateNewIfNeeded: true })
    .then(({ token, isNew }) => {
        console.log(`Token: ${token}, was newly generated: ${isNew}`);
    });

It was working perfectly yesterday, and stopped working suddenly.

How to handle the response

Hey,
I'm fetching data like described in the docs:

reporter.Sales.getReport({
    vendorNumber: 234567,
    reportType: 'Sales',
    reportSubType: 'Summary',
    dateType: 'Daily',
    date: '20170121'
})
.then((report) => {
    console.log(report)
})

But my response is just a String with the data instead of an object. The docs say it should be an object created with xml2js... Is this a bug or how can I further manipulate my data?

How to specify account?

Hey, I'm getting this error:

Unhandled rejection AppleReporterError: You have access to more than one account. Please specify an account number in your properties file or on the command line. To see a list of accounts, run the command getAccounts.

After running getAccount() I get my account numbers, but how do I specify a single one? I tried this but it doesn't work:

const reporter = new AppleReporter({
    userid: '[email protected]',
    password: 'mypassword',
    account: 12345
});

(At least) Sales.getReport endpoint requires a reportVersion parameter

It was working totally fine yesterday, but today when I try to download my report, I get the following error:

AppleReporterError: Please include the version parameter. The latest version for this report is 1_1.

I suspect Apple finally shutdown 1_0 (2 months late?) as written in the documentation:
screen shot 2018-06-01 at 11 16 15

A workaround to make it work locally was to:

  • add reportVersion: "1_1" to my reporter.Sales.getReport options
  • add reportVersion to the parameters list index.js line 35

from:

this.getReport = create('getReport', ['vendorNumber', 'reportType', 'reportSubType', 'dateType', 'date',]);

to:

this.getReport = create('getReport', ['vendorNumber', 'reportType', 'reportSubType', 'dateType', 'date','reportVersion']);

As a result, the downloaded CSV is different (new fields), but this works.

This is probably not a good solution, but I don't know your codebase enough to fix the issue properly; this API update probably also impact other endpoints, but I'm not using any other one so no idea which one has to change.

Happy to help with a PR with some guidance.

Sales Event Report Broken

This error appears when trying to download event report.
"Sales and Trends Reporter is currently available." FetchError: invalid response body at: https://reportingitc-reporter.apple.com/reportservice/sales/v1 reason: incorrect header check at Gunzip.<anonymous> (/Users/cmg/projects/gcp_vendor_apple/reporter/node_modules/node-fetch/lib/body.js:123:11) at Gunzip.emit (events.js:208:15) at Zlib.zlibOnError [as onerror] (zlib.js:171:8) { name: 'FetchError', message: 'invalid response body at: https://reportingitc-reporter.apple.com/reportservice/sales/v1 reason: incorrect header check', type: 'system', errno: 'Z_DATA_ERROR', code: 'Z_DATA_ERROR' }
I believe this is due to the file format changes from apple,
https://itunespartner.apple.com/en/music/news/100002692
Btw thanks for the great work with this lib!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.