File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
22import { Injectable } from '@angular/core' ;
33import { defer } from 'rxjs' ;
44import { concatMap } from 'rxjs/operators' ;
5+ import { truncateReceipt } from '../../../utils/in-app-purchase' ;
56import { DiaBackendAuthService } from '../auth/dia-backend-auth.service' ;
67import { BASE_URL , BUBBLE_API_URL } from '../secret' ;
78
@@ -19,7 +20,7 @@ export class DiaBackendNumService {
1920 concatMap ( headers => {
2021 const formData = new FormData ( ) ;
2122 formData . set ( 'points' , pointsToAdd . toString ( ) ) ;
22- formData . set ( 'receipt_id' , receiptId ) ;
23+ formData . set ( 'receipt_id' , truncateReceipt ( receiptId ) ) ;
2324 return this . httpClient . post < DiaBackendNumPointPurchaseResult > (
2425 `${ BASE_URL } /api/v3/num/points/purchase/` ,
2526 formData ,
Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import { isDevMode } from '@angular/core';
22import { IAPProduct } from '@awesome-cordova-plugins/in-app-purchase-2/ngx' ;
33import { CaptureInAppProductIds } from '../shared/in-app-store/in-app-store.service' ;
44
5+ export function truncateReceipt ( recipt : string ) {
6+ const preferredMaxLength = 1024 ;
7+ const receiptMaxLength = Math . min ( recipt . length , preferredMaxLength ) ;
8+ return recipt . substring ( 0 , receiptMaxLength ) ;
9+ }
10+
511/**
612 * Usefull to see in app product state changes in console for better debugging.
713 * It will pring to console only in dev mode aka isDevMode() === true
You can’t perform that action at this time.
0 commit comments