@one-payments/web-components 1.7.3 → 1.7.5
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/index.js +564 -501
- package/dist/one-payment.d.ts +3 -21
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +99 -42
- package/dist/one-payment.js.map +1 -1
- package/package.json +1 -1
package/dist/one-payment.d.ts
CHANGED
|
@@ -249,26 +249,6 @@ export declare class OnePayment extends LitElement {
|
|
|
249
249
|
* @public
|
|
250
250
|
*/
|
|
251
251
|
email: string;
|
|
252
|
-
/**
|
|
253
|
-
* Customer's phone number (REQUIRED)
|
|
254
|
-
*
|
|
255
|
-
* The payer's phone number. This field is required for all payment methods
|
|
256
|
-
* and is used for:
|
|
257
|
-
* - Payment verification
|
|
258
|
-
* - Transaction notifications via SMS
|
|
259
|
-
* - Customer communication
|
|
260
|
-
* - Fraud prevention
|
|
261
|
-
*
|
|
262
|
-
* **Validation:**
|
|
263
|
-
* - Cannot be empty or whitespace-only
|
|
264
|
-
* - Must be provided before payment submission
|
|
265
|
-
* - Should include country code (e.g., '+65' for Singapore, '+60' for Malaysia)
|
|
266
|
-
*
|
|
267
|
-
* @required
|
|
268
|
-
* @type {string}
|
|
269
|
-
* @public
|
|
270
|
-
*/
|
|
271
|
-
phoneNumber: string;
|
|
272
252
|
/**
|
|
273
253
|
* Optional array of payment method IDs to exclude from display
|
|
274
254
|
*
|
|
@@ -424,7 +404,7 @@ export declare class OnePayment extends LitElement {
|
|
|
424
404
|
private requiresPhoneNumber;
|
|
425
405
|
/**
|
|
426
406
|
* Check if phone number is available for payment
|
|
427
|
-
* Returns true if
|
|
407
|
+
* Returns true if the user has entered a valid number in the input field
|
|
428
408
|
*/
|
|
429
409
|
private hasPhoneNumber;
|
|
430
410
|
/**
|
|
@@ -514,6 +494,7 @@ export declare class OnePayment extends LitElement {
|
|
|
514
494
|
private handlePayEasyPayment;
|
|
515
495
|
private handleGrabPaySGPayment;
|
|
516
496
|
private handleFPXPayment;
|
|
497
|
+
private handleWeChatPayPayment;
|
|
517
498
|
/**
|
|
518
499
|
* Fetch available banks for a payment method
|
|
519
500
|
*/
|
|
@@ -625,6 +606,7 @@ export declare class OnePayment extends LitElement {
|
|
|
625
606
|
private renderPayEasyContent;
|
|
626
607
|
private renderGrabPaySGContent;
|
|
627
608
|
private renderFPXContent;
|
|
609
|
+
private renderWeChatPayContent;
|
|
628
610
|
private render3DSModal;
|
|
629
611
|
private renderStatusBlock;
|
|
630
612
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"one-payment.d.ts","sourceRoot":"","sources":["../src/one-payment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,eAAe,EAGf,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"one-payment.d.ts","sourceRoot":"","sources":["../src/one-payment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,eAAe,EAGf,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAiC5B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,WAAW,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,eAAe,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,cAAc,EAAE,WAAW,CAAC;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CAC/C;AAiBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa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a,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/one-payment.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { __decorate } from "tslib";
|
|
6
6
|
import { LitElement, html, css } from 'lit';
|
|
7
7
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
|
-
import { PaymentSDK, PAYMENT_METHODS, PAYNOW_ICON_DATA_URL, PROMPTPAY_ICON_DATA_URL, DUITNOW_ICON_DATA_URL, GOPAY_ICON_DATA_URL, BOOST_ICON_DATA_URL, SHOPEEPAY_ICON_DATA_URL, ATOM_ICON_DATA_URL, DANA_ICON_DATA_URL, TNG_ICON_DATA_URL, ALIPAYCN_ICON_DATA_URL, ALIPAYHK_ICON_DATA_URL, GCASH_ICON_DATA_URL, KONBINI_ICON_DATA_URL, PAYEASY_ICON_DATA_URL, GRABPAY_ICON_DATA_URL, FPX_ICON_DATA_URL, } from '@one-payments/core';
|
|
8
|
+
import { PaymentSDK, PAYMENT_METHODS, PAYNOW_ICON_DATA_URL, PROMPTPAY_ICON_DATA_URL, DUITNOW_ICON_DATA_URL, GOPAY_ICON_DATA_URL, BOOST_ICON_DATA_URL, SHOPEEPAY_ICON_DATA_URL, ATOM_ICON_DATA_URL, DANA_ICON_DATA_URL, TNG_ICON_DATA_URL, ALIPAYCN_ICON_DATA_URL, ALIPAYHK_ICON_DATA_URL, GCASH_ICON_DATA_URL, KONBINI_ICON_DATA_URL, PAYEASY_ICON_DATA_URL, GRABPAY_ICON_DATA_URL, FPX_ICON_DATA_URL, WECHATPAY_ICON_DATA_URL, } from '@one-payments/core';
|
|
9
9
|
import CleaveConstructor from 'cleave.js';
|
|
10
10
|
import QRCode from 'qrcode';
|
|
11
11
|
import { AsYouType, isValidPhoneNumber, parsePhoneNumber, } from 'libphonenumber-js';
|
|
@@ -182,11 +182,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
182
182
|
if (!this.email || typeof this.email !== 'string' || this.email.trim() === '') {
|
|
183
183
|
return false;
|
|
184
184
|
}
|
|
185
|
-
if (!this.phoneNumber ||
|
|
186
|
-
typeof this.phoneNumber !== 'string' ||
|
|
187
|
-
this.phoneNumber.trim() === '') {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
185
|
return true;
|
|
191
186
|
}
|
|
192
187
|
/**
|
|
@@ -205,23 +200,15 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
205
200
|
}
|
|
206
201
|
/**
|
|
207
202
|
* Check if phone number is available for payment
|
|
208
|
-
* Returns true if
|
|
203
|
+
* Returns true if the user has entered a valid number in the input field
|
|
209
204
|
*/
|
|
210
205
|
hasPhoneNumber(methodId) {
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
PAYMENT_METHODS.SHOPEEPAY,
|
|
215
|
-
PAYMENT_METHODS.ATOM,
|
|
216
|
-
PAYMENT_METHODS.KONBINI,
|
|
217
|
-
PAYMENT_METHODS.PAYEASY,
|
|
218
|
-
];
|
|
219
|
-
if (methodsWithPhoneInput.includes(methodId)) {
|
|
220
|
-
// Either phone input value or prop must be set
|
|
221
|
-
return !!(this.phoneInputValue.trim() || (this.phoneNumber && this.phoneNumber.trim()));
|
|
206
|
+
// Only the 5 methods that require phone number use the input field
|
|
207
|
+
if (this.requiresPhoneNumber(methodId)) {
|
|
208
|
+
return !!this.phoneInputValue.trim();
|
|
222
209
|
}
|
|
223
|
-
// Other methods
|
|
224
|
-
return
|
|
210
|
+
// Other methods don't need phone number
|
|
211
|
+
return true;
|
|
225
212
|
}
|
|
226
213
|
/**
|
|
227
214
|
* Check if the pay button should be disabled for a method
|
|
@@ -717,6 +704,14 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
717
704
|
window.location.href = redirectUrl;
|
|
718
705
|
}
|
|
719
706
|
});
|
|
707
|
+
// Handle WeChat Pay redirect
|
|
708
|
+
this.sdk.on('wechatpay_redirect', (event) => {
|
|
709
|
+
const { redirectUrl } = event.payload;
|
|
710
|
+
if (redirectUrl) {
|
|
711
|
+
// Redirect the entire page to WeChat Pay payment page
|
|
712
|
+
window.location.href = redirectUrl;
|
|
713
|
+
}
|
|
714
|
+
});
|
|
720
715
|
this.sdk.initialize({
|
|
721
716
|
amount: this.amount,
|
|
722
717
|
currency: this.currency,
|
|
@@ -921,7 +916,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
921
916
|
firstName: formattedNames.firstName,
|
|
922
917
|
lastName: formattedNames.lastName,
|
|
923
918
|
email: this.email,
|
|
924
|
-
phoneNumber: this.phoneNumber,
|
|
925
919
|
});
|
|
926
920
|
}
|
|
927
921
|
handlePayNowPayment() {
|
|
@@ -937,7 +931,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
937
931
|
firstName: formattedNames.firstName,
|
|
938
932
|
lastName: formattedNames.lastName,
|
|
939
933
|
email: this.email,
|
|
940
|
-
phoneNumber: this.phoneNumber,
|
|
941
934
|
});
|
|
942
935
|
// showQRCode will be set by the event listener when qrCode is received
|
|
943
936
|
}
|
|
@@ -955,7 +948,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
955
948
|
firstName: formattedNames.firstName,
|
|
956
949
|
lastName: formattedNames.lastName,
|
|
957
950
|
email: this.email,
|
|
958
|
-
phoneNumber: this.phoneNumber,
|
|
959
951
|
});
|
|
960
952
|
}
|
|
961
953
|
handleDuitNowPayment() {
|
|
@@ -972,7 +964,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
972
964
|
firstName: formattedNames.firstName,
|
|
973
965
|
lastName: formattedNames.lastName,
|
|
974
966
|
email: this.email,
|
|
975
|
-
phoneNumber: this.phoneNumber,
|
|
976
967
|
});
|
|
977
968
|
}
|
|
978
969
|
handleGoPayPayment() {
|
|
@@ -989,7 +980,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
989
980
|
firstName: formattedNames.firstName,
|
|
990
981
|
lastName: formattedNames.lastName,
|
|
991
982
|
email: this.email,
|
|
992
|
-
phoneNumber: this.phoneNumber,
|
|
993
983
|
});
|
|
994
984
|
}
|
|
995
985
|
handleBoostPayment() {
|
|
@@ -1226,7 +1216,6 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
1226
1216
|
firstName: formattedNames.firstName,
|
|
1227
1217
|
lastName: formattedNames.lastName,
|
|
1228
1218
|
email: this.email,
|
|
1229
|
-
phoneNumber: this.phoneNumber,
|
|
1230
1219
|
});
|
|
1231
1220
|
}
|
|
1232
1221
|
handleFPXPayment() {
|
|
@@ -1247,10 +1236,25 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
1247
1236
|
firstName: formattedNames.firstName,
|
|
1248
1237
|
lastName: formattedNames.lastName,
|
|
1249
1238
|
email: this.email,
|
|
1250
|
-
phoneNumber: this.phoneNumber,
|
|
1251
1239
|
bankName: this.selectedBank.bankName,
|
|
1252
1240
|
});
|
|
1253
1241
|
}
|
|
1242
|
+
handleWeChatPayPayment() {
|
|
1243
|
+
if (!this.sdk || this.currentState.status !== 'ready') {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
// Lock payment methods to prevent switching
|
|
1247
|
+
this.paymentLocked = true;
|
|
1248
|
+
// Format names to UPPERCASE for API
|
|
1249
|
+
const formattedNames = this.formatNamesUppercase();
|
|
1250
|
+
// Use customer info from props
|
|
1251
|
+
// SDK will redirect to WeChat Pay payment page when nextActionUrl is received
|
|
1252
|
+
this.sdk.submitPayment(PAYMENT_METHODS.WECHATPAY, {
|
|
1253
|
+
firstName: formattedNames.firstName,
|
|
1254
|
+
lastName: formattedNames.lastName,
|
|
1255
|
+
email: this.email,
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1254
1258
|
/**
|
|
1255
1259
|
* Fetch available banks for a payment method
|
|
1256
1260
|
*/
|
|
@@ -1325,18 +1329,16 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
1325
1329
|
* - Other methods: Keep international format (+XX XXXX XXXX)
|
|
1326
1330
|
*/
|
|
1327
1331
|
getEffectivePhoneNumber(methodId) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
// For other methods, keep international format as-is
|
|
1336
|
-
return internationalPhone;
|
|
1332
|
+
if (!this.phoneInputValue.trim()) {
|
|
1333
|
+
return '';
|
|
1334
|
+
}
|
|
1335
|
+
const internationalPhone = this.getFormattedPhoneWithCountryCode();
|
|
1336
|
+
// For Japan methods, convert +81 to local 0 format
|
|
1337
|
+
if (this.isJapanOnlyPhoneMethod(methodId)) {
|
|
1338
|
+
return this.formatPhoneForJapan(internationalPhone);
|
|
1337
1339
|
}
|
|
1338
|
-
//
|
|
1339
|
-
return
|
|
1340
|
+
// For other methods, keep international format as-is
|
|
1341
|
+
return internationalPhone;
|
|
1340
1342
|
}
|
|
1341
1343
|
/**
|
|
1342
1344
|
* Format phone number for Japan (convert +81 to 0)
|
|
@@ -2687,6 +2689,49 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
2687
2689
|
</div>
|
|
2688
2690
|
`;
|
|
2689
2691
|
}
|
|
2692
|
+
renderWeChatPayContent() {
|
|
2693
|
+
return html `
|
|
2694
|
+
<div class="paynow-container">
|
|
2695
|
+
<div class="paynow-instructions">
|
|
2696
|
+
<h3 class="instructions-title">How to Pay with WeChat Pay:</h3>
|
|
2697
|
+
|
|
2698
|
+
<div class="instruction-steps">
|
|
2699
|
+
<div class="instruction-step">
|
|
2700
|
+
<div class="step-number">1</div>
|
|
2701
|
+
<p class="step-text">Click <strong>"Pay"</strong> to open WeChat Pay.</p>
|
|
2702
|
+
</div>
|
|
2703
|
+
|
|
2704
|
+
<div class="instruction-step">
|
|
2705
|
+
<div class="step-number">2</div>
|
|
2706
|
+
<p class="step-text">Scan the QR code with your WeChat app.</p>
|
|
2707
|
+
</div>
|
|
2708
|
+
|
|
2709
|
+
<div class="instruction-step">
|
|
2710
|
+
<div class="step-number">3</div>
|
|
2711
|
+
<p class="step-text">Confirm and complete your payment.</p>
|
|
2712
|
+
</div>
|
|
2713
|
+
</div>
|
|
2714
|
+
|
|
2715
|
+
<div class="submit-section">
|
|
2716
|
+
<button
|
|
2717
|
+
class="pay-button ${this.currentState.status === 'processing' ||
|
|
2718
|
+
this.currentState.status === 'requires_action'
|
|
2719
|
+
? 'loading'
|
|
2720
|
+
: ''}"
|
|
2721
|
+
@click=${this.handleWeChatPayPayment}
|
|
2722
|
+
?disabled=${this.currentState.status === 'processing' ||
|
|
2723
|
+
this.currentState.status === 'requires_action'}
|
|
2724
|
+
>
|
|
2725
|
+
${this.currentState.status === 'processing' ||
|
|
2726
|
+
this.currentState.status === 'requires_action'
|
|
2727
|
+
? 'Redirecting...'
|
|
2728
|
+
: `Pay ${this.getPayButtonAmount()}`}
|
|
2729
|
+
</button>
|
|
2730
|
+
</div>
|
|
2731
|
+
</div>
|
|
2732
|
+
</div>
|
|
2733
|
+
`;
|
|
2734
|
+
}
|
|
2690
2735
|
render3DSModal() {
|
|
2691
2736
|
if (!this.show3DSModal || !this.nextActionUrl) {
|
|
2692
2737
|
return null;
|
|
@@ -2798,6 +2843,8 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
2798
2843
|
return 'GrabPay';
|
|
2799
2844
|
case PAYMENT_METHODS.FPX:
|
|
2800
2845
|
return 'FPX Online Banking';
|
|
2846
|
+
case PAYMENT_METHODS.WECHATPAY:
|
|
2847
|
+
return 'WeChat Pay';
|
|
2801
2848
|
default:
|
|
2802
2849
|
return id;
|
|
2803
2850
|
}
|
|
@@ -2947,6 +2994,17 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
2947
2994
|
style="width: 45px; height: auto;"
|
|
2948
2995
|
/>
|
|
2949
2996
|
</div>
|
|
2997
|
+
`;
|
|
2998
|
+
}
|
|
2999
|
+
else if (id === PAYMENT_METHODS.WECHATPAY) {
|
|
3000
|
+
return html `
|
|
3001
|
+
<div class="method-icon-right">
|
|
3002
|
+
<img
|
|
3003
|
+
src="${WECHATPAY_ICON_DATA_URL}"
|
|
3004
|
+
alt="WeChat Pay"
|
|
3005
|
+
style="width: 45px; height: auto;"
|
|
3006
|
+
/>
|
|
3007
|
+
</div>
|
|
2950
3008
|
`;
|
|
2951
3009
|
}
|
|
2952
3010
|
return null;
|
|
@@ -3031,7 +3089,9 @@ let OnePayment = class OnePayment extends LitElement {
|
|
|
3031
3089
|
? this.renderGrabPaySGContent()
|
|
3032
3090
|
: method.id === PAYMENT_METHODS.FPX
|
|
3033
3091
|
? this.renderFPXContent()
|
|
3034
|
-
:
|
|
3092
|
+
: method.id === PAYMENT_METHODS.WECHATPAY
|
|
3093
|
+
? this.renderWeChatPayContent()
|
|
3094
|
+
: null}
|
|
3035
3095
|
</div>`
|
|
3036
3096
|
: ''}
|
|
3037
3097
|
</div>
|
|
@@ -4721,9 +4781,6 @@ __decorate([
|
|
|
4721
4781
|
__decorate([
|
|
4722
4782
|
property({ type: String })
|
|
4723
4783
|
], OnePayment.prototype, "email", void 0);
|
|
4724
|
-
__decorate([
|
|
4725
|
-
property({ type: String })
|
|
4726
|
-
], OnePayment.prototype, "phoneNumber", void 0);
|
|
4727
4784
|
__decorate([
|
|
4728
4785
|
property({ type: Array })
|
|
4729
4786
|
], OnePayment.prototype, "excludePaymentMethods", void 0);
|