diff --git a/sdk/src/__integrationTests__/apiV3/PurchasesService.test.ts b/sdk/src/__integrationTests__/apiV3/PurchasesService.test.ts index 6631da8..3b70249 100644 --- a/sdk/src/__integrationTests__/apiV3/PurchasesService.test.ts +++ b/sdk/src/__integrationTests__/apiV3/PurchasesService.test.ts @@ -23,13 +23,13 @@ describe('purchases tests', function () { const purchased = getCurrentTs(); const purchaseCoreData: PurchaseCoreData = { - currency: 'USD', - price: '21.49', + currency: 'EUR', + price: '5', purchased, }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', - subscriptionId: 'sub_1N6Z7sL9K6ILzohYE49VAPcq' + productId: 'prod_OSEKoJ3z29ArRM', + subscriptionId: 'sub_1NfJsSHj4b8RrJvc78ALkOzh' }; const data = { @@ -57,12 +57,12 @@ describe('purchases tests', function () { await userService.createUser(userId); const purchaseCoreData: PurchaseCoreData = { - currency: 'USD', - price: '21.49', + currency: 'EUR', + price: '5', }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', - subscriptionId: 'sub_1N6Z7sL9K6ILzohYE49VAPcq' + productId: 'prod_OSEKoJ3z29ArRM', + subscriptionId: 'sub_1NfJsSHj4b8RrJvc78ALkOzh' }; const data = { @@ -88,13 +88,13 @@ describe('purchases tests', function () { const userId = 'testUidForPurchase' + Date.now(); const purchaseCoreData: PurchaseCoreData = { - currency: 'USD', - price: '21.49', + currency: 'EUR', + price: '5', purchased: getCurrentTs(), }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', - subscriptionId: 'sub_1N6Z7sL9K6ILzohYE49VAPcq' + productId: 'prod_OSEKoJ3z29ArRM', + subscriptionId: 'sub_1NfJsSHj4b8RrJvc78ALkOzh' }; const data = { @@ -104,8 +104,8 @@ describe('purchases tests', function () { // when and then await expectQonversionErrorAsync( - QonversionErrorCode.UserNotFound, - 'Qonversion user not found. Id: ' + userId, + QonversionErrorCode.BackendError, + 'Qonversion API returned an error. Response code 404, message: User not found', async () => { await purchasesService.sendStripePurchase(userId, data); }, @@ -117,12 +117,12 @@ describe('purchases tests', function () { await userService.createUser(userId); const purchaseCoreData: PurchaseCoreData = { - currency: 'USD', - price: '21.49', + currency: 'EUR', + price: '5', purchased: getCurrentTs(), }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', + productId: 'prod_OSEKoJ3z29ArRM', subscriptionId: 'incorrect subscription id' }; @@ -146,13 +146,13 @@ describe('purchases tests', function () { await userService.createUser(userId); const purchaseCoreData: PurchaseCoreData = { - currency: 'USD', - price: '21,49', + currency: 'EUR', + price: '5,01', purchased: getCurrentTs(), }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', - subscriptionId: 'sub_1N6Z7sL9K6ILzohYE49VAPcq' + productId: 'prod_OSEKoJ3z29ArRM', + subscriptionId: 'sub_1NfJsSHj4b8RrJvc78ALkOzh' }; const data = { @@ -175,13 +175,13 @@ describe('purchases tests', function () { await userService.createUser(userId); const purchaseCoreData: PurchaseCoreData = { - currency: 'USDDD', - price: '21.49', + currency: 'EURRR', + price: '5', purchased: getCurrentTs(), }; const stripeStoreData: StripeStoreData = { - productId: 'prod_LkgDHk3f9Z9qb3', - subscriptionId: 'sub_1N6Z7sL9K6ILzohYE49VAPcq' + productId: 'prod_OSEKoJ3z29ArRM', + subscriptionId: 'sub_1NfJsSHj4b8RrJvc78ALkOzh' }; const data = { diff --git a/sdk/src/internal/purchases/PurchaseService.ts b/sdk/src/internal/purchases/PurchaseService.ts index 84bb852..50a365d 100644 --- a/sdk/src/internal/purchases/PurchaseService.ts +++ b/sdk/src/internal/purchases/PurchaseService.ts @@ -4,7 +4,6 @@ import {ApiInteractor, RequestConfigurator} from '../network'; import {camelCaseKeys} from '../utils/objectUtils'; import {QonversionError} from '../../exception/QonversionError'; import {QonversionErrorCode} from '../../exception/QonversionErrorCode'; -import {HTTP_CODE_NOT_FOUND} from '../network/constants'; export class PurchaseServiceImpl implements PurchasesService { private readonly requestConfigurator: RequestConfigurator; @@ -23,10 +22,6 @@ export class PurchaseServiceImpl implements PurchasesService { return camelCaseKeys(response.data); } - if (response.code == HTTP_CODE_NOT_FOUND) { - throw new QonversionError(QonversionErrorCode.UserNotFound, `Id: ${userId}`); - } - const errorMessage = `Response code ${response.code}, message: ${response.message}`; throw new QonversionError(QonversionErrorCode.BackendError, errorMessage); }