-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for Redemption Links in PHC which will be used by the hybrids. Related RN PR: RevenueCat/react-native-purchases#1145
- Loading branch information
Showing
11 changed files
with
225 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { CustomerInfo } from "./customerInfo"; | ||
import { PurchasesError } from "./errors"; | ||
|
||
/** | ||
* An object containing the redemption link to be redeemed. | ||
* @public | ||
*/ | ||
export type WebPurchaseRedemption = { | ||
/** | ||
* The redemption link to be redeemed. | ||
*/ | ||
redemptionLink: string; | ||
} | ||
|
||
/** | ||
* The result type of a Redemption Link redemption attempt. | ||
* @public | ||
*/ | ||
export enum WebPurchaseRedemptionResultType { | ||
/** | ||
* The redemption was successful. | ||
*/ | ||
SUCCESS = "SUCCESS", | ||
/** | ||
* The redemption failed. | ||
*/ | ||
ERROR = "ERROR", | ||
/** | ||
* The purchase associated to the link belongs to another user. | ||
*/ | ||
PURCHASE_BELONGS_TO_OTHER_USER = "PURCHASE_BELONGS_TO_OTHER_USER", | ||
/** | ||
* The token is invalid. | ||
*/ | ||
INVALID_TOKEN = "INVALID_TOKEN", | ||
/** | ||
* The token has expired. A new Redemption Link will be sent to the email used during purchase. | ||
*/ | ||
EXPIRED = "EXPIRED", | ||
} | ||
|
||
/** | ||
* The result of a redemption attempt. | ||
* @public | ||
*/ | ||
export type WebPurchaseRedemptionResult = | ||
| { result: WebPurchaseRedemptionResultType.SUCCESS, customerInfo: CustomerInfo } | ||
| { result: WebPurchaseRedemptionResultType.ERROR, error: PurchasesError } | ||
| { result: WebPurchaseRedemptionResultType.PURCHASE_BELONGS_TO_OTHER_USER } | ||
| { result: WebPurchaseRedemptionResultType.INVALID_TOKEN } | ||
| { result: WebPurchaseRedemptionResultType.EXPIRED, obfuscatedEmail: string } |