Skip to content

Commit

Permalink
feat: addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-amutha committed Aug 11, 2023
1 parent 1f2c3fa commit 56b5e7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const customer: Customer = {
lastName: 'lname',
email: '[email protected]',
};
const productType = ProductType.non_consumable
const productType = ProductType.NON_CONSUMABLE
try {
const result: OneTimePurchase = await Chargebee.purchaseNonSubscriptionProduct("product-id", productType, customer);
console.log(result);
Expand All @@ -177,7 +177,7 @@ The given code defines a function named `purchaseNonSubscriptionProduct` in the

- `product`: An instance of `Product` class, representing the product to be purchased from the Apple App Store or Google Play Store.
- `customer`: Optional. An instance of `CBCustomer` class, initialized with the customer's details such as `customerId`, `firstName`, `lastName`, and `email`.
- `productType`: An enum instance of `productType` type, indicating the type of product to be purchased. It can be either .`consumable`, or `non_consumable`, or `non_renewing_subscription`. Note that `non_renewing_subscription` is supported only in Apple App Store.
- `productType`: An enum instance of `productType` type, indicating the type of product to be purchased. It can be either .`consumable`, or `non_consumable`, or `non_renewing_subscription` Note that `non_renewing_subscription` is supported only in Apple App Store.

The function is called asynchronously, and it returns a `Result` object with a `success` or `failure` case, as mentioned are below.
- If the purchase is successful, it returns `OneTimePurchase` object. which includes the `invoiceId`, `chargeId`, and `customerId` associated with the purchase.
Expand Down Expand Up @@ -324,7 +324,7 @@ const customer: Customer = {
lastName: 'lname',
email: '[email protected]',
};
const productType = ProductType.non_consumable
const productType = ProductType.NON_CONSUMABLE
try {
const result: OneTimePurchase = await Chargebee.validateReceiptForNonSubscriptions(productId, productType, customer)
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion ios/ChargebeeHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public class ChargebeeHelper: NSObject {
}

private func convertStringToProductType(productTypeString: String)-> ProductType{
let productType: ProductType!
let productType: ProductType
if productTypeString == ProductType.Consumable.rawValue{
productType = .Consumable
}else if productTypeString == ProductType.NonConsumable.rawValue{
Expand Down

0 comments on commit 56b5e7b

Please sign in to comment.