@olo/pay-react-native
Version:
Olo Pay React Native SDK
300 lines (289 loc) • 16.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.OloErrorCode = exports.LineItemType = exports.LineItemStatus = exports.GooglePayCheckoutStatus = exports.GooglePayButtonType = exports.GooglePayButtonTheme = exports.FontWeight = exports.DigitalWalletReadyEvent = exports.CardType = exports.CardField = exports.ApplePayButtonType = exports.ApplePayButtonStyle = void 0;
// Copyright © 2022 Olo Inc. All rights reserved.
// This software is made available under the Olo Pay SDK License (See LICENSE.md file)
/** Type alias representing options for a digital wallet payment method request */
/**
* Type alias representing a digital wallet payment method result.
*
* | Property | Description |
* | -------- | ----------- |
* | `paymentMethod` | The payment method generated by the digital wallet flow, or `undefined` if the user canceled the flow |
*/
/**
* Options for intializing digital wallets
* | Property | Description | Default |
* | -------- | ----------- | ------- |
* | `countryCode` | A two character country code for the vendor that will be processing the payment | 'US' |
* | `currencyCode` | Currency code to be used for transactions | `CurrencyCode.usd` |
* | `companyLabel` | The company display name | - |
* | `emailRequired` | Whether an email will be collected and returned when processing transactions | `false` |
* | `fullNameRequired` | Whether a full name will be collected and returned when processing transactions | `false` |
* | `fullBillingAddressRequired` | Whether a full billing address will be collected and returned when processing transactions | `false` |
* | `phoneNumberRequired` | Whether a phone number will be collected and returned when processing transactions | `false` |
* | `initializeApplePay` | Whether Apple Pay should be initialized. | - |
* | `initializeGooglePay` | Whether Google Pay should be initialized. | - |
* | `applePayConfig` | Configuration options for initializing Apple Pay. Required if `initializeApplePay` is `true` | - |
* | `googlePayConfig` | Configuration options for initializing Google Pay. Required if `initializeGooglePay` is `true` | - |
*
* **Note:** If Apple Pay or Google Pay were previously initialized and the respective initialize property (`initializeApplePay` or `initializeGooglePay`) is set to `false`, this will not uninitialize digital wallets and will result in a no-op.
*
*/
/**
* Options for initializing Apple Pay
* | Property | Description | Default |
* | -------- | ----------- | ------- |
* | `fullPhoneticNameRequired` | Whether a full phonetic name will be collected and returned when processing transactions | `false` |
* | `merchantId` | The merchant id registered with Apple for Apple Pay | - |
*/
/**
* Options for intializing Google Pay
* | Property | Description | Default |
* | -------- | ----------- | ------- |
* | `productionEnvironment` | Whether Google Pay will use the production environment | `true` |
* | `existingPaymentMethodRequired` | Whether an existing saved payment method is required for Google Pay to be considered ready | `false` |
* | `currencyMultiplier` | Multiplier to convert the amount to the currency's smallest unit (e.g. $2.34 * 100 = 234 cents) | `100` |
*/
/**
* Type alias representing currency codes supported by Olo Pay.
*/
/**
* Options for requesting a payment method via Google Pay
* | Property | Description | Default |
* | -------- | ----------- | ------- |
* | `amount` | The amount to be charged | - |
* | `checkoutStatus` | The checkout status to be used for the transaction | `FinalImmediatePurchase` |
* | `totalPriceLabel` | A custom value to override the default total price label in the Google Pay sheet | - |
* | `lineItems` | A list of line items to be displayed in the digital wallet payment sheet | - |
* | `validateLineItems` | Whether or not to validate the line items. If `true`, [createDigitalWalletPaymentMethod](#createdigitalwalletpaymentmethod) will throw an exception if the sum of the line items does not equal the total amount passed in. If no line items are provided, this parameter is ignored. | `true` |
*/
let GooglePayCheckoutStatus = exports.GooglePayCheckoutStatus = /*#__PURE__*/function (GooglePayCheckoutStatus) {
/** Represents an estimated price (meaning it's not final and could change) and the default checkout option. The confirmation button will display "Continue". */
GooglePayCheckoutStatus["estimatedDefault"] = "EstimatedDefault";
/** Represents the final price of the transaction and the default checkout option. The confirmation button will display "Continue". */
GooglePayCheckoutStatus["finalDefault"] = "FinalDefault";
/** Represents the final price of the transaction and the immediate checkout option. The confirmation button will display "Pay Now". */
GooglePayCheckoutStatus["finalImmediatePurchase"] = "FinalImmediatePurchase";
return GooglePayCheckoutStatus;
}({});
/**
* Options for requesting a payment method via Apple Pay
* | Property | Description | Default |
* | -------- | ----------- | ------- |
* | `amount` | The amount to be charged | - |
* | `lineItems` | A list of line items to be displayed in the digital wallet payment sheet | - |
* | `validateLineItems` | Whether or not to validate the line items. If `true`, [createDigitalWalletPaymentMethod](#createdigitalwalletpaymentmethod) will throw an exception if the sum of the line items does not equal the total amount passed in. If no line items are provided, this parameter is ignored. | `true` |
*/
/**
* Represents the status of digital wallets.
* | Property | Description |
* | -------- | ----------- |
* | `isReady` | `true` if digital wallets are ready to be used, `false` otherwise |
*/
/**
* Represents the status for SDK initialization
* | Property | Description |
* | -------- | ----------- |
* | `isInitialized` | `true` if the SDK is initialized, `false` otherwise |
*/
/**
* Payment method used for submitting payments to Olo's Ordering API
*
* | Property | Description |
* | -------- | ----------- |
* | `id` | The payment method id. This should be set to the `token` field when submitting a basket |
* | `last4` | The last four digits of the card |
* | `cardType` | The issuer of the card |
* | `expMonth` | Two-digit number representing the card's expiration month |
* | `expYear` | Four-digit number representing the card's expiration year |
* | `postalCode` | Zip or postal code. Will always have the same value as `billingAddress.postalCode` |
* | `countryCode` | Two character country code. Will always have the same value as `billingAddress.countryCode` |
* | `isDigitalWallet` | `true` if this payment method was created by digital wallets (e.g. Apple Pay or Google Pay), `false` otherwise |
* | `productionEnvironment` | `true` if this payment method was created in the production environment, `false` otherwise |
* | `email` | The email address associated with the transaction, or an empty string if unavailable. Only provided for digital wallet payment methods (see `isDigitalWallet`) |
* | `digitalWalletCardDescription` | The description of the card, as provided by Apple or Google. Only provided for digital wallet payment methods (see `isDigitalWallet`) |
* | `billingAddress` | The billing address associated with the transaction. The country code and postal code fields will always have a non-empty value. Other fields will only have non-empty values for digital wallet payment methods (see `isDigitalWallet`) |
* | `fullName` | The full name associated with the transaction. Will only have a non-empty value for digital wallet payment methods (see `isDigitalWallet`) |
* | `fullPhoneticName` | The full phonetic name associated with the transaction. Will only have a non-empty value for digital wallet payment methods (see `isDigitalWallet`) **_(iOS only)_** |
*/
/**
* Represents an address. Currently only used for digital wallets, if billing address details are requested to be returned in the
* generated digital wallet payment method.
*
* | Property | Description |
* | -------- | ----------- |
* | `address1` | The first line of the address |
* | `address2` | The second line of the address, or an empty string |
* | `address3` | The third line of the address, or an empty string |
* | `postalCode` | The postal or zip code |
* | `countryCode` | The two digit ISO country code |
* | `administrativeArea` | A country subdivision, such as a state or province |
*/
// SEE DOCUMENTATION IN README.MD
let CardType = exports.CardType = /*#__PURE__*/function (CardType) {
/** Visa credit card type. Pass the string value of this into the Olo Ordering API when submitting orders */
CardType["visa"] = "Visa";
/** American Express credit card type. Pass the string value of this into the Olo Ordering API when submitting orders */
CardType["amex"] = "Amex";
/** Mastercard credit card type. Pass the string value of this into the Olo Ordering API when submitting orders */
CardType["mastercard"] = "Mastercard";
/** Discover credit card type. Pass the string value of this into the Olo Ordering API when submitting orders */
CardType["discover"] = "Discover";
/** Unsupported credit card type. Passing this to the Olo Ordering API will result in an error */
CardType["unsupported"] = "Unsupported";
/** Unknown credit card type. Passing this to the Olo Ordering API will result in an error */
CardType["unknown"] = "Unknown";
return CardType;
}({}); // SEE DOCUMENTATION IN README.MD
let OloErrorCode = exports.OloErrorCode = /*#__PURE__*/function (OloErrorCode) {
OloErrorCode["apiError"] = "ApiError";
OloErrorCode["applePayEmptyMerchantId"] = "ApplePayEmptyMerchantId";
OloErrorCode["applePayError"] = "ApplePayError";
OloErrorCode["applePayTimeout"] = "ApplePayTimeout";
OloErrorCode["applePayUnsupported"] = "ApplePayUnsupported";
OloErrorCode["authenticationError"] = "AuthenticationError";
OloErrorCode["cancellationError"] = "CancellationError";
OloErrorCode["cardDeclined"] = "CardDeclined";
OloErrorCode["connectionError"] = "ConnectionError";
OloErrorCode["digitalWalletNotReady"] = "DigitalWalletNotReady";
OloErrorCode["digitalWalletUninitialized"] = "DigitalWalletUninitialized";
OloErrorCode["emptyCompanyLabel"] = "EmptyCompanyLabel";
OloErrorCode["expiredCard"] = "ExpiredCard";
OloErrorCode["generalError"] = "generalError";
OloErrorCode["googlePayDeveloperError"] = "GooglePayDeveloperError";
OloErrorCode["googlePayInternalError"] = "GooglePayInternalError";
OloErrorCode["googlePayInvalidSetup"] = "GooglePayInvalidSetup";
OloErrorCode["googlePayNetworkError"] = "GooglePayNetworkError";
OloErrorCode["invalidCardDetails"] = "InvalidCardDetails";
OloErrorCode["invalidCountryCode"] = "InvalidCountryCode";
OloErrorCode["invalidCvv"] = "InvalidCVV";
OloErrorCode["invalidExpiration"] = "InvalidExpiration";
OloErrorCode["invalidNumber"] = "InvalidNumber";
OloErrorCode["invalidParameter"] = "InvalidParameter";
OloErrorCode["invalidPostalCode"] = "InvalidPostalCode";
OloErrorCode["invalidRequest"] = "InvalidRequest";
OloErrorCode["lineItemsTotalMismatch"] = "LineItemsTotalMismatch";
OloErrorCode["missingParameter"] = "MissingParameter";
OloErrorCode["processingError"] = "ProcessingError";
OloErrorCode["sdkUninitialized"] = "SdkUninitialized";
OloErrorCode["unexpectedError"] = "UnexpectedError";
OloErrorCode["unknownCard"] = "UnknownCard";
OloErrorCode["viewNotFound"] = "ViewNotFound";
return OloErrorCode;
}({}); // SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
const DigitalWalletReadyEvent = exports.DigitalWalletReadyEvent = 'digitalWalletReadyEvent';
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
let CardField = exports.CardField = /*#__PURE__*/function (CardField) {
CardField["number"] = "number";
CardField["expiration"] = "expiration";
CardField["cvv"] = "cvv";
CardField["postalCode"] = "postalCode";
return CardField;
}({}); // SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
/**
* Represents a line item in a digital wallet transaction
*
* | Property | Description |
* | -------- | ----------- |
* | `label` | The label of the line item |
* | `amount` | The amount of the line item |
* | `type` | Enum representing the type of a line item in a digital wallet transaction |
* | `status` | Enum representing the status of a line item. If not provided, default value is `LineItemStatus.final` |
*/
let LineItemType = exports.LineItemType = /*#__PURE__*/function (LineItemType) {
/** Represents a subtotal line item in a digital wallet transaction */
LineItemType["subtotal"] = "Subtotal";
/** Represents a line item in a digital wallet transaction */
LineItemType["lineItem"] = "LineItem";
/** Represents a tax line item in a digital wallet transaction */
LineItemType["tax"] = "Tax";
return LineItemType;
}({});
let LineItemStatus = exports.LineItemStatus = /*#__PURE__*/function (LineItemStatus) {
/** Indicates that the price is final and has no variance */
LineItemStatus["final"] = "Final";
/** Indicates that the price is pending and may change. On iOS this will cause the amount to appear as an elipsis ("...") */
LineItemStatus["pending"] = "Pending";
return LineItemStatus;
}({}); // SEE DOCUMENTATION IN README.MD
let FontWeight = exports.FontWeight = /*#__PURE__*/function (FontWeight) {
FontWeight["ultraLight"] = "100";
FontWeight["thin"] = "200";
FontWeight["light"] = "300";
FontWeight["regular"] = "400";
FontWeight["medium"] = "500";
FontWeight["semiBold"] = "600";
FontWeight["bold"] = "700";
FontWeight["extraBold"] = "800";
FontWeight["black"] = "900";
return FontWeight;
}({}); // SEE DOCUMENTATION IN README.MD
let ApplePayButtonStyle = exports.ApplePayButtonStyle = /*#__PURE__*/function (ApplePayButtonStyle) {
ApplePayButtonStyle["automatic"] = "automatic";
ApplePayButtonStyle["black"] = "black";
ApplePayButtonStyle["white"] = "white";
ApplePayButtonStyle["whiteOutline"] = "whiteOutline";
return ApplePayButtonStyle;
}({}); // SEE DOCUMENTATION IN README.MD
let ApplePayButtonType = exports.ApplePayButtonType = /*#__PURE__*/function (ApplePayButtonType) {
ApplePayButtonType["addMoney"] = "addMoney";
ApplePayButtonType["book"] = "book";
ApplePayButtonType["buy"] = "buy";
ApplePayButtonType["checkout"] = "checkout";
ApplePayButtonType["continue"] = "continue";
ApplePayButtonType["contribute"] = "contribute";
ApplePayButtonType["donate"] = "donate";
ApplePayButtonType["inStore"] = "inStore";
ApplePayButtonType["order"] = "order";
ApplePayButtonType["pay"] = "inStore";
//Intentionally maps to inStore
ApplePayButtonType["plain"] = "plain";
ApplePayButtonType["reload"] = "reload";
ApplePayButtonType["rent"] = "rent";
ApplePayButtonType["setUp"] = "setUp";
ApplePayButtonType["subscribe"] = "subscribe";
ApplePayButtonType["support"] = "support";
ApplePayButtonType["tip"] = "tip";
ApplePayButtonType["topUp"] = "topUp";
return ApplePayButtonType;
}({}); // SEE DOCUMENTATION IN README.MD
let GooglePayButtonTheme = exports.GooglePayButtonTheme = /*#__PURE__*/function (GooglePayButtonTheme) {
GooglePayButtonTheme["dark"] = "dark";
GooglePayButtonTheme["light"] = "light";
return GooglePayButtonTheme;
}({}); // SEE DOCUMENTATION IN README.MD
let GooglePayButtonType = exports.GooglePayButtonType = /*#__PURE__*/function (GooglePayButtonType) {
GooglePayButtonType["book"] = "book";
GooglePayButtonType["buy"] = "buy";
GooglePayButtonType["checkout"] = "checkout";
GooglePayButtonType["donate"] = "donate";
GooglePayButtonType["order"] = "order";
GooglePayButtonType["pay"] = "pay";
GooglePayButtonType["plain"] = "plain";
GooglePayButtonType["subscribe"] = "subscribe";
return GooglePayButtonType;
}({}); // SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
// SEE DOCUMENTATION IN README.MD
//# sourceMappingURL=definitions.js.map