rebill-web-components-sdk 1.8.21 → 1.8.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/apm-checkout_19.cjs.entry.js +1 -1
- package/dist/cjs/index-C-VTnc0I.js.map +1 -1
- package/dist/cjs/rebill-checkout.cjs.entry.js +1 -1
- package/dist/cjs/rebill-renewal.cjs.entry.js +1 -1
- package/dist/cjs/{required-fields-mappers-U6myFlpn.js → required-fields-mappers-DWU2V-eY.js} +3 -2
- package/dist/cjs/{required-fields-mappers-U6myFlpn.js.map → required-fields-mappers-DWU2V-eY.js.map} +1 -1
- package/dist/collection/components/checkout/payment-button/payment-button.js +1 -1
- package/dist/collection/components/checkout/payment-button/payment-button.js.map +1 -1
- package/dist/collection/utils/required-fields-mappers.js +1 -0
- package/dist/collection/utils/required-fields-mappers.js.map +1 -1
- package/dist/components/p-8BpuJ_V5.js.map +1 -1
- package/dist/components/{p-BI62ypLw.js → p-BRI7iMx8.js} +3 -2
- package/dist/components/p-BRI7iMx8.js.map +1 -0
- package/dist/components/{p-aO8Az5Xi.js → p-DZKiNnX2.js} +3 -3
- package/dist/components/{p-aO8Az5Xi.js.map → p-DZKiNnX2.js.map} +1 -1
- package/dist/components/payment-button.js +1 -1
- package/dist/components/rebill-checkout.js +2 -2
- package/dist/components/rebill-renewal.js +2 -2
- package/dist/esm/apm-checkout_19.entry.js +1 -1
- package/dist/esm/index-D8cwEAmw.js.map +1 -1
- package/dist/esm/rebill-checkout.entry.js +1 -1
- package/dist/esm/rebill-renewal.entry.js +1 -1
- package/dist/esm/{required-fields-mappers-BOaTKbNe.js → required-fields-mappers-BErrHwHk.js} +3 -2
- package/dist/esm/{required-fields-mappers-BOaTKbNe.js.map → required-fields-mappers-BErrHwHk.js.map} +1 -1
- package/dist/rebill-web-components-sdk/{p-ea3de987.entry.js → p-4a8ad442.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-b306912b.entry.js → p-6bcff3c5.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-b616775b.entry.js → p-9afddef2.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-Bz-GsiI3.js → p-BP5Qpv7O.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-Bz-GsiI3.js.map → p-BP5Qpv7O.js.map} +1 -1
- package/dist/rebill-web-components-sdk/p-D8cwEAmw.js.map +1 -1
- package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
- package/dist/types/utils/required-fields-mappers.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-BI62ypLw.js.map +0 -1
- /package/dist/rebill-web-components-sdk/{p-ea3de987.entry.js.map → p-4a8ad442.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-b306912b.entry.js.map → p-6bcff3c5.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-b616775b.entry.js.map → p-9afddef2.entry.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-D8cwEAmw.js';
|
|
2
2
|
import { c as create$6 } from './index.esm-CRUbzQx9.js';
|
|
3
3
|
import { a as api } from './index-BOj-Hiz8.js';
|
|
4
|
-
import { m as mapRequiredFields, g as generateIdempotencyKey, P as PaymentMessageE, C as CheckoutStatusE, i as isFieldRequired, a as PaymentErrorMapper, b as getFieldValues } from './required-fields-mappers-
|
|
4
|
+
import { m as mapRequiredFields, g as generateIdempotencyKey, P as PaymentMessageE, C as CheckoutStatusE, i as isFieldRequired, a as PaymentErrorMapper, b as getFieldValues } from './required-fields-mappers-BErrHwHk.js';
|
|
5
5
|
import { s as state, S as SESSION_TYPE_ENUM, I as I18nService, a as SessionStore, i as initializeI18nWithSessionLanguage, P as PAYMENT_METHOD_ENUM, o as onChange, b as SESSION_ITEM_TYPE_ENUM } from './i18n.service-C66pwG5K.js';
|
|
6
6
|
import { S as STATUS_REQ_CHECKOUT_APM } from './status-req-checkout-apm.enum-vsLqF4hk.js';
|
|
7
7
|
import { B as BREAKPOINT_ENUM, g as getBreakpoint, i as isBreakpointBelow } from './breakpoint-Do_vNuMa.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-D8cwEAmw.js';
|
|
2
2
|
import { c as create$6 } from './index.esm-CRUbzQx9.js';
|
|
3
3
|
import { a as api } from './index-BOj-Hiz8.js';
|
|
4
|
-
import { m as mapRequiredFields, i as isFieldRequired, g as generateIdempotencyKey, C as CheckoutStatusE, a as PaymentErrorMapper, b as getFieldValues } from './required-fields-mappers-
|
|
4
|
+
import { m as mapRequiredFields, i as isFieldRequired, g as generateIdempotencyKey, C as CheckoutStatusE, a as PaymentErrorMapper, b as getFieldValues } from './required-fields-mappers-BErrHwHk.js';
|
|
5
5
|
import { P as PAYMENT_METHOD_ENUM, I as I18nService } from './i18n.service-C66pwG5K.js';
|
|
6
6
|
import { P as PaymentMethodMapper, G as GoogleMapsService, a as PaymentMethodNameE } from './google-maps.service-vbboJH6u.js';
|
|
7
7
|
import { r as renewalState, R as RenewalStore, o as onChange } from './renewal.store-35bWWorA.js';
|
package/dist/esm/{required-fields-mappers-BOaTKbNe.js → required-fields-mappers-BErrHwHk.js}
RENAMED
|
@@ -206,6 +206,7 @@ const requiredFieldsMapper = {
|
|
|
206
206
|
'customer.identification': 'documentNumber',
|
|
207
207
|
'customer.identification_type': 'documentType',
|
|
208
208
|
'address.line_one': 'billing-address',
|
|
209
|
+
'address.line_two': 'billing-address',
|
|
209
210
|
'address.zip_code': 'billing-zip',
|
|
210
211
|
'address.state': 'billing-state',
|
|
211
212
|
'address.city': 'billing-city',
|
|
@@ -245,6 +246,6 @@ const getFieldValues = (fieldName, requiredFields) => {
|
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
export { CheckoutStatusE as C, PaymentMessageE as P, PaymentErrorMapper as a, getFieldValues as b, generateIdempotencyKey as g, isFieldRequired as i, mapRequiredFields as m };
|
|
248
|
-
//# sourceMappingURL=required-fields-mappers-
|
|
249
|
+
//# sourceMappingURL=required-fields-mappers-BErrHwHk.js.map
|
|
249
250
|
|
|
250
|
-
//# sourceMappingURL=required-fields-mappers-
|
|
251
|
+
//# sourceMappingURL=required-fields-mappers-BErrHwHk.js.map
|
package/dist/esm/{required-fields-mappers-BOaTKbNe.js.map → required-fields-mappers-BErrHwHk.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required-fields-mappers-BOaTKbNe.js","sources":["src/api/entities/checkout/types.ts","src/models/enums/payment-status.enum.ts","src/utils/generate-idempotency-key.ts","src/utils/payment-error-mapper.ts","src/utils/required-fields-mappers.ts"],"sourcesContent":["import { PaymentMethodNameE } from '../../../models/enums/payment-method-name.enum';\nimport { STATUS_REQ_CHECKOUT_APM } from '../../../models/enums/status-req-checkout-apm.enum';\n\n// Checkout request status\nexport enum CheckoutStatusE {\n PENDING = 'PENDING',\n APPROVED = 'APPROVED',\n REJECTED = 'REJECTED',\n ERROR = 'ERROR',\n}\n\n// APM Transaction interface (based on documentation)\nexport interface APMTransaction {\n name?: { text: string; language: string }[];\n description?: { text: string; language: string }[];\n isPriceFixed?: boolean;\n tiers?: any[];\n plan?: any;\n quantity: number;\n amount?: number;\n currency?: string;\n productId?: string;\n planId?: string;\n couponCode?: string;\n}\n\n// APM Customer interface (based on documentation)\nexport interface APMCustomer {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n shippingAddress?: APMAddress;\n}\n\n// APM Address interface (based on documentation)\nexport interface APMAddress {\n country: string;\n state: string;\n city: string;\n zipCode: string;\n lineOne: string;\n lineTwo?: string;\n}\n\n// APM Redirect URLs interface (based on documentation)\nexport interface APMRedirect {\n approved: string;\n rejected: string;\n}\n\n// Metadata interface\nexport interface Metadata {\n [key: string]: unknown;\n}\n\n// Create APM checkout request interface (based on documentation)\nexport interface CreateAPMCheckoutRequest {\n transaction: APMTransaction;\n method: PaymentMethodNameE;\n customer?: APMCustomer; // Optional for authenticated users\n billingDetails?: {\n address: {\n lineOne: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n redirect: APMRedirect;\n paymentMetadata?: Metadata;\n subscriptionMetadata?: Metadata;\n customAttributes?: {\n bank?: string;\n };\n targetCurrency?: string;\n}\n\n// Legacy interfaces for backward compatibility\nexport interface Transaction {\n amount: number;\n currency: string;\n description: string;\n}\n\nexport interface Customer {\n email: string;\n name: string;\n phone: string;\n documentType?: string;\n documentNumber?: string;\n shippingAddress: Address;\n}\n\nexport interface Address {\n lineOne: string;\n lineTwo?: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n}\n\nexport interface Redirect {\n successUrl: string;\n failureUrl: string;\n cancelUrl: string;\n}\n\nexport interface CreateCardCheckoutRequest {\n transaction: {\n quantity: number;\n currency?: string;\n amount?: number;\n couponCode?: string;\n };\n installments?: number;\n cardTokenId?: string | null; // Optional, if card is saved\n cardId?: string | null; // Optional, if card is saved\n customer?: {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n };\n billingDetails?: {\n address: {\n lineOne: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n paymentMetadata?: {\n bankCode?: string;\n };\n customAttributes?: {\n deviceId?: string;\n };\n saveCard?: boolean;\n}\nexport interface CreateCardCheckoutResponse {\n traceId: string;\n date: string;\n result?: {\n paymentId: string;\n status: CheckoutStatusE;\n subscriptionId: string;\n cardId: string;\n cardLastFour: string;\n customerId: string;\n statusDetail?: string;\n type?: string;\n };\n error: {\n traceId: string;\n date: string;\n error: {\n message: string;\n type: string;\n };\n statusCode: number;\n };\n}\nexport interface Card {\n cardHolderName: string;\n cardExpirationMonth: string;\n cardExpirationYear: string;\n securityCode: string;\n number: string;\n identification: {\n type: string;\n value: string;\n };\n saveCard: boolean;\n}\n// Instruction interface for payment reference\nexport interface PaymentInstruction {\n text: string;\n language: string;\n}\n\n// Bank transfer data interface\nexport interface BankTransferData {\n bbvAccountNumber?: string;\n account: string; // CLABE\n bankName: string;\n reference: string;\n}\n\n// Checkout data interface (provider-specific)\nexport interface CheckoutData {\n // For QR codes\n qrCode?: string;\n\n // For barcodes\n barcode?: string;\n\n // For bank transfer payments (new - multiple data sets)\n bankTransferData?: BankTransferData[];\n\n // For reference payments\n referenceId?: string;\n instructions?: PaymentInstruction[];\n\n // For redirect payments\n url?: string;\n message?: string;\n // For vouchers\n voucherUrl?: string;\n\n // Additional provider-specific data\n [key: string]: any;\n}\n\n// Checkout result interface\nexport interface CheckoutResult {\n checkoutRequestId: string;\n status: CheckoutStatusE;\n data: CheckoutData;\n}\n\n// Error interface\nexport interface CheckoutError {\n message: string;\n type: string;\n}\n\n// Bank interface for PSE payments\nexport interface Bank {\n code: string;\n name: string;\n}\n\n// Required fields request interface\nexport interface RequiredFieldsRequest {\n currency: string;\n method: string;\n bin?: number;\n}\n\n// Required fields response interface\nexport type RequiredFieldsResponse = {\n name: string;\n values?: {\n code: string;\n name: string;\n }[];\n}[];\n\n// Create APM checkout response interface\nexport interface CreateAPMCheckoutResponse {\n traceId: string;\n date: string;\n result?: CheckoutResult;\n error?: CheckoutError;\n}\n\nexport interface PaymentMethod {\n name: string;\n type: string;\n}\n\nexport interface TrackingData {\n locale: string;\n utmTerm: string;\n referrer: string;\n ipAddress: string;\n}\nexport interface Source {\n source: string;\n version: string;\n}\n\nexport interface APMSession {\n country: string;\n createdAt: string;\n deviceId: string;\n email: string | null;\n expiresAt: string;\n id: string;\n isCreatedDuringCheckout: boolean;\n metadata: Record<string, unknown>;\n organizationId: string;\n paymentLinkId: string;\n paymentMethods: PaymentMethod[];\n planId: string;\n priceId: string;\n productId: string | null;\n providerKey: string;\n source: Source;\n status: string;\n trackingData: TrackingData;\n updatedAt: string;\n}\n\nexport interface CheckoutRequestPayment {\n id: string;\n createdAt: string;\n updatedAt: string;\n organizationId: string;\n amount: number;\n currency: string;\n customer: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n phoneNumbers: {\n number: string;\n countryCode: string;\n }[];\n };\n status: string;\n metadata: Record<string, unknown>;\n paymentMethodType: string;\n paymentMethodMetadata: Record<string, unknown>;\n card: {\n id: string;\n name: string;\n expiration: {\n month: string;\n year: string;\n };\n lastFour: string;\n brand: string;\n };\n quantity: number;\n paymentProviderReference: string | null;\n paymentProviderDescription: string | null;\n installments: number | null;\n priceFixedIn: string | null;\n conversionRate: number | null;\n couponId: string | null;\n description: [\n {\n text: string;\n language: string;\n },\n ];\n processingMode: string;\n processingFee: number | null;\n country: string;\n timezone: string;\n}\n\nexport interface CheckoutRequestPaymentAPM {\n checkoutRequestId: string;\n status: STATUS_REQ_CHECKOUT_APM;\n type: string;\n data: {\n message: string;\n url: string;\n };\n session: APMSession;\n payment: CheckoutRequestPayment | null;\n}\n","export enum PaymentMessageE {\n PENDING = 'pending',\n APPROVED = 'approved',\n REJECTED = 'rejected',\n DECLINED = 'declined',\n ERROR = 'error',\n REFUNDED = 'refunded',\n CANCELLED = 'cancelled',\n PARTIALLY_REFUNDED = 'partially_refunded',\n EXPIRED = 'expired',\n GENERIC_REJECT = 'generic_reject',\n INVALID_CARD = 'invalid_card',\n INVALID_CARD_NUMBER = 'invalid_card_number',\n INVALID_CARD_HOLDER_NAME = 'invalid_card_holder_name',\n INVALID_CARD_EXPIRATION_DATE = 'invalid_card_expiration_date',\n INVALID_CARD_CVC = 'invalid_card_cvc',\n INSUFFICIENT_FUNDS = 'insufficient_funds',\n\n BLACKLISTED_CARD = 'blacklisted_card',\n INVALID_CUSTOMER_EMAIL = 'invalid_customer_email',\n INVALID_CUSTOMER_PHONE = 'invalid_customer_phone',\n INVALID_CUSTOMER_BILLING_ADDRESS = 'invalid_customer_billing_address',\n REQUIRED_CUSTOMER_EMAIL = 'required_customer_email',\n REQUIRED_CUSTOMER_PHONE = 'required_customer_phone',\n REQUIRED_CUSTOMER_BILLING_ADDRESS = 'required_customer_billing_address',\n INVALID_CHECKOUT_REQUEST = 'invalid_checkout_request',\n UNAVAILABLE_PAYMENT_METHOD = 'unavailable_payment_method',\n INVALID_AMOUNT = 'invalid_amount',\n INVALID_CURRENCY = 'invalid_currency',\n INVALID_COUNTRY = 'invalid_country',\n MAX_ATTEMPTS = 'max_attempts',\n PAYMENT_EXPIRED = 'payment_expired',\n FRAUD_HIGH_RISK = 'fraud_high_risk',\n INTERNAL_ERROR = 'internal_error',\n INVALID_SESSION = 'invalid_session',\n APM_MESSAGE_ERROR = 'apm_message_error',\n APM_ERROR_GENERIC = 'apm_error_generic',\n APM_ERROR_BANK_TRANSFER = 'apm_error_bank_transfer',\n PROVIDER_ERROR = 'provider_error',\n BANK_REJECTED = 'bank_rejected',\n CALL_BANK_FOR_AUTHORIZE = 'call_bank_for_authorize',\n REQUIRED_3DS = 'required_3ds',\n BLACKLISTED = 'blacklisted',\n HARD_DECLINE = 'hard-decline',\n SOFT_DECLINE = 'soft-decline',\n HUMAN_DECLINE = 'human-decline',\n INTERNAL = 'internal',\n INVALID_CARD_TOKENIZE_COUNTRY = 'invalid_card_tokenize_country',\n INVALID_CUSTOMER_ADDRESS = 'invalid_customer_address',\n INVALID_CUSTOMER_CITY = 'invalid_customer_city',\n INVALID_CUSTOMER_STATE = 'invalid_customer_state',\n INVALID_CUSTOMER_ZIP = 'invalid_customer_zip',\n INVALID_CUSTOMER_COUNTRY = 'invalid_customer_country',\n INVALID_CUSTOMER_DOCUMENT = 'invalid_customer_document',\n INVALID_CUSTOMER_DOCUMENT_NUMBER = 'invalid_customer_document_number',\n INVALID_CUSTOMER_DOCUMENT_TYPE = 'invalid_customer_document_type',\n INVALID_CHECKOUT_PAYMENT_METHOD = 'invalid_checkout_payment_method',\n REQUIRED_CUSTOMER_ADDRESS = 'required_customer_address',\n REQUIRED_CUSTOMER_CITY = 'required_customer_city',\n REQUIRED_CUSTOMER_STATE = 'required_customer_state',\n REQUIRED_CUSTOMER_ZIP = 'required_customer_zip',\n REQUIRED_CUSTOMER_COUNTRY = 'required_customer_country',\n REQUIRED_CUSTOMER_DOCUMENT = 'required_customer_document',\n REQUIRED_CUSTOMER_DOCUMENT_NUMBER = 'required_customer_document_number',\n REQUIRED_CUSTOMER_DOCUMENT_TYPE = 'required_customer_document_type',\n EXPIRED_CARD = 'expired_card',\n SANDBOX_ERROR = 'sandbox_error',\n}\n","export const generateIdempotencyKey = () => {\n return `idmp_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n};\n","import { I18nService } from '../i18n/i18n.service';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../models/enums/payment-status.enum';\n\nexport interface AlertErrorKeys {\n alertTitle?: PaymentMessageE;\n message: PaymentMessageE;\n}\n\n//currency country\n\nexport class PaymentErrorMapper {\n static getErrorMessage(\n errorMessageKey: AlertErrorKeys['message'] | null,\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry?: string,\n ): string {\n if (\n !errorMessageKey ||\n !Object.values(PaymentMessageE).includes(errorMessageKey as PaymentMessageE) ||\n errorMessageKey === PaymentMessageE.GENERIC_REJECT\n ) {\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorMessagePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorMessageQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorMessagePSE');\n }\n return I18nService.translate('paymentErrors.genericErrorMessageBankTransfer');\n }\n return I18nService.translate('paymentErrors.genericErrorMessage');\n }\n return PaymentErrorMapper.getMessage(errorMessageKey);\n }\n\n static getErrorTitle(\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry: string,\n errorTitleKey?: AlertErrorKeys['alertTitle'],\n ): string {\n if (errorTitleKey && !(errorTitleKey in PaymentMessageE)) {\n return PaymentErrorMapper.getMessage(errorTitleKey);\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorTitleCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorTitlePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorTitleQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorTitlePSE');\n }\n }\n return I18nService.translate('paymentErrors.genericErrorTitleBankTransfer');\n }\n\n private static getMessage(errorMessageKey: PaymentMessageE): string {\n const messageMap: Record<PaymentMessageE, string> = {\n [PaymentMessageE.PENDING]: I18nService.translate('paymentErrors.pending'),\n [PaymentMessageE.APPROVED]: I18nService.translate('paymentErrors.approved'),\n [PaymentMessageE.REJECTED]: I18nService.translate('paymentErrors.rejected'),\n [PaymentMessageE.DECLINED]: I18nService.translate('paymentErrors.declined'),\n [PaymentMessageE.ERROR]: I18nService.translate('paymentErrors.error'),\n [PaymentMessageE.REFUNDED]: I18nService.translate('paymentErrors.refunded'),\n [PaymentMessageE.CANCELLED]: I18nService.translate('paymentErrors.cancelled'),\n [PaymentMessageE.PARTIALLY_REFUNDED]: I18nService.translate(\n 'paymentErrors.partiallyRefunded',\n ),\n [PaymentMessageE.EXPIRED]: I18nService.translate('paymentErrors.expired'),\n [PaymentMessageE.GENERIC_REJECT]: I18nService.translate('paymentErrors.genericReject'),\n [PaymentMessageE.INVALID_CARD]: I18nService.translate('paymentErrors.invalidCard'),\n [PaymentMessageE.INVALID_CARD_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCardNumber',\n ),\n [PaymentMessageE.INVALID_CARD_HOLDER_NAME]: I18nService.translate(\n 'paymentErrors.invalidCardHolderName',\n ),\n [PaymentMessageE.INVALID_CARD_EXPIRATION_DATE]: I18nService.translate(\n 'paymentErrors.invalidCardExpirationDate',\n ),\n [PaymentMessageE.INVALID_CARD_CVC]: I18nService.translate('paymentErrors.invalidCardCvc'),\n [PaymentMessageE.INSUFFICIENT_FUNDS]: I18nService.translate(\n 'paymentErrors.insufficientFunds',\n ),\n [PaymentMessageE.BLACKLISTED_CARD]: I18nService.translate('paymentErrors.blacklistedCard'),\n [PaymentMessageE.INVALID_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.invalidCustomerEmail',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.invalidCustomerPhone',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerBillingAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.requiredCustomerEmail',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.requiredCustomerPhone',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerBillingAddress',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_REQUEST]: I18nService.translate(\n 'paymentErrors.invalidCheckoutRequest',\n ),\n [PaymentMessageE.UNAVAILABLE_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.unavailablePaymentMethod',\n ),\n [PaymentMessageE.INVALID_AMOUNT]: I18nService.translate('paymentErrors.invalidAmount'),\n [PaymentMessageE.INVALID_CURRENCY]: I18nService.translate('paymentErrors.invalidCurrency'),\n [PaymentMessageE.INVALID_COUNTRY]: I18nService.translate('paymentErrors.invalidCountry'),\n [PaymentMessageE.MAX_ATTEMPTS]: I18nService.translate('paymentErrors.maxAttempts'),\n [PaymentMessageE.PAYMENT_EXPIRED]: I18nService.translate('paymentErrors.paymentExpired'),\n\n [PaymentMessageE.INTERNAL_ERROR]: I18nService.translate('paymentErrors.internalError'),\n [PaymentMessageE.INVALID_SESSION]: I18nService.translate('paymentErrors.invalidSession'),\n [PaymentMessageE.APM_MESSAGE_ERROR]: I18nService.translate('paymentErrors.APMMessageError'),\n [PaymentMessageE.APM_ERROR_GENERIC]: I18nService.translate('paymentErrors.APMErrorGeneric'),\n [PaymentMessageE.APM_ERROR_BANK_TRANSFER]: I18nService.translate(\n 'paymentErrors.APMErrorBankTransfer',\n ),\n [PaymentMessageE.PROVIDER_ERROR]: I18nService.translate('paymentErrors.providerError'),\n [PaymentMessageE.BANK_REJECTED]: I18nService.translate('paymentErrors.bankRejected'),\n\n [PaymentMessageE.FRAUD_HIGH_RISK]: I18nService.translate('paymentErrors.fraudHighRisk'),\n [PaymentMessageE.CALL_BANK_FOR_AUTHORIZE]: I18nService.translate(\n 'paymentErrors.callBankForAuthorize',\n ),\n [PaymentMessageE.REQUIRED_3DS]: I18nService.translate('paymentErrors.required3ds'),\n [PaymentMessageE.BLACKLISTED]: I18nService.translate('paymentErrors.blacklisted'),\n [PaymentMessageE.HARD_DECLINE]: I18nService.translate('paymentErrors.hardDecline'),\n [PaymentMessageE.SOFT_DECLINE]: I18nService.translate('paymentErrors.softDecline'),\n [PaymentMessageE.HUMAN_DECLINE]: I18nService.translate('paymentErrors.humanDecline'),\n [PaymentMessageE.INTERNAL]: I18nService.translate('paymentErrors.internal'),\n [PaymentMessageE.INVALID_CARD_TOKENIZE_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCardTokenizeCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerAddress',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCity',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.invalidCustomerState',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.invalidCustomerZip',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocument',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentNumber',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentType',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.invalidCheckoutPaymentMethod',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCity',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.requiredCustomerState',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.requiredCustomerZip',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCountry',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocument',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentNumber',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentType',\n ),\n [PaymentMessageE.EXPIRED_CARD]: I18nService.translate('paymentErrors.expiredCard'),\n [PaymentMessageE.SANDBOX_ERROR]: I18nService.translate('paymentErrors.sandboxError'),\n };\n\n return messageMap[errorMessageKey] || I18nService.translate('paymentErrors.genericError');\n }\n}\n","export interface RequiredField {\n name: string;\n values?: {\n code: string;\n name: string;\n }[];\n}\n\nconst requiredFieldsMapper = {\n 'customer.email': 'email',\n 'customer.first_name': 'fullName',\n 'customer.last_name': 'fullName',\n 'customer.identification': 'documentNumber',\n 'customer.identification_type': 'documentType',\n\n 'address.line_one': 'billing-address',\n 'address.zip_code': 'billing-zip',\n 'address.state': 'billing-state',\n 'address.city': 'billing-city',\n 'address.country': 'billing-country',\n\n 'phone.number': 'phoneNumber',\n 'phone.country_code': 'countryCodePhoneNumber',\n\n 'bank': 'bankId',\n};\n\nexport const mapRequiredFields = (apiFields: RequiredField[]): string[] => {\n if (!apiFields || !Array.isArray(apiFields)) {\n return [];\n }\n\n const uniqueFields = new Set<string>();\n\n apiFields.forEach(field => {\n const mappedField = requiredFieldsMapper[field.name];\n if (mappedField) {\n uniqueFields.add(mappedField);\n } else {\n uniqueFields.add(field.name);\n }\n });\n\n return Array.from(uniqueFields);\n};\n\nexport const isFieldRequired = (fieldName: string, mappedFields: string[]): boolean => {\n if (!mappedFields || !Array.isArray(mappedFields)) {\n return false;\n }\n return mappedFields.includes(fieldName);\n};\n\nexport const getFieldValues = (\n fieldName: string,\n requiredFields: RequiredField[],\n): Array<{ code: string; name: string }> | null => {\n if (!requiredFields || !Array.isArray(requiredFields)) {\n return null;\n }\n\n const field = requiredFields.find(f => f.name === fieldName);\n return field?.values || null;\n};\n\nexport const hasFieldValues = (fieldName: string, requiredFields: RequiredField[]): boolean => {\n const values = getFieldValues(fieldName, requiredFields);\n return values !== null && values.length > 0;\n};\n\nexport default requiredFieldsMapper;\n"],"names":[],"mappings":";;AAGA;AACY,IAAA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,UAAA,CAAA,GAA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GAAG,CAAC,SAA0B,KAAc;IACxE,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AAC3C,QAAA,OAAO,EAAE;;AAGX,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU;AAEtC,IAAA,SAAS,CAAC,OAAO,CAAC,KAAK,IAAG;QACxB,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACpD,IAAI,WAAW,EAAE;AACf,YAAA,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC;;aACxB;AACL,YAAA,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;;AAEhC,KAAC,CAAC;AAEF,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;AACjC;MAEa,eAAe,GAAG,CAAC,SAAiB,EAAE,YAAsB,KAAa;IACpF,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACjD,QAAA,OAAO,KAAK;;AAEd,IAAA,OAAO,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC;AACzC;MAEa,cAAc,GAAG,CAC5B,SAAiB,EACjB,cAA+B,KACiB;IAChD,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;AACrD,QAAA,OAAO,IAAI;;AAGb,IAAA,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AAC5D,IAAA,OAAO,KAAK,EAAE,MAAM,IAAI,IAAI;AAC9B;;;;"}
|
|
1
|
+
{"version":3,"file":"required-fields-mappers-BErrHwHk.js","sources":["src/api/entities/checkout/types.ts","src/models/enums/payment-status.enum.ts","src/utils/generate-idempotency-key.ts","src/utils/payment-error-mapper.ts","src/utils/required-fields-mappers.ts"],"sourcesContent":["import { PaymentMethodNameE } from '../../../models/enums/payment-method-name.enum';\nimport { STATUS_REQ_CHECKOUT_APM } from '../../../models/enums/status-req-checkout-apm.enum';\n\n// Checkout request status\nexport enum CheckoutStatusE {\n PENDING = 'PENDING',\n APPROVED = 'APPROVED',\n REJECTED = 'REJECTED',\n ERROR = 'ERROR',\n}\n\n// APM Transaction interface (based on documentation)\nexport interface APMTransaction {\n name?: { text: string; language: string }[];\n description?: { text: string; language: string }[];\n isPriceFixed?: boolean;\n tiers?: any[];\n plan?: any;\n quantity: number;\n amount?: number;\n currency?: string;\n productId?: string;\n planId?: string;\n couponCode?: string;\n}\n\n// APM Customer interface (based on documentation)\nexport interface APMCustomer {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n shippingAddress?: APMAddress;\n}\n\n// APM Address interface (based on documentation)\nexport interface APMAddress {\n country: string;\n state: string;\n city: string;\n zipCode: string;\n lineOne: string;\n lineTwo?: string;\n}\n\n// APM Redirect URLs interface (based on documentation)\nexport interface APMRedirect {\n approved: string;\n rejected: string;\n}\n\n// Metadata interface\nexport interface Metadata {\n [key: string]: unknown;\n}\n\n// Create APM checkout request interface (based on documentation)\nexport interface CreateAPMCheckoutRequest {\n transaction: APMTransaction;\n method: PaymentMethodNameE;\n customer?: APMCustomer; // Optional for authenticated users\n billingDetails?: {\n address: {\n lineOne: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n redirect: APMRedirect;\n paymentMetadata?: Metadata;\n subscriptionMetadata?: Metadata;\n customAttributes?: {\n bank?: string;\n };\n targetCurrency?: string;\n}\n\n// Legacy interfaces for backward compatibility\nexport interface Transaction {\n amount: number;\n currency: string;\n description: string;\n}\n\nexport interface Customer {\n email: string;\n name: string;\n phone: string;\n documentType?: string;\n documentNumber?: string;\n shippingAddress: Address;\n}\n\nexport interface Address {\n lineOne: string;\n lineTwo?: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n}\n\nexport interface Redirect {\n successUrl: string;\n failureUrl: string;\n cancelUrl: string;\n}\n\nexport interface CreateCardCheckoutRequest {\n transaction: {\n quantity: number;\n currency?: string;\n amount?: number;\n couponCode?: string;\n };\n installments?: number;\n cardTokenId?: string | null; // Optional, if card is saved\n cardId?: string | null; // Optional, if card is saved\n customer?: {\n firstName: string;\n lastName: string;\n email: string;\n phone: {\n countryCode: string;\n number: string;\n };\n };\n billingDetails?: {\n address: {\n lineOne: string;\n city: string;\n state: string;\n zipCode: string;\n country: string;\n };\n identification: {\n type: string;\n value: string;\n };\n };\n paymentMetadata?: {\n bankCode?: string;\n };\n customAttributes?: {\n deviceId?: string;\n };\n saveCard?: boolean;\n}\nexport interface CreateCardCheckoutResponse {\n traceId: string;\n date: string;\n result?: {\n paymentId: string;\n status: CheckoutStatusE;\n subscriptionId: string;\n cardId: string;\n cardLastFour: string;\n customerId: string;\n statusDetail?: string;\n type?: string;\n };\n error: {\n traceId: string;\n date: string;\n error: {\n message: string;\n type: string;\n };\n statusCode: number;\n };\n}\nexport interface Card {\n cardHolderName: string;\n cardExpirationMonth: string;\n cardExpirationYear: string;\n securityCode: string;\n number: string;\n identification: {\n type: string;\n value: string;\n };\n saveCard: boolean;\n}\n// Instruction interface for payment reference\nexport interface PaymentInstruction {\n text: string;\n language: string;\n}\n\n// Bank transfer data interface\nexport interface BankTransferData {\n bbvAccountNumber?: string;\n account: string; // CLABE\n bankName: string;\n reference: string;\n}\n\n// Checkout data interface (provider-specific)\nexport interface CheckoutData {\n // For QR codes\n qrCode?: string;\n\n // For barcodes\n barcode?: string;\n\n // For bank transfer payments (new - multiple data sets)\n bankTransferData?: BankTransferData[];\n\n // For reference payments\n referenceId?: string;\n instructions?: PaymentInstruction[];\n\n // For redirect payments\n url?: string;\n message?: string;\n // For vouchers\n voucherUrl?: string;\n\n // Additional provider-specific data\n [key: string]: any;\n}\n\n// Checkout result interface\nexport interface CheckoutResult {\n checkoutRequestId: string;\n status: CheckoutStatusE;\n data: CheckoutData;\n}\n\n// Error interface\nexport interface CheckoutError {\n message: string;\n type: string;\n}\n\n// Bank interface for PSE payments\nexport interface Bank {\n code: string;\n name: string;\n}\n\n// Required fields request interface\nexport interface RequiredFieldsRequest {\n currency: string;\n method: string;\n bin?: number;\n}\n\n// Required fields response interface\nexport type RequiredFieldsResponse = {\n name: string;\n values?: {\n code: string;\n name: string;\n }[];\n}[];\n\n// Create APM checkout response interface\nexport interface CreateAPMCheckoutResponse {\n traceId: string;\n date: string;\n result?: CheckoutResult;\n error?: CheckoutError;\n}\n\nexport interface PaymentMethod {\n name: string;\n type: string;\n}\n\nexport interface TrackingData {\n locale: string;\n utmTerm: string;\n referrer: string;\n ipAddress: string;\n}\nexport interface Source {\n source: string;\n version: string;\n}\n\nexport interface APMSession {\n country: string;\n createdAt: string;\n deviceId: string;\n email: string | null;\n expiresAt: string;\n id: string;\n isCreatedDuringCheckout: boolean;\n metadata: Record<string, unknown>;\n organizationId: string;\n paymentLinkId: string;\n paymentMethods: PaymentMethod[];\n planId: string;\n priceId: string;\n productId: string | null;\n providerKey: string;\n source: Source;\n status: string;\n trackingData: TrackingData;\n updatedAt: string;\n}\n\nexport interface CheckoutRequestPayment {\n id: string;\n createdAt: string;\n updatedAt: string;\n organizationId: string;\n amount: number;\n currency: string;\n customer: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n phoneNumbers: {\n number: string;\n countryCode: string;\n }[];\n };\n status: string;\n metadata: Record<string, unknown>;\n paymentMethodType: string;\n paymentMethodMetadata: Record<string, unknown>;\n card: {\n id: string;\n name: string;\n expiration: {\n month: string;\n year: string;\n };\n lastFour: string;\n brand: string;\n };\n quantity: number;\n paymentProviderReference: string | null;\n paymentProviderDescription: string | null;\n installments: number | null;\n priceFixedIn: string | null;\n conversionRate: number | null;\n couponId: string | null;\n description: [\n {\n text: string;\n language: string;\n },\n ];\n processingMode: string;\n processingFee: number | null;\n country: string;\n timezone: string;\n}\n\nexport interface CheckoutRequestPaymentAPM {\n checkoutRequestId: string;\n status: STATUS_REQ_CHECKOUT_APM;\n type: string;\n data: {\n message: string;\n url: string;\n };\n session: APMSession;\n payment: CheckoutRequestPayment | null;\n}\n","export enum PaymentMessageE {\n PENDING = 'pending',\n APPROVED = 'approved',\n REJECTED = 'rejected',\n DECLINED = 'declined',\n ERROR = 'error',\n REFUNDED = 'refunded',\n CANCELLED = 'cancelled',\n PARTIALLY_REFUNDED = 'partially_refunded',\n EXPIRED = 'expired',\n GENERIC_REJECT = 'generic_reject',\n INVALID_CARD = 'invalid_card',\n INVALID_CARD_NUMBER = 'invalid_card_number',\n INVALID_CARD_HOLDER_NAME = 'invalid_card_holder_name',\n INVALID_CARD_EXPIRATION_DATE = 'invalid_card_expiration_date',\n INVALID_CARD_CVC = 'invalid_card_cvc',\n INSUFFICIENT_FUNDS = 'insufficient_funds',\n\n BLACKLISTED_CARD = 'blacklisted_card',\n INVALID_CUSTOMER_EMAIL = 'invalid_customer_email',\n INVALID_CUSTOMER_PHONE = 'invalid_customer_phone',\n INVALID_CUSTOMER_BILLING_ADDRESS = 'invalid_customer_billing_address',\n REQUIRED_CUSTOMER_EMAIL = 'required_customer_email',\n REQUIRED_CUSTOMER_PHONE = 'required_customer_phone',\n REQUIRED_CUSTOMER_BILLING_ADDRESS = 'required_customer_billing_address',\n INVALID_CHECKOUT_REQUEST = 'invalid_checkout_request',\n UNAVAILABLE_PAYMENT_METHOD = 'unavailable_payment_method',\n INVALID_AMOUNT = 'invalid_amount',\n INVALID_CURRENCY = 'invalid_currency',\n INVALID_COUNTRY = 'invalid_country',\n MAX_ATTEMPTS = 'max_attempts',\n PAYMENT_EXPIRED = 'payment_expired',\n FRAUD_HIGH_RISK = 'fraud_high_risk',\n INTERNAL_ERROR = 'internal_error',\n INVALID_SESSION = 'invalid_session',\n APM_MESSAGE_ERROR = 'apm_message_error',\n APM_ERROR_GENERIC = 'apm_error_generic',\n APM_ERROR_BANK_TRANSFER = 'apm_error_bank_transfer',\n PROVIDER_ERROR = 'provider_error',\n BANK_REJECTED = 'bank_rejected',\n CALL_BANK_FOR_AUTHORIZE = 'call_bank_for_authorize',\n REQUIRED_3DS = 'required_3ds',\n BLACKLISTED = 'blacklisted',\n HARD_DECLINE = 'hard-decline',\n SOFT_DECLINE = 'soft-decline',\n HUMAN_DECLINE = 'human-decline',\n INTERNAL = 'internal',\n INVALID_CARD_TOKENIZE_COUNTRY = 'invalid_card_tokenize_country',\n INVALID_CUSTOMER_ADDRESS = 'invalid_customer_address',\n INVALID_CUSTOMER_CITY = 'invalid_customer_city',\n INVALID_CUSTOMER_STATE = 'invalid_customer_state',\n INVALID_CUSTOMER_ZIP = 'invalid_customer_zip',\n INVALID_CUSTOMER_COUNTRY = 'invalid_customer_country',\n INVALID_CUSTOMER_DOCUMENT = 'invalid_customer_document',\n INVALID_CUSTOMER_DOCUMENT_NUMBER = 'invalid_customer_document_number',\n INVALID_CUSTOMER_DOCUMENT_TYPE = 'invalid_customer_document_type',\n INVALID_CHECKOUT_PAYMENT_METHOD = 'invalid_checkout_payment_method',\n REQUIRED_CUSTOMER_ADDRESS = 'required_customer_address',\n REQUIRED_CUSTOMER_CITY = 'required_customer_city',\n REQUIRED_CUSTOMER_STATE = 'required_customer_state',\n REQUIRED_CUSTOMER_ZIP = 'required_customer_zip',\n REQUIRED_CUSTOMER_COUNTRY = 'required_customer_country',\n REQUIRED_CUSTOMER_DOCUMENT = 'required_customer_document',\n REQUIRED_CUSTOMER_DOCUMENT_NUMBER = 'required_customer_document_number',\n REQUIRED_CUSTOMER_DOCUMENT_TYPE = 'required_customer_document_type',\n EXPIRED_CARD = 'expired_card',\n SANDBOX_ERROR = 'sandbox_error',\n}\n","export const generateIdempotencyKey = () => {\n return `idmp_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n};\n","import { I18nService } from '../i18n/i18n.service';\nimport { PAYMENT_METHOD_ENUM } from '../models/enums/payment-methods.enum';\nimport { PaymentMessageE } from '../models/enums/payment-status.enum';\n\nexport interface AlertErrorKeys {\n alertTitle?: PaymentMessageE;\n message: PaymentMessageE;\n}\n\n//currency country\n\nexport class PaymentErrorMapper {\n static getErrorMessage(\n errorMessageKey: AlertErrorKeys['message'] | null,\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry?: string,\n ): string {\n if (\n !errorMessageKey ||\n !Object.values(PaymentMessageE).includes(errorMessageKey as PaymentMessageE) ||\n errorMessageKey === PaymentMessageE.GENERIC_REJECT\n ) {\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorMessagePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorMessageQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorMessagePSE');\n }\n return I18nService.translate('paymentErrors.genericErrorMessageBankTransfer');\n }\n return I18nService.translate('paymentErrors.genericErrorMessage');\n }\n return PaymentErrorMapper.getMessage(errorMessageKey);\n }\n\n static getErrorTitle(\n paymentMethod: PAYMENT_METHOD_ENUM,\n currencyCountry: string,\n errorTitleKey?: AlertErrorKeys['alertTitle'],\n ): string {\n if (errorTitleKey && !(errorTitleKey in PaymentMessageE)) {\n return PaymentErrorMapper.getMessage(errorTitleKey);\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.CARD) {\n return I18nService.translate('paymentErrors.genericErrorTitleCard');\n }\n if (paymentMethod === PAYMENT_METHOD_ENUM.BANK_TRANSFER) {\n if (currencyCountry === 'BR') {\n return I18nService.translate('paymentErrors.genericErrorTitlePIX');\n }\n if (currencyCountry === 'AR') {\n return I18nService.translate('paymentErrors.genericErrorTitleQR');\n }\n if (currencyCountry === 'CO') {\n return I18nService.translate('paymentErrors.genericErrorTitlePSE');\n }\n }\n return I18nService.translate('paymentErrors.genericErrorTitleBankTransfer');\n }\n\n private static getMessage(errorMessageKey: PaymentMessageE): string {\n const messageMap: Record<PaymentMessageE, string> = {\n [PaymentMessageE.PENDING]: I18nService.translate('paymentErrors.pending'),\n [PaymentMessageE.APPROVED]: I18nService.translate('paymentErrors.approved'),\n [PaymentMessageE.REJECTED]: I18nService.translate('paymentErrors.rejected'),\n [PaymentMessageE.DECLINED]: I18nService.translate('paymentErrors.declined'),\n [PaymentMessageE.ERROR]: I18nService.translate('paymentErrors.error'),\n [PaymentMessageE.REFUNDED]: I18nService.translate('paymentErrors.refunded'),\n [PaymentMessageE.CANCELLED]: I18nService.translate('paymentErrors.cancelled'),\n [PaymentMessageE.PARTIALLY_REFUNDED]: I18nService.translate(\n 'paymentErrors.partiallyRefunded',\n ),\n [PaymentMessageE.EXPIRED]: I18nService.translate('paymentErrors.expired'),\n [PaymentMessageE.GENERIC_REJECT]: I18nService.translate('paymentErrors.genericReject'),\n [PaymentMessageE.INVALID_CARD]: I18nService.translate('paymentErrors.invalidCard'),\n [PaymentMessageE.INVALID_CARD_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCardNumber',\n ),\n [PaymentMessageE.INVALID_CARD_HOLDER_NAME]: I18nService.translate(\n 'paymentErrors.invalidCardHolderName',\n ),\n [PaymentMessageE.INVALID_CARD_EXPIRATION_DATE]: I18nService.translate(\n 'paymentErrors.invalidCardExpirationDate',\n ),\n [PaymentMessageE.INVALID_CARD_CVC]: I18nService.translate('paymentErrors.invalidCardCvc'),\n [PaymentMessageE.INSUFFICIENT_FUNDS]: I18nService.translate(\n 'paymentErrors.insufficientFunds',\n ),\n [PaymentMessageE.BLACKLISTED_CARD]: I18nService.translate('paymentErrors.blacklistedCard'),\n [PaymentMessageE.INVALID_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.invalidCustomerEmail',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.invalidCustomerPhone',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerBillingAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_EMAIL]: I18nService.translate(\n 'paymentErrors.requiredCustomerEmail',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_PHONE]: I18nService.translate(\n 'paymentErrors.requiredCustomerPhone',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_BILLING_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerBillingAddress',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_REQUEST]: I18nService.translate(\n 'paymentErrors.invalidCheckoutRequest',\n ),\n [PaymentMessageE.UNAVAILABLE_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.unavailablePaymentMethod',\n ),\n [PaymentMessageE.INVALID_AMOUNT]: I18nService.translate('paymentErrors.invalidAmount'),\n [PaymentMessageE.INVALID_CURRENCY]: I18nService.translate('paymentErrors.invalidCurrency'),\n [PaymentMessageE.INVALID_COUNTRY]: I18nService.translate('paymentErrors.invalidCountry'),\n [PaymentMessageE.MAX_ATTEMPTS]: I18nService.translate('paymentErrors.maxAttempts'),\n [PaymentMessageE.PAYMENT_EXPIRED]: I18nService.translate('paymentErrors.paymentExpired'),\n\n [PaymentMessageE.INTERNAL_ERROR]: I18nService.translate('paymentErrors.internalError'),\n [PaymentMessageE.INVALID_SESSION]: I18nService.translate('paymentErrors.invalidSession'),\n [PaymentMessageE.APM_MESSAGE_ERROR]: I18nService.translate('paymentErrors.APMMessageError'),\n [PaymentMessageE.APM_ERROR_GENERIC]: I18nService.translate('paymentErrors.APMErrorGeneric'),\n [PaymentMessageE.APM_ERROR_BANK_TRANSFER]: I18nService.translate(\n 'paymentErrors.APMErrorBankTransfer',\n ),\n [PaymentMessageE.PROVIDER_ERROR]: I18nService.translate('paymentErrors.providerError'),\n [PaymentMessageE.BANK_REJECTED]: I18nService.translate('paymentErrors.bankRejected'),\n\n [PaymentMessageE.FRAUD_HIGH_RISK]: I18nService.translate('paymentErrors.fraudHighRisk'),\n [PaymentMessageE.CALL_BANK_FOR_AUTHORIZE]: I18nService.translate(\n 'paymentErrors.callBankForAuthorize',\n ),\n [PaymentMessageE.REQUIRED_3DS]: I18nService.translate('paymentErrors.required3ds'),\n [PaymentMessageE.BLACKLISTED]: I18nService.translate('paymentErrors.blacklisted'),\n [PaymentMessageE.HARD_DECLINE]: I18nService.translate('paymentErrors.hardDecline'),\n [PaymentMessageE.SOFT_DECLINE]: I18nService.translate('paymentErrors.softDecline'),\n [PaymentMessageE.HUMAN_DECLINE]: I18nService.translate('paymentErrors.humanDecline'),\n [PaymentMessageE.INTERNAL]: I18nService.translate('paymentErrors.internal'),\n [PaymentMessageE.INVALID_CARD_TOKENIZE_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCardTokenizeCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.invalidCustomerAddress',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCity',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.invalidCustomerState',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.invalidCustomerZip',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.invalidCustomerCountry',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocument',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentNumber',\n ),\n [PaymentMessageE.INVALID_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.invalidCustomerDocumentType',\n ),\n [PaymentMessageE.INVALID_CHECKOUT_PAYMENT_METHOD]: I18nService.translate(\n 'paymentErrors.invalidCheckoutPaymentMethod',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ADDRESS]: I18nService.translate(\n 'paymentErrors.requiredCustomerAddress',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_CITY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCity',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_STATE]: I18nService.translate(\n 'paymentErrors.requiredCustomerState',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_ZIP]: I18nService.translate(\n 'paymentErrors.requiredCustomerZip',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_COUNTRY]: I18nService.translate(\n 'paymentErrors.requiredCustomerCountry',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocument',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_NUMBER]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentNumber',\n ),\n [PaymentMessageE.REQUIRED_CUSTOMER_DOCUMENT_TYPE]: I18nService.translate(\n 'paymentErrors.requiredCustomerDocumentType',\n ),\n [PaymentMessageE.EXPIRED_CARD]: I18nService.translate('paymentErrors.expiredCard'),\n [PaymentMessageE.SANDBOX_ERROR]: I18nService.translate('paymentErrors.sandboxError'),\n };\n\n return messageMap[errorMessageKey] || I18nService.translate('paymentErrors.genericError');\n }\n}\n","export interface RequiredField {\n name: string;\n values?: {\n code: string;\n name: string;\n }[];\n}\n\nconst requiredFieldsMapper = {\n 'customer.email': 'email',\n 'customer.first_name': 'fullName',\n 'customer.last_name': 'fullName',\n 'customer.identification': 'documentNumber',\n 'customer.identification_type': 'documentType',\n\n 'address.line_one': 'billing-address',\n 'address.line_two': 'billing-address',\n 'address.zip_code': 'billing-zip',\n 'address.state': 'billing-state',\n 'address.city': 'billing-city',\n 'address.country': 'billing-country',\n\n 'phone.number': 'phoneNumber',\n 'phone.country_code': 'countryCodePhoneNumber',\n\n 'bank': 'bankId',\n};\n\nexport const mapRequiredFields = (apiFields: RequiredField[]): string[] => {\n if (!apiFields || !Array.isArray(apiFields)) {\n return [];\n }\n\n const uniqueFields = new Set<string>();\n\n apiFields.forEach(field => {\n const mappedField = requiredFieldsMapper[field.name];\n if (mappedField) {\n uniqueFields.add(mappedField);\n } else {\n uniqueFields.add(field.name);\n }\n });\n\n return Array.from(uniqueFields);\n};\n\nexport const isFieldRequired = (fieldName: string, mappedFields: string[]): boolean => {\n if (!mappedFields || !Array.isArray(mappedFields)) {\n return false;\n }\n return mappedFields.includes(fieldName);\n};\n\nexport const getFieldValues = (\n fieldName: string,\n requiredFields: RequiredField[],\n): Array<{ code: string; name: string }> | null => {\n if (!requiredFields || !Array.isArray(requiredFields)) {\n return null;\n }\n\n const field = requiredFields.find(f => f.name === fieldName);\n return field?.values || null;\n};\n\nexport const hasFieldValues = (fieldName: string, requiredFields: RequiredField[]): boolean => {\n const values = getFieldValues(fieldName, requiredFields);\n return values !== null && values.length > 0;\n};\n\nexport default requiredFieldsMapper;\n"],"names":[],"mappings":";;AAGA;AACY,IAAA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EALW,eAAe,KAAf,eAAe,GAK1B,EAAA,CAAA,CAAA;;ACTW,IAAA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,eAAA,CAAA,OAAA,CAAA,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AAC,IAAI,CAAC;;AAEhC,KAAC,CAAC;AAEF,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;AACjC;MAEa,eAAe,GAAG,CAAC,SAAiB,EAAE,YAAsB,KAAa;IACpF,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AACjD,QAAA,OAAO,KAAK;;AAEd,IAAA,OAAO,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC;AACzC;MAEa,cAAc,GAAG,CAC5B,SAAiB,EACjB,cAA+B,KACiB;IAChD,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;AACrD,QAAA,OAAO,IAAI;;AAGb,IAAA,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AAC5D,IAAA,OAAO,KAAK,EAAE,MAAM,IAAI,IAAI;AAC9B;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-D8cwEAmw.js";import{c as r}from"./p-MMCcKmy_.js";import{a as o}from"./p-CTo1s54i.js";import{m as n,i as a,g as s,C as l,a as c,b as d}from"./p-Bz-GsiI3.js";import{P as h,I as m}from"./p-DrG7nhj2.js";import{P as u,G as p,a as b}from"./p-Dn4NTa9d.js";import{r as f,R as y,o as g}from"./p-BrH4b79B.js";import{B as x,g as w,i as k}from"./p-Do_vNuMa.js";import{C as v}from"./p-DA598vBj.js";import"./p-E-ZsRS8r.js";import"./p-D339jHg4.js";const C=async(e,t,i)=>{const r=await o.checkout.getRequiredFields({currency:e,method:t},i);return{fields:n(r.data),original:r.data}};const q=async()=>{const e=[...new Set(f.data.paymentMethods.map((e=>e.type)))];const t=e.map((async e=>{try{const t=u.mapToAPMPaymentMethod(e,f.data.price.country);const i=await C(f.data.price.currency,t,f.data.organization.id);return{paymentMethod:e,...i}}catch(t){console.error(`Error getting required fields for ${e}:`,t);return{paymentMethod:e,fields:[],original:[]}}}));const i=await Promise.all(t);const r={};i.forEach((e=>{r[e.paymentMethod]={fields:e.fields,original:e.original}}));return r};const D=(e,t)=>{const i=t[e];if(i){return i}else{return{fields:[],original:[]}}};const N=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-primary-dark-light:rgba(0, 17, 49, 0.1);--rebill-color-error:#ef4444;--rebill-color-error-background:#fef2f2;--rebill-color-error-light:rgba(239, 68, 68, 0.1);--rebill-color-error-dark:#6f101b;--rebill-color-background:#ffffff;--rebill-color-background-left:#fafafa;--rebill-color-background-right:#f4f5f6;--rebill-color-background-secondary:#f7f8fa;--rebill-color-border:#ebedef;--rebill-color-timeline-connector:#c4c8cf;--rebill-color-neutrals-700:#58616e;--rebill-color-neutrals-500:#9ca3af;--rebill-color-border-primary:#e4e4e7;--rebill-color-text-primary:#3b4049;--rebill-color-text-secondary:#6b7280;--rebill-color-grey-700:#7d7d7d;--rebill-color-text-secondary-light:#a1a1aa;--rebill-color-text-on-primary:#ffffff;--rebill-color-disabled:#9ca3af;--rebill-color-shadow:rgba(0, 0, 0, 0.1);--rebill-color-green:#10b981;--rebill-color-green-text:#257c67;--rebill-color-green-light:rgba(183, 233, 221, 0.15);--rebill-color-green-light-2:rgba(183, 233, 221, 1);--rebill-color-info-background:#d5e4ff;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-background-secondary-light:#f7f8fa;--rebill-breakpoint-mobile:768px;--rebill-breakpoint-tablet:1024px;--rebill-breakpoint-desktop:1025px;--rebill-color-orange:#ff9400;--rebill-color-black:#1e2025;--rebill-color-grey-300:#3b4049;--rebill-color-grey-100:#aeaeae}.qr-container,.qr-image,.qr-image svg,.qr-image img,[class*='qr-'],[class*='success'],[class*='receipt']{transition:none !important;animation:none !important;will-change:auto !important}button:active,button:focus,button:hover{isolation:isolate}@media (max-width: 1024px){.rebill-checkout-renewal{flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%;margin-top:24px}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}}@media (min-width: 1025px){.rebill-checkout-renewal{width:100vw;min-height:100vh;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;margin-top:24px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const j=class{constructor(i){e(this,i);this.success=t(this,"success");this.paymentError=t(this,"paymentError");this.paymentMethodSelected=t(this,"paymentMethodSelected")}renewalData;renewalToken;currentPaymentMethod=h.CARD;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;errorMessage=null;breakpoint=x.DESKTOP;errorPaymentCard=false;errorPaymentAPM=false;initialData={};checkoutResponse=null;currentApmPaymentMethod=null;countries=[];allRequiredFields={};currentRequiredFields=[];errorCardInvalid=false;cardMode="select";success;paymentError;paymentMethodSelected;validationSchema={phoneNumber:r().when([],{is:()=>a("phoneNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.phoneRequired"),otherwise:e=>e.notRequired()}),"billing-country":r().when([],{is:()=>a("billing-country",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.countryRequired"),otherwise:e=>e.notRequired()}),"billing-state":r().when([],{is:()=>a("billing-state",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.stateRequired"),otherwise:e=>e.notRequired()}),"billing-address":r().when([],{is:()=>a("billing-address",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.addressRequired"),otherwise:e=>e.notRequired()}),"billing-city":r().when([],{is:()=>a("billing-city",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.cityRequired"),otherwise:e=>e.notRequired()}),"billing-zip":r().when([],{is:()=>a("billing-zip",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.zipRequired"),otherwise:e=>e.notRequired()}),bankId:r().when([],{is:()=>a("bankId",this.currentRequiredFields),then:e=>e.required("validation.bankRequired"),otherwise:e=>e.notRequired()}),documentType:r().when([],{is:()=>a("documentType",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentTypeRequired"),otherwise:e=>e.notRequired()}),documentNumber:r().when([],{is:()=>a("documentNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentNumberRequired").min(7,"validation.documentInvalid"),otherwise:e=>e.notRequired()})};resizeHandler=()=>{this.breakpoint=w(window.innerWidth)};async componentWillLoad(){this.resizeHandler();window.addEventListener("resize",this.resizeHandler);const e=typeof this.renewalData==="string"?JSON.parse(this.renewalData):this.renewalData;y.initializeRenewal({...e,token:this.renewalToken});p.loadGoogleMapsScript();try{const e=await o.data.getCountries();this.countries=e.data}catch(e){console.error("Error loading countries:",e)}try{this.allRequiredFields=await q()}catch(e){console.error("Error loading required fields:",e)}if(f.data.paymentMethods.length>0){const e=f.data.paymentMethods[0].type;this.currentPaymentMethod=e;y.setSelectedPaymentMethod(e);try{this.currentRequiredFields=D(e,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(e)}this.initialData=this.getInitialData();this.cardMode=f.cardMode;g("cardMode",(()=>{this.cardMode=f.cardMode}))}disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler)}async handlePaymentMethodSelected(e){e.stopPropagation();if(this.currentPaymentMethod===e.detail){return}this.currentPaymentMethod=e.detail;y.setSelectedPaymentMethod(this.currentPaymentMethod);if(this.currentPaymentMethod!==h.CARD){this.cardMode="input";y.setCardMode("input")}try{this.currentRequiredFields=D(this.currentPaymentMethod,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(this.currentPaymentMethod);this.paymentMethodSelected.emit(e.detail)}async initializeFingerprint(e){if(e===h.CARD&&!f.deviceId){try{const e=crypto.randomUUID();const t=await o.fingerPrint.getFingerPrint(e);y.setDeviceId(e);const i=t.result.script;const r=document.createElement("script");r.innerHTML=i;document.body.appendChild(r)}catch(e){console.error("Failed to initialize fingerprint:",e)}}}handleBankSelected(e){e.stopPropagation();y.setSelectedBankId(e.detail)}handleCardSelected(e){const{card:t,cvv:i}=e.detail;y.setSelectedCard(t);y.setCvv(i||"")}get currentPaymentError(){if(this.currentPaymentMethod===h.CARD){return this.errorPaymentCard}else if(this.currentPaymentMethod===h.CASH||this.currentPaymentMethod===h.BANK_TRANSFER){return this.errorPaymentAPM}return false}async handleSubmit(e){if(this.isSubmitting){return}if(this.currentPaymentMethod===h.CARD){await this.handleCardRenewal(e)}else{await this.handleAPMRenewal(e)}}async handleCardRenewal(e){const t=e?.detail||this.getInitialData();if(!f.data.cardId&&!f.data.cardTokenId){this.errorCardInvalid=true;return}if(!f.data.cardInformation&&!f.data.cardId){this.errorCardInvalid=true;return}this.errorCardInvalid=false;this.isSubmitting=true;this.isCardSubmitting=true;y.setLoading(true);try{const e={transaction:{quantity:1},...f.data.cardId&&{cardId:f.data.cardId},...f.data.cardTokenId&&{cardTokenId:f.data.cardTokenId},customAttributes:{...f.deviceId&&{deviceId:f.deviceId}},...this.cardMode==="input"&&{customer:{firstName:t.fullName?.split(" ")[0]||f.data.subscription.customerName?.split(" ")[0],lastName:t.fullName?.split(" ").slice(1).join(" ")||f.data.subscription.customerName?.split(" ").slice(1).join(" "),email:t.email||f.data.subscription.customerEmail,phone:{countryCode:t.countryCodePhoneNumber||"",number:t.phoneNumber||""}},billingDetails:{address:{lineOne:t["billing-address"]||"",city:t["billing-city"]||"",state:t["billing-state"]||"",country:t["billing-country"]||"",zipCode:t["billing-zip"]||""},identification:{type:t.documentType||"",value:t.documentNumber||""}}}};const i=s();const r=await o.checkout.createCardCheckoutRequest(f.data.id,i,e,f.token);this.isSubmitting=false;this.isCardSubmitting=false;y.setLoading(false);y.setCheckoutResponse(r.data);if(r.data.result?.status.toUpperCase()===l.APPROVED){this.isCardSuccess=true}else{this.isCardSuccess=false;this.errorPaymentCard=true;this.errorMessage={message:r.data.error?.error?.message}}}catch(e){this.isSubmitting=false;this.isCardSubmitting=false;y.setLoading(false);this.errorPaymentCard=true;this.errorMessage={message:e.data?.error?.message}}}async handleAPMRenewal(e){this.isSubmitting=true;y.setLoading(true);try{const t=u.mapToAPMPaymentMethod(this.currentPaymentMethod,f.data.price.country);const i=e?.detail||this.getFormData();const r={address:{country:i["billing-country"],state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||""},identification:{type:i.documentType||"dni",value:i.documentNumber||""}};const n={transaction:{quantity:1},method:t,billingDetails:r,redirect:{approved:window.location.origin+"/renewal/success",rejected:window.location.origin+"/renewal/failure"},paymentMetadata:{orderId:f.data.id,source:"renewal-web"},customAttributes:{bank:i.bankId||""},...t!==b.CO_TRANSFERENCE_PSE&&{targetCurrency:f.data.price.currency}};n.customer={firstName:i.fullName?.split(" ")[0]||f.data.subscription.customerName.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||f.data.subscription.customerName.split(" ").slice(1).join(" ")||"",email:i.email||f.data.subscription.customerEmail,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}};const a=s();const c=await o.checkout.createAPMCheckoutRequest(f.data.id,a,n);this.isSubmitting=false;y.setLoading(false);y.setCheckoutResponse(c.data);this.checkoutResponse=c.data;if(c.data.result?.status.toUpperCase()===l.APPROVED){this.isCardSuccess=true}else{this.paymentError.emit(c.data);y.setCheckoutResponse(c.data);this.errorPaymentAPM=true;this.errorMessage={alertTitle:c.data?.error?.message,message:c.data.error?.message}}}catch(e){this.isSubmitting=false;y.setLoading(false);this.paymentError.emit(e);this.errorPaymentAPM=true;this.errorMessage={alertTitle:e.data?.error?.message,message:e.data?.error?.message}}}getFormData=()=>this.initialData;getInitialData=()=>({email:f.data.subscription.customerEmail,fullName:f.data.subscription.customerName,card:"","billing-country":"","billing-state":"","billing-address":"","billing-city":"","billing-zip":"",bankId:"",phoneNumber:"",countryCodePhoneNumber:"",documentType:"",documentNumber:""});hasPrefilledAddress=()=>{const e=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return e.some((e=>{const t=this.initialData[e];return t&&t.trim()!==""}))};getPaymentDate=()=>{const e=f.form.checkoutResponse;if(!e)return"";if("date"in e){return e.date}return""};getReferenceNumber=()=>{const e=f.form.checkoutResponse;if(!e)return"";if("traceId"in e){return e.traceId}return""};render(){if(!f.isInitialized){return i("div",{class:"loading"},m.translate("renewal.loading"))}const e=e=>i("renewal-summary",{totalAmount:f.data.price.amount,currency:f.data.price.currency,subscriptionTitle:f.data.subscription.name[0]?.text||"Subscription",subscriptionAmount:f.data.subscription.amount,nextChargeDate:f.data.subscription.nextChargeDate,frequency:f.data.subscription.frequency,...e});return i(i.Fragment,null,i("rebill-processing-payment",{style:{display:this.isCardSubmitting?"block":"none"}}),this.isCardSuccess?i("renewal-success-page",{typePaymentMethod:this.currentPaymentMethod,paymentDate:this.getPaymentDate(),referenceNumber:this.getReferenceNumber(),cardLastFour:f.data.subscription.cardLastFour,country:f.data.price.country,paymentMethodName:u.mapToAPMPaymentMethod(this.currentPaymentMethod,f.data?.price?.country),bank:f.form?.selectedBankId||""}):i("rebill-checkout-form",{style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e),renderForm:({submit:t,formData:r,errors:o})=>i("div",{class:"rebill-checkout-renewal"},i("div",{class:"left-section"},i("div",{class:"left-section-container"},i("organization-logo",{organization:f.data.organization}),i("div",{class:"checkout-form-section"},i("user-information-static",{userInfo:{customerName:f.data.subscription.customerName,customerEmail:f.data.subscription.customerEmail}}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"header"}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"details"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"32px"}},i("payment-method-selector",{enabledPaymentMethods:[...new Set(f.data.paymentMethods.map((e=>e.type)))],defaultSelected:this.currentPaymentMethod,errorComponent:{showErrorComponent:this.currentPaymentError,alertTitle:c.getErrorTitle(this.currentPaymentMethod,f.data.price.country,this.errorMessage?.alertTitle),message:c.getErrorMessage(this.errorMessage?.message,this.currentPaymentMethod,f.data.price.country)},cardError:{showCardInvalid:this.errorCardInvalid,type:null},country:f.data.price.country,documentTypeError:o?.documentType,documentNumberError:o?.documentNumber,showDocument:this.cardMode==="input"&&(a("documentType",this.currentRequiredFields)||a("documentNumber",this.currentRequiredFields))}),this.currentPaymentMethod!==h.CARD&&i("rebill-alert",{type:"info",message:m.translate("renewal.paymentMethodAlert",{cardLastFour:f.data.subscription.cardLastFour||"****"}),icon:"calendar-edit",variant:"outlined",colorIcon:v.PRIMARY}),this.cardMode==="input"&&a("bankId",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:d("bank",this.allRequiredFields[this.currentPaymentMethod]?.original)||[],defaultSelectedBankId:r.bankId||"",error:o?.bankId}))),this.cardMode==="input"&&(a("billing-country",this.currentRequiredFields)||a("billing-state",this.currentRequiredFields)||a("billing-address",this.currentRequiredFields)||a("billing-city",this.currentRequiredFields)||a("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{countryOptions:this.countries.map((e=>({label:e.country,value:e.isoCountryCode}))),billingView:this.hasPrefilledAddress()?"form":"search",errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.cardMode==="input"&&a("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{error:o?.phoneNumber})),this.checkoutResponse?.result&&(this.currentPaymentMethod===h.CASH||this.currentPaymentMethod===h.BANK_TRANSFER)&&i("apm-checkout",{paymentMethod:this.currentPaymentMethod,referenceId:this.currentPaymentMethod===h.CASH?this.checkoutResponse.result.data.referenceId:undefined,qrCodeData:this.currentPaymentMethod===h.BANK_TRANSFER?this.checkoutResponse.result.data.qrCode:undefined,providerName:f.data.organization?.name||"",expirationDate:(()=>{const e=new Date;e.setDate(e.getDate()+30);return e.toISOString()})(),country:f.data.price.country,redirectUrl:this.checkoutResponse.result.data.url}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"summary"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,isRenewal:true,trialPeriodDays:f.data.subscription.trialPeriodDays,redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:5e3,country:f.data.price.country,isDisabled:f.fetchingInstallments,onSubmit:()=>t()}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:m.translate("otp.secureMessage")}))),i("rebill-footer",{style:{marginTop:k(this.breakpoint,x.DESKTOP)?"24px":"auto"}}))),!k(this.breakpoint,x.DESKTOP)&&i("div",{class:"right-section"},i("div",{class:"checkout-summary-section"},e({displayedComponents:["header","details","summary"]}))))}))}};j.style=N;export{j as rebill_renewal};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-D8cwEAmw.js";import{c as r}from"./p-MMCcKmy_.js";import{a as o}from"./p-CTo1s54i.js";import{m as n,i as a,g as s,C as l,a as c,b as d}from"./p-BP5Qpv7O.js";import{P as h,I as m}from"./p-DrG7nhj2.js";import{P as u,G as p,a as b}from"./p-Dn4NTa9d.js";import{r as f,R as y,o as g}from"./p-BrH4b79B.js";import{B as x,g as w,i as k}from"./p-Do_vNuMa.js";import{C as v}from"./p-DA598vBj.js";import"./p-E-ZsRS8r.js";import"./p-D339jHg4.js";const C=async(e,t,i)=>{const r=await o.checkout.getRequiredFields({currency:e,method:t},i);return{fields:n(r.data),original:r.data}};const q=async()=>{const e=[...new Set(f.data.paymentMethods.map((e=>e.type)))];const t=e.map((async e=>{try{const t=u.mapToAPMPaymentMethod(e,f.data.price.country);const i=await C(f.data.price.currency,t,f.data.organization.id);return{paymentMethod:e,...i}}catch(t){console.error(`Error getting required fields for ${e}:`,t);return{paymentMethod:e,fields:[],original:[]}}}));const i=await Promise.all(t);const r={};i.forEach((e=>{r[e.paymentMethod]={fields:e.fields,original:e.original}}));return r};const D=(e,t)=>{const i=t[e];if(i){return i}else{return{fields:[],original:[]}}};const N=":root{--rebill-color-primary:#3b82f6;--rebill-color-primary-light:rgba(59, 130, 246, 0.1);--rebill-color-primary-hover:#2563eb;--rebill-color-primary-dark:#001131;--rebill-color-primary-dark-text:#000000;--rebill-color-primary-dark-hover:#001c4a;--rebill-color-primary-dark-light:rgba(0, 17, 49, 0.1);--rebill-color-error:#ef4444;--rebill-color-error-background:#fef2f2;--rebill-color-error-light:rgba(239, 68, 68, 0.1);--rebill-color-error-dark:#6f101b;--rebill-color-background:#ffffff;--rebill-color-background-left:#fafafa;--rebill-color-background-right:#f4f5f6;--rebill-color-background-secondary:#f7f8fa;--rebill-color-border:#ebedef;--rebill-color-timeline-connector:#c4c8cf;--rebill-color-neutrals-700:#58616e;--rebill-color-neutrals-500:#9ca3af;--rebill-color-border-primary:#e4e4e7;--rebill-color-text-primary:#3b4049;--rebill-color-text-secondary:#6b7280;--rebill-color-grey-700:#7d7d7d;--rebill-color-text-secondary-light:#a1a1aa;--rebill-color-text-on-primary:#ffffff;--rebill-color-disabled:#9ca3af;--rebill-color-shadow:rgba(0, 0, 0, 0.1);--rebill-color-green:#10b981;--rebill-color-green-text:#257c67;--rebill-color-green-light:rgba(183, 233, 221, 0.15);--rebill-color-green-light-2:rgba(183, 233, 221, 1);--rebill-color-info-background:#d5e4ff;--rebill-color-info-border:#0156f6;--rebill-color-info-text:#172b85;--rebill-color-background-secondary-light:#f7f8fa;--rebill-breakpoint-mobile:768px;--rebill-breakpoint-tablet:1024px;--rebill-breakpoint-desktop:1025px;--rebill-color-orange:#ff9400;--rebill-color-black:#1e2025;--rebill-color-grey-300:#3b4049;--rebill-color-grey-100:#aeaeae}.qr-container,.qr-image,.qr-image svg,.qr-image img,[class*='qr-'],[class*='success'],[class*='receipt']{transition:none !important;animation:none !important;will-change:auto !important}button:active,button:focus,button:hover{isolation:isolate}@media (max-width: 1024px){.rebill-checkout-renewal{flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%;margin-top:24px}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}}@media (min-width: 1025px){.rebill-checkout-renewal{width:100vw;min-height:100vh;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;margin-top:24px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const j=class{constructor(i){e(this,i);this.success=t(this,"success");this.paymentError=t(this,"paymentError");this.paymentMethodSelected=t(this,"paymentMethodSelected")}renewalData;renewalToken;currentPaymentMethod=h.CARD;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;errorMessage=null;breakpoint=x.DESKTOP;errorPaymentCard=false;errorPaymentAPM=false;initialData={};checkoutResponse=null;currentApmPaymentMethod=null;countries=[];allRequiredFields={};currentRequiredFields=[];errorCardInvalid=false;cardMode="select";success;paymentError;paymentMethodSelected;validationSchema={phoneNumber:r().when([],{is:()=>a("phoneNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.phoneRequired"),otherwise:e=>e.notRequired()}),"billing-country":r().when([],{is:()=>a("billing-country",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.countryRequired"),otherwise:e=>e.notRequired()}),"billing-state":r().when([],{is:()=>a("billing-state",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.stateRequired"),otherwise:e=>e.notRequired()}),"billing-address":r().when([],{is:()=>a("billing-address",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.addressRequired"),otherwise:e=>e.notRequired()}),"billing-city":r().when([],{is:()=>a("billing-city",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.cityRequired"),otherwise:e=>e.notRequired()}),"billing-zip":r().when([],{is:()=>a("billing-zip",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.zipRequired"),otherwise:e=>e.notRequired()}),bankId:r().when([],{is:()=>a("bankId",this.currentRequiredFields),then:e=>e.required("validation.bankRequired"),otherwise:e=>e.notRequired()}),documentType:r().when([],{is:()=>a("documentType",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentTypeRequired"),otherwise:e=>e.notRequired()}),documentNumber:r().when([],{is:()=>a("documentNumber",this.currentRequiredFields)&&this.cardMode==="input",then:e=>e.required("validation.documentNumberRequired").min(7,"validation.documentInvalid"),otherwise:e=>e.notRequired()})};resizeHandler=()=>{this.breakpoint=w(window.innerWidth)};async componentWillLoad(){this.resizeHandler();window.addEventListener("resize",this.resizeHandler);const e=typeof this.renewalData==="string"?JSON.parse(this.renewalData):this.renewalData;y.initializeRenewal({...e,token:this.renewalToken});p.loadGoogleMapsScript();try{const e=await o.data.getCountries();this.countries=e.data}catch(e){console.error("Error loading countries:",e)}try{this.allRequiredFields=await q()}catch(e){console.error("Error loading required fields:",e)}if(f.data.paymentMethods.length>0){const e=f.data.paymentMethods[0].type;this.currentPaymentMethod=e;y.setSelectedPaymentMethod(e);try{this.currentRequiredFields=D(e,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(e)}this.initialData=this.getInitialData();this.cardMode=f.cardMode;g("cardMode",(()=>{this.cardMode=f.cardMode}))}disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler)}async handlePaymentMethodSelected(e){e.stopPropagation();if(this.currentPaymentMethod===e.detail){return}this.currentPaymentMethod=e.detail;y.setSelectedPaymentMethod(this.currentPaymentMethod);if(this.currentPaymentMethod!==h.CARD){this.cardMode="input";y.setCardMode("input")}try{this.currentRequiredFields=D(this.currentPaymentMethod,this.allRequiredFields).fields}catch(e){console.error("Error getting required fields for method:",e)}await this.initializeFingerprint(this.currentPaymentMethod);this.paymentMethodSelected.emit(e.detail)}async initializeFingerprint(e){if(e===h.CARD&&!f.deviceId){try{const e=crypto.randomUUID();const t=await o.fingerPrint.getFingerPrint(e);y.setDeviceId(e);const i=t.result.script;const r=document.createElement("script");r.innerHTML=i;document.body.appendChild(r)}catch(e){console.error("Failed to initialize fingerprint:",e)}}}handleBankSelected(e){e.stopPropagation();y.setSelectedBankId(e.detail)}handleCardSelected(e){const{card:t,cvv:i}=e.detail;y.setSelectedCard(t);y.setCvv(i||"")}get currentPaymentError(){if(this.currentPaymentMethod===h.CARD){return this.errorPaymentCard}else if(this.currentPaymentMethod===h.CASH||this.currentPaymentMethod===h.BANK_TRANSFER){return this.errorPaymentAPM}return false}async handleSubmit(e){if(this.isSubmitting){return}if(this.currentPaymentMethod===h.CARD){await this.handleCardRenewal(e)}else{await this.handleAPMRenewal(e)}}async handleCardRenewal(e){const t=e?.detail||this.getInitialData();if(!f.data.cardId&&!f.data.cardTokenId){this.errorCardInvalid=true;return}if(!f.data.cardInformation&&!f.data.cardId){this.errorCardInvalid=true;return}this.errorCardInvalid=false;this.isSubmitting=true;this.isCardSubmitting=true;y.setLoading(true);try{const e={transaction:{quantity:1},...f.data.cardId&&{cardId:f.data.cardId},...f.data.cardTokenId&&{cardTokenId:f.data.cardTokenId},customAttributes:{...f.deviceId&&{deviceId:f.deviceId}},...this.cardMode==="input"&&{customer:{firstName:t.fullName?.split(" ")[0]||f.data.subscription.customerName?.split(" ")[0],lastName:t.fullName?.split(" ").slice(1).join(" ")||f.data.subscription.customerName?.split(" ").slice(1).join(" "),email:t.email||f.data.subscription.customerEmail,phone:{countryCode:t.countryCodePhoneNumber||"",number:t.phoneNumber||""}},billingDetails:{address:{lineOne:t["billing-address"]||"",city:t["billing-city"]||"",state:t["billing-state"]||"",country:t["billing-country"]||"",zipCode:t["billing-zip"]||""},identification:{type:t.documentType||"",value:t.documentNumber||""}}}};const i=s();const r=await o.checkout.createCardCheckoutRequest(f.data.id,i,e,f.token);this.isSubmitting=false;this.isCardSubmitting=false;y.setLoading(false);y.setCheckoutResponse(r.data);if(r.data.result?.status.toUpperCase()===l.APPROVED){this.isCardSuccess=true}else{this.isCardSuccess=false;this.errorPaymentCard=true;this.errorMessage={message:r.data.error?.error?.message}}}catch(e){this.isSubmitting=false;this.isCardSubmitting=false;y.setLoading(false);this.errorPaymentCard=true;this.errorMessage={message:e.data?.error?.message}}}async handleAPMRenewal(e){this.isSubmitting=true;y.setLoading(true);try{const t=u.mapToAPMPaymentMethod(this.currentPaymentMethod,f.data.price.country);const i=e?.detail||this.getFormData();const r={address:{country:i["billing-country"],state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||""},identification:{type:i.documentType||"dni",value:i.documentNumber||""}};const n={transaction:{quantity:1},method:t,billingDetails:r,redirect:{approved:window.location.origin+"/renewal/success",rejected:window.location.origin+"/renewal/failure"},paymentMetadata:{orderId:f.data.id,source:"renewal-web"},customAttributes:{bank:i.bankId||""},...t!==b.CO_TRANSFERENCE_PSE&&{targetCurrency:f.data.price.currency}};n.customer={firstName:i.fullName?.split(" ")[0]||f.data.subscription.customerName.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||f.data.subscription.customerName.split(" ").slice(1).join(" ")||"",email:i.email||f.data.subscription.customerEmail,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}};const a=s();const c=await o.checkout.createAPMCheckoutRequest(f.data.id,a,n);this.isSubmitting=false;y.setLoading(false);y.setCheckoutResponse(c.data);this.checkoutResponse=c.data;if(c.data.result?.status.toUpperCase()===l.APPROVED){this.isCardSuccess=true}else{this.paymentError.emit(c.data);y.setCheckoutResponse(c.data);this.errorPaymentAPM=true;this.errorMessage={alertTitle:c.data?.error?.message,message:c.data.error?.message}}}catch(e){this.isSubmitting=false;y.setLoading(false);this.paymentError.emit(e);this.errorPaymentAPM=true;this.errorMessage={alertTitle:e.data?.error?.message,message:e.data?.error?.message}}}getFormData=()=>this.initialData;getInitialData=()=>({email:f.data.subscription.customerEmail,fullName:f.data.subscription.customerName,card:"","billing-country":"","billing-state":"","billing-address":"","billing-city":"","billing-zip":"",bankId:"",phoneNumber:"",countryCodePhoneNumber:"",documentType:"",documentNumber:""});hasPrefilledAddress=()=>{const e=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return e.some((e=>{const t=this.initialData[e];return t&&t.trim()!==""}))};getPaymentDate=()=>{const e=f.form.checkoutResponse;if(!e)return"";if("date"in e){return e.date}return""};getReferenceNumber=()=>{const e=f.form.checkoutResponse;if(!e)return"";if("traceId"in e){return e.traceId}return""};render(){if(!f.isInitialized){return i("div",{class:"loading"},m.translate("renewal.loading"))}const e=e=>i("renewal-summary",{totalAmount:f.data.price.amount,currency:f.data.price.currency,subscriptionTitle:f.data.subscription.name[0]?.text||"Subscription",subscriptionAmount:f.data.subscription.amount,nextChargeDate:f.data.subscription.nextChargeDate,frequency:f.data.subscription.frequency,...e});return i(i.Fragment,null,i("rebill-processing-payment",{style:{display:this.isCardSubmitting?"block":"none"}}),this.isCardSuccess?i("renewal-success-page",{typePaymentMethod:this.currentPaymentMethod,paymentDate:this.getPaymentDate(),referenceNumber:this.getReferenceNumber(),cardLastFour:f.data.subscription.cardLastFour,country:f.data.price.country,paymentMethodName:u.mapToAPMPaymentMethod(this.currentPaymentMethod,f.data?.price?.country),bank:f.form?.selectedBankId||""}):i("rebill-checkout-form",{style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:e=>this.handleSubmit(e),renderForm:({submit:t,formData:r,errors:o})=>i("div",{class:"rebill-checkout-renewal"},i("div",{class:"left-section"},i("div",{class:"left-section-container"},i("organization-logo",{organization:f.data.organization}),i("div",{class:"checkout-form-section"},i("user-information-static",{userInfo:{customerName:f.data.subscription.customerName,customerEmail:f.data.subscription.customerEmail}}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"header"}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"details"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"32px"}},i("payment-method-selector",{enabledPaymentMethods:[...new Set(f.data.paymentMethods.map((e=>e.type)))],defaultSelected:this.currentPaymentMethod,errorComponent:{showErrorComponent:this.currentPaymentError,alertTitle:c.getErrorTitle(this.currentPaymentMethod,f.data.price.country,this.errorMessage?.alertTitle),message:c.getErrorMessage(this.errorMessage?.message,this.currentPaymentMethod,f.data.price.country)},cardError:{showCardInvalid:this.errorCardInvalid,type:null},country:f.data.price.country,documentTypeError:o?.documentType,documentNumberError:o?.documentNumber,showDocument:this.cardMode==="input"&&(a("documentType",this.currentRequiredFields)||a("documentNumber",this.currentRequiredFields))}),this.currentPaymentMethod!==h.CARD&&i("rebill-alert",{type:"info",message:m.translate("renewal.paymentMethodAlert",{cardLastFour:f.data.subscription.cardLastFour||"****"}),icon:"calendar-edit",variant:"outlined",colorIcon:v.PRIMARY}),this.cardMode==="input"&&a("bankId",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:d("bank",this.allRequiredFields[this.currentPaymentMethod]?.original)||[],defaultSelectedBankId:r.bankId||"",error:o?.bankId}))),this.cardMode==="input"&&(a("billing-country",this.currentRequiredFields)||a("billing-state",this.currentRequiredFields)||a("billing-address",this.currentRequiredFields)||a("billing-city",this.currentRequiredFields)||a("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{countryOptions:this.countries.map((e=>({label:e.country,value:e.isoCountryCode}))),billingView:this.hasPrefilledAddress()?"form":"search",errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.cardMode==="input"&&a("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{error:o?.phoneNumber})),this.checkoutResponse?.result&&(this.currentPaymentMethod===h.CASH||this.currentPaymentMethod===h.BANK_TRANSFER)&&i("apm-checkout",{paymentMethod:this.currentPaymentMethod,referenceId:this.currentPaymentMethod===h.CASH?this.checkoutResponse.result.data.referenceId:undefined,qrCodeData:this.currentPaymentMethod===h.BANK_TRANSFER?this.checkoutResponse.result.data.qrCode:undefined,providerName:f.data.organization?.name||"",expirationDate:(()=>{const e=new Date;e.setDate(e.getDate()+30);return e.toISOString()})(),country:f.data.price.country,redirectUrl:this.checkoutResponse.result.data.url}),k(this.breakpoint,x.DESKTOP)&&e({displayedComponents:"summary"}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,isRenewal:true,trialPeriodDays:f.data.subscription.trialPeriodDays,redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:5e3,country:f.data.price.country,isDisabled:f.fetchingInstallments,onSubmit:()=>t()}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:m.translate("otp.secureMessage")}))),i("rebill-footer",{style:{marginTop:k(this.breakpoint,x.DESKTOP)?"24px":"auto"}}))),!k(this.breakpoint,x.DESKTOP)&&i("div",{class:"right-section"},i("div",{class:"checkout-summary-section"},e({displayedComponents:["header","details","summary"]}))))}))}};j.style=N;export{j as rebill_renewal};
|
|
2
|
+
//# sourceMappingURL=p-4a8ad442.entry.js.map
|