Skip to content

Commit

Permalink
Entitlement source field added. (#41)
Browse files Browse the repository at this point in the history
* Entitlement source field added.

* Moved tests to src folder

* Test fixes

* Ts fixes in tests

* Fix source keys

* Fix test
  • Loading branch information
SpertsyanKM authored Sep 30, 2022
1 parent b83ef5f commit 2994e39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import {
NetworkResponseError,
NetworkResponseSuccess
} from '../../../internal/network';
import {Entitlement, PeriodType, QonversionError, QonversionErrorCode, RenewState} from '../../../index';
import {
Entitlement,
EntitlementSource,
PeriodType,
QonversionError,
QonversionErrorCode,
RenewState
} from '../../../index';
import {HTTP_CODE_NOT_FOUND} from '../../../internal/network/constants';
import {
EntitlementApi,
Expand All @@ -24,6 +31,7 @@ const apiEntitlement: EntitlementApi = {
started: 10,
expires: 100,
id: 'test entitlement',
source: 'stripe',
product: {
product_id: 'test product',
subscription: {
Expand Down Expand Up @@ -56,6 +64,7 @@ const expRes: Entitlement[] = [{
started: 10,
expires: 100,
id: 'test entitlement',
source: EntitlementSource.Stripe,
product: {
productId: 'test product',
subscription: {
Expand Down
9 changes: 9 additions & 0 deletions sdk/src/dto/Entitlement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Entitlement = {
active: boolean;
started: number;
expires: number;
source: EntitlementSource;
product?: Product;
}

Expand All @@ -27,3 +28,11 @@ export enum PeriodType {
Trial = 'trial',
Intro = 'intro',
}

export enum EntitlementSource {
Unknown = 'unknown',
AppStore = 'appStore',
PlayStore = 'playStore',
Stripe = 'stripe',
Manual = 'manual'
}

0 comments on commit 2994e39

Please sign in to comment.