Skip to content

Commit

Permalink
Merge pull request #198 from mewebstudio/181-vakif-katilim-entegrasyonu
Browse files Browse the repository at this point in the history
181 vakif katilim entegrasyonu
  • Loading branch information
nuryagdym authored Apr 23, 2024
2 parents 37261e1 + 7e470e5 commit fa5db28
Show file tree
Hide file tree
Showing 60 changed files with 5,283 additions and 203 deletions.
253 changes: 161 additions & 92 deletions README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions config/pos_production.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,14 @@
'query_api' => 'https://boa.kuveytturk.com.tr/BOA.Integration.WCFService/BOA.Integration.VirtualPos/VirtualPosService.svc?wsdl',
],
],
'vakif-katilim' => [
'name' => 'Vakıf Katılım',
'class' => Mews\Pos\Gateways\VakifKatilimPos::class,
'gateway_endpoints' => [
'payment_api' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/Home',
'gateway_3d' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/Home/ThreeDModelPayGate',
'gateway_3d_host' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/CommonPaymentPage/CommonPaymentPage',
],
],
],
];
9 changes: 9 additions & 0 deletions config/pos_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,14 @@
'query_api' => 'https://boatest.kuveytturk.com.tr/BOA.Integration.WCFService/BOA.Integration.VirtualPos/VirtualPosService.svc?wsdl',
],
],
'vakif-katilim' => [
'name' => 'Vakıf Katılım',
'class' => Mews\Pos\Gateways\VakifKatilimPos::class,
'gateway_endpoints' => [
'payment_api' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/Home',
'gateway_3d' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/Home/ThreeDModelPayGate',
'gateway_3d_host' => 'https://boa.vakifkatilim.com.tr/VirtualPOS.Gateway/CommonPaymentPage/CommonPaymentPage',
],
],
],
];
5 changes: 5 additions & 0 deletions docs/CANCEL-EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ function createCancelOrder(string $gatewayClass, array $lastResponse, string $ip
$cancelOrder['auth_code'] = $lastResponse['auth_code'];
$cancelOrder['transaction_id'] = $lastResponse['transaction_id'];
$cancelOrder['amount'] = $lastResponse['amount'];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$cancelOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$cancelOrder['amount'] = $lastResponse['amount'];
// on otorizasyon islemin iptali icin PosInterface::TX_TYPE_PAY_PRE_AUTH saglanmasi gerekiyor
$cancelOrder['transaction_type'] = $lastResponse['transaction_type'] ?? PosInterface::TX_TYPE_PAY_AUTH;
} elseif (\Mews\Pos\Gateways\PayFlexV4Pos::class === $gatewayClass || \Mews\Pos\Gateways\PayFlexCPV4Pos::class === $gatewayClass) {
// çalışmazsa $lastResponse['all']['ReferenceTransactionId']; ile denenmesi gerekiyor.
$cancelOrder['transaction_id'] = $lastResponse['transaction_id'];
Expand Down
8 changes: 8 additions & 0 deletions docs/HISTORY-EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ function createHistoryOrder(string $gatewayClass, array $extraData): array
// odeme tarihi
'transaction_date' => $extraData['transaction_date'] ?? new \DateTimeImmutable(),
];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$txTime = new \DateTimeImmutable();
$order = [
'page' => 1,
'page_size' => 20,
'start_date' => $txTime->modify('-1 day'),
'end_date' => $txTime->modify('+1 day'),
];
}

return $order;
Expand Down
8 changes: 8 additions & 0 deletions docs/ORDER-HISTORY-EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ function createOrderHistoryOrder(string $gatewayClass, array $lastResponse): arr
'currency' => $lastResponse['currency'],
'ip' => '127.0.0.1',
];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
/** @var DateTimeImmutable $txTime */
$txTime = $lastResponse['transaction_time'];
$order = [
'auth_code' => $lastResponse['auth_code'],
'start_date' => $txTime->modify('-1 day'),
'end_date' => $txTime->modify('+1 day'),
];
}

