@zendfi/sdk 0.7.1 → 0.7.2
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.d.mts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +5 -28
- package/dist/index.mjs +5 -28
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1856,10 +1856,6 @@ declare class ZendFiEmbeddedCheckout {
|
|
|
1856
1856
|
* Poll for payment confirmation
|
|
1857
1857
|
*/
|
|
1858
1858
|
private startPaymentPolling;
|
|
1859
|
-
/**
|
|
1860
|
-
* Fetch full payment details and handle success
|
|
1861
|
-
*/
|
|
1862
|
-
private fetchAndHandlePaymentSuccess;
|
|
1863
1859
|
/**
|
|
1864
1860
|
* Handle successful payment
|
|
1865
1861
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1856,10 +1856,6 @@ declare class ZendFiEmbeddedCheckout {
|
|
|
1856
1856
|
* Poll for payment confirmation
|
|
1857
1857
|
*/
|
|
1858
1858
|
private startPaymentPolling;
|
|
1859
|
-
/**
|
|
1860
|
-
* Fetch full payment details and handle success
|
|
1861
|
-
*/
|
|
1862
|
-
private fetchAndHandlePaymentSuccess;
|
|
1863
1859
|
/**
|
|
1864
1860
|
* Handle successful payment
|
|
1865
1861
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3615,7 +3615,7 @@ var ZendFiEmbeddedCheckout = class {
|
|
|
3615
3615
|
if (response.ok) {
|
|
3616
3616
|
const data = await response.json();
|
|
3617
3617
|
if (data.status === "confirmed") {
|
|
3618
|
-
|
|
3618
|
+
this.handlePaymentSuccess(data);
|
|
3619
3619
|
} else if (data.status === "failed") {
|
|
3620
3620
|
this.handlePaymentFailure(data);
|
|
3621
3621
|
} else if (data.status === "expired") {
|
|
@@ -3627,41 +3627,18 @@ var ZendFiEmbeddedCheckout = class {
|
|
|
3627
3627
|
}
|
|
3628
3628
|
}, 3e3);
|
|
3629
3629
|
}
|
|
3630
|
-
/**
|
|
3631
|
-
* Fetch full payment details and handle success
|
|
3632
|
-
*/
|
|
3633
|
-
async fetchAndHandlePaymentSuccess() {
|
|
3634
|
-
if (!this.checkoutData) return;
|
|
3635
|
-
try {
|
|
3636
|
-
const response = await fetch(
|
|
3637
|
-
`${this.config.apiUrl}/api/v1/payments/${this.checkoutData.payment_id}`,
|
|
3638
|
-
{
|
|
3639
|
-
method: "GET",
|
|
3640
|
-
headers: {
|
|
3641
|
-
"Content-Type": "application/json"
|
|
3642
|
-
}
|
|
3643
|
-
}
|
|
3644
|
-
);
|
|
3645
|
-
if (response.ok) {
|
|
3646
|
-
const payment = await response.json();
|
|
3647
|
-
this.handlePaymentSuccess(payment);
|
|
3648
|
-
}
|
|
3649
|
-
} catch (error) {
|
|
3650
|
-
console.error("Failed to fetch payment details:", error);
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
3630
|
/**
|
|
3654
3631
|
* Handle successful payment
|
|
3655
3632
|
*/
|
|
3656
|
-
handlePaymentSuccess(
|
|
3633
|
+
handlePaymentSuccess(statusData) {
|
|
3657
3634
|
if (this.pollInterval) {
|
|
3658
3635
|
clearInterval(this.pollInterval);
|
|
3659
3636
|
this.pollInterval = null;
|
|
3660
3637
|
}
|
|
3661
3638
|
this.config.onSuccess({
|
|
3662
|
-
paymentId:
|
|
3663
|
-
transactionSignature:
|
|
3664
|
-
amount:
|
|
3639
|
+
paymentId: this.checkoutData?.payment_id || statusData.payment_id,
|
|
3640
|
+
transactionSignature: statusData.transaction_signature || "Processing...",
|
|
3641
|
+
amount: this.checkoutData?.amount_usd || 0,
|
|
3665
3642
|
token: this.checkoutData?.token || "USDC",
|
|
3666
3643
|
merchantName: this.checkoutData?.merchant_name || "Merchant"
|
|
3667
3644
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2559,7 +2559,7 @@ var ZendFiEmbeddedCheckout = class {
|
|
|
2559
2559
|
if (response.ok) {
|
|
2560
2560
|
const data = await response.json();
|
|
2561
2561
|
if (data.status === "confirmed") {
|
|
2562
|
-
|
|
2562
|
+
this.handlePaymentSuccess(data);
|
|
2563
2563
|
} else if (data.status === "failed") {
|
|
2564
2564
|
this.handlePaymentFailure(data);
|
|
2565
2565
|
} else if (data.status === "expired") {
|
|
@@ -2571,41 +2571,18 @@ var ZendFiEmbeddedCheckout = class {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
}, 3e3);
|
|
2573
2573
|
}
|
|
2574
|
-
/**
|
|
2575
|
-
* Fetch full payment details and handle success
|
|
2576
|
-
*/
|
|
2577
|
-
async fetchAndHandlePaymentSuccess() {
|
|
2578
|
-
if (!this.checkoutData) return;
|
|
2579
|
-
try {
|
|
2580
|
-
const response = await fetch(
|
|
2581
|
-
`${this.config.apiUrl}/api/v1/payments/${this.checkoutData.payment_id}`,
|
|
2582
|
-
{
|
|
2583
|
-
method: "GET",
|
|
2584
|
-
headers: {
|
|
2585
|
-
"Content-Type": "application/json"
|
|
2586
|
-
}
|
|
2587
|
-
}
|
|
2588
|
-
);
|
|
2589
|
-
if (response.ok) {
|
|
2590
|
-
const payment = await response.json();
|
|
2591
|
-
this.handlePaymentSuccess(payment);
|
|
2592
|
-
}
|
|
2593
|
-
} catch (error) {
|
|
2594
|
-
console.error("Failed to fetch payment details:", error);
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
2574
|
/**
|
|
2598
2575
|
* Handle successful payment
|
|
2599
2576
|
*/
|
|
2600
|
-
handlePaymentSuccess(
|
|
2577
|
+
handlePaymentSuccess(statusData) {
|
|
2601
2578
|
if (this.pollInterval) {
|
|
2602
2579
|
clearInterval(this.pollInterval);
|
|
2603
2580
|
this.pollInterval = null;
|
|
2604
2581
|
}
|
|
2605
2582
|
this.config.onSuccess({
|
|
2606
|
-
paymentId:
|
|
2607
|
-
transactionSignature:
|
|
2608
|
-
amount:
|
|
2583
|
+
paymentId: this.checkoutData?.payment_id || statusData.payment_id,
|
|
2584
|
+
transactionSignature: statusData.transaction_signature || "Processing...",
|
|
2585
|
+
amount: this.checkoutData?.amount_usd || 0,
|
|
2609
2586
|
token: this.checkoutData?.token || "USDC",
|
|
2610
2587
|
merchantName: this.checkoutData?.merchant_name || "Merchant"
|
|
2611
2588
|
});
|