diff --git a/docs/THREED-SECURE-AND-PAY-PAYMENT-IN-MODALBOX-EXAMPLE.md b/docs/THREED-SECURE-AND-PAY-PAYMENT-IN-MODALBOX-EXAMPLE.md
index 16981e55..32ff2cb5 100644
--- a/docs/THREED-SECURE-AND-PAY-PAYMENT-IN-MODALBOX-EXAMPLE.md
+++ b/docs/THREED-SECURE-AND-PAY-PAYMENT-IN-MODALBOX-EXAMPLE.md
@@ -167,24 +167,28 @@ $renderedForm = ob_get_clean();
@@ -204,7 +208,8 @@ $renderedForm = ob_get_clean();
window.addEventListener('message', function (event) {
messageReceived = true;
displayResponse(event);
- $('#iframe-modal').modal('hide');
+ let myModal = bootstrap.Modal.getInstance(document.getElementById('iframe-modal'));
+ myModal.hide();
});
/**
@@ -212,20 +217,24 @@ $renderedForm = ob_get_clean();
* modal box içinde yeni iframe oluşturuyoruz ve iframe içine $renderedForm verisini basıyoruz.
*/
let iframe = document.createElement('iframe');
- document.getElementById("iframe-modal-dialog").appendChild(iframe);
- $(iframe).height('500px');
- $(iframe).width('410px');
+ document.getElementById("iframe-modal-body").appendChild(iframe);
+ iframe.style.height = '500px';
+ iframe.style.width = '410px';
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(`= $renderedForm; ?>`);
iframe.contentWindow.document.close();
- $('#iframe-modal').modal('show');
+ let modalElement = document.getElementById('iframe-modal');
+ let myModal = new bootstrap.Modal(modalElement, {
+ keyboard: false
+ })
+ myModal.show();
- $('#iframe-modal').on('hidden.bs.modal', function () {
+ modalElement.addEventListener('hidden.bs.modal', function () {
if (!messageReceived) {
- let alertBox = $('#result-alert');
- alertBox.addClass('alert-danger');
- alertBox.append('modal box kapatildi');
- alertBox.show();
+ let alertBox = document.getElementById('result-alert');
+ alertBox.classList.add('alert-danger');
+ alertBox.appendChild(document.createTextNode('modal box kapatildi'));
+ alertBox.style.display = 'block';
}
});
diff --git a/examples/_common-codes/3d/form.php b/examples/_common-codes/3d/form.php
index c6444374..fecadd2b 100644
--- a/examples/_common-codes/3d/form.php
+++ b/examples/_common-codes/3d/form.php
@@ -260,24 +260,28 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent): void {
@@ -287,9 +291,14 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent): void {
-
@@ -368,12 +382,12 @@ function (RequestDataPreparedEvent $requestDataPreparedEvent): void {
*/
let closeInterval = setInterval(function () {
if (popupWindow.closed && !messageReceived) {
- // windows is closed without completing payment
+ // window is closed without completing payment
clearInterval(closeInterval);
- let alertBox = $('#result-alert');
- alertBox.addClass('alert-danger');
- alertBox.append('popup kapatildi');
- alertBox.show();
+ let alertBox = document.getElementById('result-alert');
+ alertBox.classList.add('alert-danger');
+ alertBox.appendChild(document.createTextNode('popup kapatildi'));
+ alertBox.style.display = 'block';
}
}, 1000);
diff --git a/examples/_common-codes/3d/index.php b/examples/_common-codes/3d/index.php
index f05e54ef..6041d99c 100644
--- a/examples/_common-codes/3d/index.php
+++ b/examples/_common-codes/3d/index.php
@@ -3,7 +3,9 @@
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/3d/_config.php
require '_config.php';
-
+if ($transaction === null) {
+ $transaction = \Mews\Pos\PosInterface::TX_TYPE_PAY_AUTH;
+}
require '../../_templates/_header.php';
$url = $baseUrl.'form.php';
diff --git a/examples/_common-codes/regular/cancel.php b/examples/_common-codes/regular/cancel.php
index f6067cfb..215a9360 100644
--- a/examples/_common-codes/regular/cancel.php
+++ b/examples/_common-codes/regular/cancel.php
@@ -2,10 +2,12 @@
use Mews\Pos\PosInterface;
-$templateTitle = 'Refund Order';
+$templateTitle = 'Cancel Order';
+
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/regular/_config.php
require '_config.php';
+$transaction = PosInterface::TX_TYPE_CANCEL;
require '../../_templates/_header.php';
@@ -80,8 +82,6 @@ function createCancelOrder(string $gatewayClass, array $lastResponse, string $ip
$order = createCancelOrder(get_class($pos), $session->get('last_response'), $ip);
dump($order);
-$transaction = PosInterface::TX_TYPE_CANCEL;
-
try {
$pos->cancel($order);
} catch (Exception $e) {
diff --git a/examples/_common-codes/regular/history.php b/examples/_common-codes/regular/history.php
index 4cb080e1..9781fcf8 100644
--- a/examples/_common-codes/regular/history.php
+++ b/examples/_common-codes/regular/history.php
@@ -5,6 +5,7 @@
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/regular/_config.php
require_once '_config.php';
+$transaction = \Mews\Pos\PosInterface::TX_TYPE_HISTORY;
require '../../_templates/_header.php';
@@ -45,8 +46,6 @@ function createHistoryOrder(string $gatewayClass, array $extraData): array
$order = createHistoryOrder(get_class($pos), []);
dump($order);
-$transaction = \Mews\Pos\PosInterface::TX_TYPE_HISTORY;
-
try {
$pos->history($order);
} catch (Exception $e) {
diff --git a/examples/_common-codes/regular/order_history.php b/examples/_common-codes/regular/order_history.php
index bea76df5..54debb30 100644
--- a/examples/_common-codes/regular/order_history.php
+++ b/examples/_common-codes/regular/order_history.php
@@ -5,6 +5,7 @@
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/regular/_config.php
require_once '_config.php';
+$transaction = \Mews\Pos\PosInterface::TX_TYPE_ORDER_HISTORY;
require '../../_templates/_header.php';
@@ -64,8 +65,6 @@ function createOrderHistoryOrder(string $gatewayClass, array $lastResponse): arr
$order = createOrderHistoryOrder(get_class($pos), $lastResponse);
dump($order);
-$transaction = \Mews\Pos\PosInterface::TX_TYPE_ORDER_HISTORY;
-
try {
$pos->orderHistory($order);
} catch (Exception $e) {
diff --git a/examples/_common-codes/regular/refund.php b/examples/_common-codes/regular/refund.php
index 8d2c49b6..66e2ca4f 100644
--- a/examples/_common-codes/regular/refund.php
+++ b/examples/_common-codes/regular/refund.php
@@ -7,6 +7,7 @@
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/regular/_config.php
require '_config.php';
+$transaction = PosInterface::TX_TYPE_REFUND;
require '../../_templates/_header.php';
@@ -70,8 +71,6 @@ function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip
);
dump($order);
-$transaction = PosInterface::TX_TYPE_REFUND;
-
try {
$pos->refund($order);
} catch (Exception $e) {
diff --git a/examples/_common-codes/regular/status.php b/examples/_common-codes/regular/status.php
index 38997781..144355b6 100644
--- a/examples/_common-codes/regular/status.php
+++ b/examples/_common-codes/regular/status.php
@@ -3,10 +3,10 @@
use Mews\Pos\PosInterface;
$templateTitle = 'Order Status';
-
// ilgili bankanin _config.php dosyasi load ediyoruz.
// ornegin /examples/finansbank-payfor/regular/_config.php
require '_config.php';
+$transaction = PosInterface::TX_TYPE_STATUS;
require '../../_templates/_header.php';
@@ -43,8 +43,6 @@ function createStatusOrder(string $gatewayClass, array $lastResponse, string $ip
$order = createStatusOrder(get_class($pos), $session->get('last_response'), $ip);
dump($order);
-$transaction = PosInterface::TX_TYPE_STATUS;
-
$pos->status($order);
$response = $pos->getResponse();
diff --git a/examples/_main_config.php b/examples/_main_config.php
index ab3f8768..c7397408 100644
--- a/examples/_main_config.php
+++ b/examples/_main_config.php
@@ -38,6 +38,10 @@
12 => '12 Taksit',
];
+$paymentModel = null;
+$posClass = null;
+$transaction = null;
+
function doPayment(PosInterface $pos, string $paymentModel, string $transaction, array $order, ?\Mews\Pos\Entity\Card\CreditCardInterface $card)
{
if (!$pos::isSupportedTransaction($transaction, $paymentModel)) {
diff --git a/examples/_templates/_credit_card_form.php b/examples/_templates/_credit_card_form.php
index dd665485..b2e73f6f 100644
--- a/examples/_templates/_credit_card_form.php
+++ b/examples/_templates/_credit_card_form.php
@@ -1,15 +1,15 @@