return $order;
Expand Down
5 changes: 5 additions & 0 deletions docs/REFUND-EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip
$refundOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$refundOrder['auth_code'] = $lastResponse['auth_code'];
$refundOrder['transaction_id'] = $lastResponse['transaction_id'];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$refundOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$refundOrder['amount'] = $lastResponse['amount'];
// on otorizasyon islemin iadesi icin PosInterface::TX_TYPE_PAY_PRE_AUTH saglanmasi gerekiyor
$refundOrder['transaction_type'] = $lastResponse['transaction_type'] ?? PosInterface::TX_TYPE_PAY_AUTH;
} elseif (\Mews\Pos\Gateways\PayFlexV4Pos::class === $gatewayClass || \Mews\Pos\Gateways\PayFlexCPV4Pos::class === $gatewayClass) {
// çalışmazsa $lastResponse['all']['ReferenceTransactionId']; ile denenmesi gerekiyor.
$refundOrder['transaction_id'] = $lastResponse['transaction_id'];
Expand Down
5 changes: 5 additions & 0 deletions examples/_common-codes/regular/cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ function createCancelOrder(string $gatewayClass, array $lastResponse, string $ip
$cancelOrder['auth_code'] = $lastResponse['auth_code'];
$cancelOrder['transaction_id'] = $lastResponse['transaction_id'];
$cancelOrder['amount'] = $lastResponse['amount'];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$cancelOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$cancelOrder['amount'] = $lastResponse['amount'];
// on otorizasyon islemin iptali icin PosInterface::TX_TYPE_PAY_PRE_AUTH saglanmasi gerekiyor
$cancelOrder['transaction_type'] = $lastResponse['transaction_type'] ?? PosInterface::TX_TYPE_PAY_AUTH;
} elseif (\Mews\Pos\Gateways\PayFlexV4Pos::class === $gatewayClass || \Mews\Pos\Gateways\PayFlexCPV4Pos::class === $gatewayClass) {
// çalışmazsa $lastResponse['all']['ReferenceTransactionId']; ile denenmesi gerekiyor.
$cancelOrder['transaction_id'] = $lastResponse['transaction_id'];
Expand Down
13 changes: 12 additions & 1 deletion examples/_common-codes/regular/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ function createHistoryOrder(string $gatewayClass, array $extraData): array
if (PayForPos::class === $gatewayClass) {
$order = [
// odeme tarihi
'transaction_date' => $extraData['transaction_date'] ?? new \DateTimeImmutable(),
'transaction_date' => $extraData['transaction_date'] ?? new \DateTimeImmutable(),
];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$txTime = new \DateTimeImmutable();
$order = [
'page' => 1,
'page_size' => 20,
/**
* Tarih aralığı maksimum 90 gün olabilir.
*/
'start_date' => $txTime->modify('-1 day'),
'end_date' => $txTime->modify('+1 day'),
];
}

Expand Down
11 changes: 11 additions & 0 deletions examples/_common-codes/regular/order_history.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ function createOrderHistoryOrder(string $gatewayClass, array $lastResponse): arr
'currency' => $lastResponse['currency'],
'ip' => '127.0.0.1',
];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
/** @var DateTimeImmutable $txTime */
$txTime = $lastResponse['transaction_time'];
$order = [
'auth_code' => $lastResponse['auth_code'],
/**
* Tarih aralığı maksimum 90 gün olabilir.
*/
'start_date' => $txTime->modify('-1 day'),
'end_date' => $txTime->modify('+1 day'),
];
}

