From 80339387a192c352010d41b5465a43c280a68be9 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 28 Jun 2022 11:58:41 +0600 Subject: [PATCH 1/3] fix(in-app-store.service): properly display err msg --- src/app/shared/in-app-store/in-app-store.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/shared/in-app-store/in-app-store.service.ts b/src/app/shared/in-app-store/in-app-store.service.ts index fa507056f..c39f7ac6b 100644 --- a/src/app/shared/in-app-store/in-app-store.service.ts +++ b/src/app/shared/in-app-store/in-app-store.service.ts @@ -71,7 +71,7 @@ export class InAppStoreService implements OnDestroy { this.store.refresh(); } catch (error) { - const errorMessage = this.translocoService.getTranslation( + const errorMessage = this.translocoService.translate( 'inAppPurchase.failedToInitInAppStore' ); this.errorService.toastError$(errorMessage).toPromise(); @@ -131,7 +131,7 @@ export class InAppStoreService implements OnDestroy { }) ); } catch (error) { - const errorMessage = this.translocoService.getTranslation( + const errorMessage = this.translocoService.translate( 'wallets.buyNum.failedToAddPoints' ); this.errorService.toastError$(errorMessage).toPromise(); @@ -175,7 +175,7 @@ export class InAppStoreService implements OnDestroy { } private readonly onStoreError = (_: IAPError) => { - const errorMessage = this.translocoService.getTranslation( + const errorMessage = this.translocoService.translate( 'inAppPurchase.inAppPurchaseErrorOcurred' ); this.errorService.toastError$(errorMessage).toPromise(); From 3245d336cfa9169594a8ba0686f7fd01a74b3501 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 28 Jun 2022 12:04:51 +0600 Subject: [PATCH 2/3] fix(dia-backend-num): truncate reciept_id --- src/app/shared/dia-backend/num/dia-backend-num.service.ts | 3 ++- src/app/utils/in-app-purchase.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/app/shared/dia-backend/num/dia-backend-num.service.ts b/src/app/shared/dia-backend/num/dia-backend-num.service.ts index 1c902310d..3c9e6555e 100644 --- a/src/app/shared/dia-backend/num/dia-backend-num.service.ts +++ b/src/app/shared/dia-backend/num/dia-backend-num.service.ts @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { defer } from 'rxjs'; import { concatMap } from 'rxjs/operators'; +import { truncateReceipt } from '../../../utils/in-app-purchase'; import { DiaBackendAuthService } from '../auth/dia-backend-auth.service'; import { BASE_URL, BUBBLE_API_URL } from '../secret'; @@ -19,7 +20,7 @@ export class DiaBackendNumService { concatMap(headers => { const formData = new FormData(); formData.set('points', pointsToAdd.toString()); - formData.set('receipt_id', receiptId); + formData.set('receipt_id', truncateReceipt(receiptId)); return this.httpClient.post( `${BASE_URL}/api/v3/num/points/purchase/`, formData, diff --git a/src/app/utils/in-app-purchase.ts b/src/app/utils/in-app-purchase.ts index 7ce396de4..38b0539d0 100644 --- a/src/app/utils/in-app-purchase.ts +++ b/src/app/utils/in-app-purchase.ts @@ -2,6 +2,12 @@ import { isDevMode } from '@angular/core'; import { IAPProduct } from '@awesome-cordova-plugins/in-app-purchase-2/ngx'; import { CaptureInAppProductIds } from '../shared/in-app-store/in-app-store.service'; +export function truncateReceipt(recipt: string) { + const preferredMaxLength = 1024; + const receiptMaxLength = Math.min(recipt.length, preferredMaxLength); + return recipt.substring(0, receiptMaxLength); +} + /** * Usefull to see in app product state changes in console for better debugging. * It will pring to console only in dev mode aka isDevMode() === true From ef08ad9b94d7bc65e04f6e525d3dc2b5a370ebc3 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 28 Jun 2022 12:07:15 +0600 Subject: [PATCH 3/3] build: bump to 0.59.4 --- CHANGELOG.md | 8 +++++++- android/app/build.gradle | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e282d30..5505c65a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.59.4 - 2022-06-28 + +### Fixed + +- Truncate reciept_id from in app purchase + ## 0.59.3 - 2022-06-27 ### Added @@ -13,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.59.2 - 2022-06-22 -#### Changed +### Changed - Revert Show capture options menu regardless of backend response. #1703 diff --git a/android/app/build.gradle b/android/app/build.gradle index a071833f8..587dece07 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "io.numbersprotocol.capturelite" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 413 - versionName "0.59.3" + versionCode 414 + versionName "0.59.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildFeatures { diff --git a/package-lock.json b/package-lock.json index 63f435323..165c440ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "capture-lite", - "version": "0.59.3", + "version": "0.59.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "capture-lite", - "version": "0.59.3", + "version": "0.59.4", "dependencies": { "@angular/animations": "^12.2.4", "@angular/cdk": "^12.2.4", diff --git a/package.json b/package.json index 58f1772d1..43b2d387b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "capture-lite", - "version": "0.59.3", + "version": "0.59.4", "author": "numbersprotocol", "homepage": "https://numbersprotocol.io/", "scripts": {