voltrue2 / in-app-purchase

A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
http://iap.gracenode.org
Other
1.05k stars 289 forks source link

Upgrade google api v3 #240

Closed LeeGeonho closed 5 years ago

LeeGeonho commented 5 years ago

There is a fatal problem in v2 that we can not confirm that the payment has been refunded. Do you plan to upgrade to v3?

I tested it and found that the purchaseState is always 0 in v2 for a refund made in Google Wallet. But in v3, the purchaseState was changed to 1 immediately after the refund.

voltrue2 commented 5 years ago

Hello

Thank you for pointing it out. I am actually planning on updating the version to v3.

I am lacking testing materials though. Would you be able to run so tests or provide me with test materials?

Cheers!

On Jan 29, 2019 at 17:13, <LeeGeonho (mailto:notifications@github.com)> wrote:

There is a fatal problem in v2 that we can not confirm that the payment has been refunded. Do you plan to upgrade to v3 (https://developers.google.com/android-publisher/api-ref/purchases/products/get)?

I tested it and found that the purchaseState (https://developers.google.com/android-publisher/api-ref/purchases/products#resource) is always 0 in v2 for a refund made in Google Wallet. But in v3, the purchaseState was changed to 1 immediately after the refund.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4X6UL9FqoFvpg1fkIvA3M0oIctBpks5vIAKxgaJpZM4aXggF).

Orloffyeah commented 5 years ago

Hi, is there an estimated date of when it will be updated to v3?

I would like to keep using this module since it has been very helpful for our project.

Thanks in advance.

voltrue2 commented 5 years ago

Hello

I am planning the update as soon as possible as I have been getting this question from many.

At the moment though I am looking for some help with testing as I am lacking test materials right now.

Cheers

On Jan 31, 2019 at 04:59, <Orloffyeah (mailto:notifications@github.com)> wrote:

Hi, is there an estimated date of when it will be updated to v3?

I would like to keep using this module since it has been very helpful for our project.

Thanks in advance.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459087226), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4dUYNh5Hyvq2q0dHZ6cqF5FWpCG4ks5vIfmkgaJpZM4aXggF).

Orloffyeah commented 5 years ago

What testing materials would your require? I may be able to help in this regard.

voltrue2 commented 5 years ago

Hello,

If you could help out that would be really awesome.

Basically I no longer have my google dev account right now, so if you don’t mind either testing the new version or provide me with test receipts it would be super!

Cheers!

On Jan 31, 2019 at 07:53, <Orloffyeah (mailto:notifications@github.com)> wrote:

What testing materials would your require? I may be able to help in this regard.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459142859), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4ZFEWhKq-zFEl8v9wQrz-7V5cuCbks5vIiJSgaJpZM4aXggF).

Orloffyeah commented 5 years ago

I will gladly help you testing the new version.

voltrue2 commented 5 years ago

Great! I really appreciate the offer for help. I will be starting on it then!

Cheers

On Jan 31, 2019 at 09:01, <Orloffyeah (mailto:notifications@github.com)> wrote:

I will gladly help you testing the new version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459160543), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4YyW1-u2UBypy3n8h0glgI8YVWOPks5vIjJEgaJpZM4aXggF).

voltrue2 commented 5 years ago

Hello

I pushed the new version that uses v3 API to develop branch.

Would you mind trying it out?

Cheers!

On Jan 31, 2019 at 09:01, <Orloffyeah (mailto:notifications@github.com)> wrote:

I will gladly help you testing the new version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459160543), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4YyW1-u2UBypy3n8h0glgI8YVWOPks5vIjJEgaJpZM4aXggF).

Orloffyeah commented 5 years ago

Sure, I will download it now and get back to you with the results.

Thanks for your quick reply.

voltrue2 commented 5 years ago

Great thank you

On Jan 31, 2019 at 12:12, <Orloffyeah (mailto:notifications@github.com)> wrote:

Sure, I will download it now and get back to you with the results.

Thanks for your quick reply.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459198792), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4VPfCVo7iGJq8Zo6uiRzm9cDVnD2ks5vIl8lgaJpZM4aXggF).

Orloffyeah commented 5 years ago

After some tests, a product that has been refunded still returns the field purchaseState as 0.

I don't know if I'm testing incorrectly or did something wrong in the process.

Is there an email where I could send you some test receipts so that you can run some tests in your end?

voltrue2 commented 5 years ago

Sure. Thank you for the help.

If you could send me your test results to voltrue2@yahoo.com

Cheers

On Jan 31, 2019 at 13:00, <Orloffyeah (mailto:notifications@github.com)> wrote:

After some tests, a product that has been refunded still returns the field purchaseState as 0.

I don't know if I'm testing incorrectly or did something wrong in the process.

Is there an email where I could send you some test receipts so that you can run some tests in your end?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/voltrue2/in-app-purchase/issues/240#issuecomment-459206598), or mute the thread (https://github.com/notifications/unsubscribe-auth/ACKY4SwA1GzvjYfAHlahod4eag6GH6xxks5vImp4gaJpZM4aXggF).

voltrue2 commented 5 years ago

Done! 885648c97773d9ce007db193beb785b1010cc31b npm publish version: 1.11.0

Thank you @Orloffyeah for your help with testing!

skolesnyk commented 5 years ago

@LeeGeonho could you share the code where you check if payment was refunded ?

LeeGeonho commented 5 years ago

@skolesnyk I was checked using google-auth-library

const { JWT } = require("google-auth-library");
async function test2() {
  const client = new JWT(
    "${client email of service account}",
    null,
    "${private key of service account}",
    ["https://www.googleapis.com/auth/androidpublisher"]
  );
  const url =
    "https://www.googleapis.com/androidpublisher/v3/applications/" +
    "${android package name}" +
    "/purchases/products/" +
    "${android in-app identifier}" +
    "/tokens/" +
    "${purchase token}";
  const res = await client
    .request({ url })
    .then(res => {
      return res.data;
    })
    .catch(err => {
      return {
        error: -1,
        message: err.message
      };
    });
}
test2();

If payment was refund, purchaseState is 1