return $order;
Expand Down
5 changes: 5 additions & 0 deletions examples/_common-codes/regular/refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function createRefundOrder(string $gatewayClass, array $lastResponse, string $ip
$refundOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$refundOrder['auth_code'] = $lastResponse['auth_code'];
$refundOrder['transaction_id'] = $lastResponse['transaction_id'];
} elseif (\Mews\Pos\Gateways\VakifKatilimPos::class === $gatewayClass) {
$refundOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$refundOrder['amount'] = $lastResponse['amount'];
// on otorizasyon islemin iadesi icin PosInterface::TX_TYPE_PAY_PRE_AUTH saglanmasi gerekiyor
$refundOrder['transaction_type'] = $lastResponse['transaction_type'] ?? PosInterface::TX_TYPE_PAY_AUTH;
} elseif (\Mews\Pos\Gateways\PayFlexV4Pos::class === $gatewayClass || \Mews\Pos\Gateways\PayFlexCPV4Pos::class === $gatewayClass) {
// çalışmazsa $lastResponse['all']['ReferenceTransactionId']; ile denenmesi gerekiyor.
$refundOrder['transaction_id'] = $lastResponse['transaction_id'];
Expand Down
1 change: 1 addition & 0 deletions examples/_templates/_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<li> <a href="<?= $hostUrl ?>/posnet-ykb/index.php">PosNet (YKB)</a></li>
<li> <a href="<?= $hostUrl ?>/posnet-v1/index.php">PosNetV1 (Albaraka)</a></li>
<li> <a href="<?= $hostUrl ?>/kuveytpos/index.php">KuveytPOS</a></li>
<li> <a href="<?= $hostUrl ?>/vakif-katilim/index.php">VakifKatilimPos</a></li>
</ul>
</nav>
</div>
Expand Down
22 changes: 22 additions & 0 deletions examples/vakif-katilim/3d-host/_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Mews\Pos\PosInterface;

require '../_payment_config.php';

$baseUrl = $bankTestsUrl.'/3d-host/';
//account bilgileri kendi account bilgilerinizle degistiriniz
$account = \Mews\Pos\Factory\AccountFactory::createKuveytPosAccount(
'vakif-katilim',
'1',
'APIUSER',
'11111',
'kdsnsksl',
);

$pos = getGateway($account, $eventDispatcher);

$transaction = PosInterface::TX_TYPE_PAY_AUTH;

$templateTitle = '3D Host Model Payment';
$paymentModel = PosInterface::MODEL_3D_HOST;
3 changes: 3 additions & 0 deletions examples/vakif-katilim/3d-host/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/3d-host/index.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/3d-host/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_templates/_payment_secure_response.php';
22 changes: 22 additions & 0 deletions examples/vakif-katilim/3d/_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Mews\Pos\PosInterface;

require '../_payment_config.php';

$baseUrl = $bankTestsUrl.'/3d/';
//account bilgileri kendi account bilgilerinizle degistiriniz
$account = \Mews\Pos\Factory\AccountFactory::createKuveytPosAccount(
'vakif-katilim',
'1',
'APIUSER',
'11111',
'kdsnsksl',
);

$pos = getGateway($account, $eventDispatcher);

$transaction = $session->get('tx', PosInterface::TX_TYPE_PAY_AUTH);

$templateTitle = '3D Model Payment';
$paymentModel = \Mews\Pos\PosInterface::MODEL_3D_SECURE;
3 changes: 3 additions & 0 deletions examples/vakif-katilim/3d/form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/3d/form.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/3d/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/3d/index.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/3d/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_templates/_payment_secure_response.php';
19 changes: 19 additions & 0 deletions examples/vakif-katilim/_payment_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Mews\Pos\Entity\Card\CreditCardInterface;

require __DIR__.'/../_main_config.php';

$bankTestsUrl = $hostUrl.'/vakif-katilim';
$posClass = \Mews\Pos\Gateways\VakifKatilimPos::class;

$testCards = [
'visa1' => [
'number' => '4155650100416111',
'year' => '25',
'month' => '1',
'cvv' => '123',
'name' => 'John Doe',
'type' => CreditCardInterface::CARD_TYPE_VISA,
],
];
6 changes: 6 additions & 0 deletions examples/vakif-katilim/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$templateTitle = 'Vakif Katilim POS';
require './_payment_config.php';
require '../_templates/_header.php';
require '../_templates/_footer.php';
20 changes: 20 additions & 0 deletions examples/vakif-katilim/regular/_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Mews\Pos\PosInterface;

require '../_payment_config.php';

$baseUrl = $bankTestsUrl.'/regular/';

$account = \Mews\Pos\Factory\AccountFactory::createKuveytPosAccount(
'vakif-katilim',
'1',
'APIUSER',
'11111',
'kdsnsksl',
);

$pos = getGateway($account, $eventDispatcher);

$templateTitle = 'Regular Payment';
$paymentModel = PosInterface::MODEL_NON_SECURE;
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/cancel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/cancel.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/form.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/history.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/history.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/3d/index.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/order_history.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/order_history.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/refund.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/refund.php';
3 changes: 3 additions & 0 deletions examples/vakif-katilim/regular/status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/status.php';
2 changes: 1 addition & 1 deletion src/Crypt/AbstractCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function hashFromParams(string $storeKey, array $data, string $hashParams
*
* @return string
*/
protected function hashString(string $str): string
public function hashString(string $str): string
{
return \base64_encode(\hash(static::HASH_ALGORITHM, $str, true));
}
Expand Down
7 changes: 7 additions & 0 deletions src/Crypt/CryptInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

interface CryptInterface
{
/**
* @param string $str
*
* @return string
*/
public function hashString(string $str): string;

/**
* check hash of 3D secure response
*
Expand Down
2 changes: 1 addition & 1 deletion src/Crypt/GarantiPosCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function createHash(AbstractPosAccount $posAccount, array $requestData):
*
* @return string
*/
protected function hashString(string $str): string
public function hashString(string $str): string
{
return $this->hashStringUpperCase($str, self::HASH_ALGORITHM);
}
Expand Down
5 changes: 3 additions & 2 deletions src/Crypt/KuveytPosCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public function createHash(AbstractPosAccount $posAccount, array $requestData):

$hashData = [
$posAccount->getClientId(),
$requestData['MerchantOrderId'],
$requestData['Amount'],
// non-payment request may not have MerchantOrderId and Amount fields
$requestData['MerchantOrderId'] ?? '',
$requestData['Amount'] ?? '',
$posAccount->getUsername(),
$hashedPassword,
];
Expand Down
Loading

0 comments on commit fa5db28

Please sign in to comment.