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BACxB,KAAjB,IAAqB,EAAO,aAAe,+BAC3B,KAAhB,IAAoB,EAAO,YAAc,6BAC9B,KAAX,IAAe,EAAO,OAAS,wBAClB,KAAb,IAAiB,EAAO,SAAW,0BACZ,KAAvB,IAA2B,EAAO,mBAAqB,oCAC1C,KAAb,IAAiB,EAAO,SAAW,0BACrB,KAAd,IAAkB,EAAO,UAAY,2BACrB,KAAhB,IAAoB,EAAO,YAAc,6BAG7B,KAAZ,IAAgB,EAAO,QAAU,yBAClB,KAAf,IAAmB,EAAO,WAAa,4BAEvC,OAAO,KAAK,GAAQ,OAAS,EACxB,EAGF,OAAO,IAAI,EAAK,SAGhB","file":"/npm/ipay88-sdk@1.0.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/ipay88-sdk@1.0.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { Component } from 'react';\nimport { NativeModules, DeviceEventEmitter, Platform, NativeEventEmitter } from 'react-native';\nimport { PropTypes } from 'prop-types';\n\nconst { IPay88 } = NativeModules;\nconst iosEvent = new NativeEventEmitter(IPay88);\n\nconst isAndroid = Platform.OS === 'android';\n\nlet successSubscription;\nlet failedSubscription;\nlet cancelSubscription;\n\nexport default class IPay extends Component {\n  static propTypes = {\n    successNotify: PropTypes.func.isRequired,\n    failedNotify: PropTypes.func.isRequired,\n    cancelNotify: PropTypes.func.isRequired,\n  };\n\n  componentWillMount() {\n    if (isAndroid) {\n      // Android\n      successSubscription = DeviceEventEmitter.addListener('ipay88:success', (data) => this.onSuccess(data));\n      failedSubscription = DeviceEventEmitter.addListener('ipay88:failed', (data) => this.onFailed(data));\n      cancelSubscription = DeviceEventEmitter.addListener('ipay88:canceled', (data) => this.onCanceled(data));\n    } else {\n      // ios\n      successSubscription = iosEvent.addListener('ipay88:success', (data) => this.onSuccess(data));\n      failedSubscription = iosEvent.addListener('ipay88:failed', (data) => this.onFailed(data));\n      cancelSubscription = iosEvent.addListener('ipay88:canceled', (data) => this.onCanceled(data));\n    }\n  }\n\n  componentDidMount() {\n    successSubscription.remove();\n    failedSubscription.remove();\n    cancelSubscription.remove();\n  }\n\n  onSuccess = (data) => {\n    this.props.successNotify(data);\n  };\n\n  onCanceled = (data) => {\n    this.props.cancelNotify(data);\n  };\n\n  onFailed = (data) => {\n    this.props.failedNotify(data);\n  };\n\n  render() {\n    return null;\n  }\n}\n\nconst Pay = (data) => {\n  const {\n    merchantKey = '',\n    merchantCode = '',\n    referenceNo = '',\n    amount = '',\n    currency = '',\n    productDescription = '',\n    userName = '',\n    userEmail = '',\n    userContact = '',\n    country = '',\n    backendUrl = '',\n  } = data;\n\n  const errors = {};\n  // if (paymentId === '') {errors.paymentId = '`paymentId` is required'; // optional\n  if (merchantKey === '') errors.merchantKey = '`merchantKey` is required';\n  if (merchantCode === '') errors.merchantCode = '`merchantCode` is required`';\n  if (referenceNo === '') errors.referenceNo = '`referenceNo` is required';\n  if (amount === '') errors.amount = '`amount` is required';\n  if (currency === '') errors.currency = '`currency` is required';\n  if (productDescription === '') errors.productDescription = '`productDescription` is required';\n  if (userName === '') errors.userName = '`userName` is required';\n  if (userEmail === '') errors.userEmail = '`userEmail` is required';\n  if (userContact === '') errors.userContact = '`userContact` is required';\n  // if (remark === '') errors.remark = '`remark` is required'; // optional\n  // if (utfLang === '') errors.utfLang = '`utfLang` is required'; // optional\n  if (country === '') errors.country = '`country` is required';\n  if (backendUrl === '') errors.backendUrl = '`backendUrl` is required';\n\n  if (Object.keys(errors).length > 0) {\n    return errors;\n  }\n\n  return IPay88.pay(data);\n};\n\nexport { Pay };\n"]}