Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API tests for paywall result enum in typescript #636

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion typescript/apitesters/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
PRORATION_MODE,
IN_APP_MESSAGE_TYPE,
ENTITLEMENT_VERIFICATION_MODE,
VERIFICATION_RESULT
VERIFICATION_RESULT,
PAYWALL_RESULT
} from '../dist';

function checkPurchaseType(type: PURCHASE_TYPE): boolean {
Expand Down Expand Up @@ -128,3 +129,18 @@ function checkVerificationResult(verificationResult: VERIFICATION_RESULT): boole
return true;
}
}

function checkPaywallResult(paywallResult: PAYWALL_RESULT): boolean {
switch (paywallResult) {
case PAYWALL_RESULT.NOT_PRESENTED:
return true;
case PAYWALL_RESULT.ERROR:
return true;
case PAYWALL_RESULT.CANCELLED:
return true;
case PAYWALL_RESULT.PURCHASED:
return true;
case PAYWALL_RESULT.RESTORED:
return true;
}
}