Skip to content

Commit

Permalink
param integration initial
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Jan 5, 2025
1 parent f12b10b commit 0bdaefa
Show file tree
Hide file tree
Showing 29 changed files with 1,641 additions and 1,502 deletions.
2 changes: 1 addition & 1 deletion config/pos_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
'gateway_endpoints' => [
//'payment_api' => 'https://testposws.param.com.tr/turkpos.ws/service_turkpos_prod.asmx',
//'payment_api' => 'https://test-dmz.param.com.tr/turkpos.ws/service_turkpos_test.asmx?wsdl',
// 'payment_api' => 'https://test-dmz.param.com.tr/turkpos.ws/service_turkpos_test.asmx?wsdl',
'payment_api' => 'https://test-dmz.param.com.tr/turkpos.ws/service_turkpos_test.asmx', //xml
'gateway_3d_host' => 'https://test-pos.param.com.tr/default.aspx',
//'payment_api' => 'https://test-dmz.param.com.tr:4443/turkpos.ws/service_turkpos_test.asmx?WSDL',
//prod: 'payment_api' => 'https://posws.param.com.tr/turkpos.ws/service_turkpos_prod.asmx?wsdl',
],
Expand Down
4 changes: 4 additions & 0 deletions examples/_common-codes/regular/cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ function createCancelOrder(string $gatewayClass, array $lastResponse, string $ip

if (\Mews\Pos\Gateways\GarantiPos::class === $gatewayClass) {
$cancelOrder['amount'] = $lastResponse['amount'];
} elseif (\Mews\Pos\Gateways\ParamPos::class === $gatewayClass) {
$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\KuveytPos::class === $gatewayClass) {
$cancelOrder['remote_order_id'] = $lastResponse['remote_order_id']; // banka tarafındaki order id
$cancelOrder['auth_code'] = $lastResponse['auth_code'];
Expand Down
13 changes: 13 additions & 0 deletions examples/_common-codes/regular/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ function createHistoryOrder(string $gatewayClass, array $extraData, string $ip):
// ya da batch number ile (batch number odeme isleminden alinan response'da bulunur):
// $order = [
// 'batch_num' => 24,
// ];
} elseif (\Mews\Pos\Gateways\ParamPos::class === $gatewayClass) {
$order = [
// Gün aralığı 1 günden fazla girilemez
'start_date' => $txTime->modify('-23 hour'),
'end_date' => $txTime,
// optional:
'transaction_type' => \Mews\Pos\PosInterface::TX_TYPE_PAY_AUTH, // TX_TYPE_CANCEL, TX_TYPE_REFUND
'order_status' => 'Başarılı', // Başarılı, Başarısız
];
// ya da batch number ile (batch number odeme isleminden alinan response'da bulunur):
// $order = [
// 'batch_num' => 24,
// ];
}

Expand Down
2 changes: 2 additions & 0 deletions examples/_common-codes/regular/post-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function createPostPayOrder(string $gatewayClass, array $lastResponse, string $i
$postAuthAmount
);

dump($order);

$transaction = PosInterface::TX_TYPE_PAY_POST_AUTH;

require '../../_templates/_finish_non_secure_post_auth_payment.php';
1 change: 1 addition & 0 deletions examples/_main_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function createPaymentOrder(
PosInterface::MODEL_3D_PAY,
PosInterface::MODEL_3D_HOST,
PosInterface::MODEL_3D_PAY_HOSTING,
PosInterface::MODEL_NON_SECURE, //todo
], true)) {
$order['success_url'] = $baseUrl.'response.php';
$order['fail_url'] = $baseUrl.'response.php';
Expand Down
13 changes: 7 additions & 6 deletions examples/parampos/3d-host/_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

$baseUrl = $bankTestsUrl.'/3d-host/';
//account bilgileri kendi account bilgilerinizle degistiriniz
$account = \Mews\Pos\Factory\AccountFactory::createAkbankPosAccount(
'akbank-pos',
'2023090417500272654BD9A49CF07574',
'2023090417500284633D137A249DBBEB',
'3230323330393034313735303032363031353172675f357637355f3273387373745f7233725f73323333383737335f323272383774767276327672323531355f',
PosInterface::LANG_TR
$account = \Mews\Pos\Factory\AccountFactory::createParamPosAccount(
'param-pos',
10738,
'Test',
'Test',
'0C13D406-873B-403B-9C09-A5766840D98C'
);


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

$transaction = PosInterface::TX_TYPE_PAY_AUTH;
Expand Down
22 changes: 0 additions & 22 deletions examples/parampos/3d-pay/_config.php

This file was deleted.

3 changes: 0 additions & 3 deletions examples/parampos/3d-pay/form.php

This file was deleted.

3 changes: 0 additions & 3 deletions examples/parampos/3d-pay/index.php

This file was deleted.

3 changes: 0 additions & 3 deletions examples/parampos/3d-pay/response.php

This file was deleted.

18 changes: 16 additions & 2 deletions examples/parampos/_payment_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@

$testCards = [
'visa1' => [
'number' => '4446763125813623',
'number' => '5818775818772285',
'year' => '26',
'month' => '12',
'cvv' => '000',
'cvv' => '001',
'name' => 'John Doe',
],
// 'visa1' => [
// 'number' => '4508034508034509',
// 'year' => '26',
// 'month' => '12',
// 'cvv' => '000',
// 'name' => 'John Doe',
// ]
// 'visa1' => [
// 'number' => '4446763125813623',
// 'year' => '26',
// 'month' => '12',
// 'cvv' => '000',
// 'name' => 'John Doe',
// ],
];
12 changes: 6 additions & 6 deletions examples/parampos/regular/_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

$baseUrl = $bankTestsUrl.'/regular/';
//account bilgileri kendi account bilgilerinizle degistiriniz
$account = \Mews\Pos\Factory\AccountFactory::createAkbankPosAccount(
'akbank-pos',
'2023090417500272654BD9A49CF07574',
'2023090417500284633D137A249DBBEB',
'3230323330393034313735303032363031353172675f357637355f3273387373745f7233725f73323333383737335f323272383774767276327672323531355f',
PosInterface::LANG_TR
$account = \Mews\Pos\Factory\AccountFactory::createParamPosAccount(
'param-pos',
10738,
'Test',
'Test',
'0c13d406-873b-403b-9c09-a5766840d98c'
);

$pos = getGateway($account, $eventDispatcher);
Expand Down
17 changes: 3 additions & 14 deletions examples/parampos/regular/custom_query.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,9 @@ function getCustomRequestData(): array
{
return [
[
'txnCode' => '1020',
'order' => [
'orderTrackId' => 'ae15a6c8-467e-45de-b24c-b98821a42667',
],
'payByLink' => [
'linkTxnCode' => '3000',
'linkTransferType' => 'SMS',
'mobilePhoneNumber' => '5321234567',
],
'transaction' => [
'amount' => 1.00,
'currencyCode' => 949,
'motoInd' => 0,
'installCount' => 1,
// API hesap bilgileri kutuphane tarafindan otomatik eklenir.
'TP_Ozel_Oran_Liste' => [
'@xmlns' => 'https://turkpos.com.tr/',
],
],
null,
Expand Down
3 changes: 3 additions & 0 deletions examples/parampos/regular/status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require '../../_common-codes/regular/status.php';
35 changes: 20 additions & 15 deletions src/Crypt/ParamPosCrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Mews\Pos\Entity\Account\AbstractPosAccount;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\PosInterface;
use Symfony\Component\VarExporter\VarExporter;

class ParamPosCrypt extends AbstractCrypt
Expand Down Expand Up @@ -75,31 +76,35 @@ public function check3DHash(AbstractPosAccount $posAccount, array $data): bool
*/
public function createHash(AbstractPosAccount $posAccount, array $requestData): string
{
if (isset($requestData['Doviz_Kodu']) && '1000' !== $requestData['Doviz_Kodu']) {
$requestData2 = $requestData['TP_WMD_UCD']
?? $requestData['TP_Islem_Odeme_WD']
?? $requestData['TP_Islem_Odeme_OnProv_WMD'];

if (isset($requestData['TP_Islem_Odeme_WD']) || isset($requestData['TP_Islem_Odeme_OnProv_WMD'])) {
// doviz odemeler icin farkli hash
$map = [
$requestData['G']['CLIENT_CODE'],
$requestData['GUID'],
$requestData['Islem_Tutar'],
$requestData['Toplam_Tutar'],
$requestData['Siparis_ID'],
$requestData['Hata_URL'] ?? '',
$requestData['Basarili_URL'] ?? '',
$requestData2['G']['CLIENT_CODE'],
$requestData2['GUID'],
$requestData2['Islem_Tutar'],
$requestData2['Toplam_Tutar'],
$requestData2['Siparis_ID'],
$requestData2['Hata_URL'] ?? '',
$requestData2['Basarili_URL'] ?? '',
];
} else {
// TRY odemeler icin hash
$map = [
$requestData['G']['CLIENT_CODE'],
$requestData['GUID'],
$requestData['Taksit'] ?? '',
$requestData['Islem_Tutar'],
$requestData['Toplam_Tutar'],
$requestData['Siparis_ID'],
$requestData2['G']['CLIENT_CODE'],
$requestData2['GUID'],
$requestData2['Taksit'] ?? '',
$requestData2['Islem_Tutar'],
$requestData2['Toplam_Tutar'],
$requestData2['Siparis_ID'],
];
}

$hashStr = \implode(static::HASH_SEPARATOR, $map);
$hashStr = mb_convert_encoding($hashStr, 'ISO-8859-9');
$hashStr = \mb_convert_encoding($hashStr, 'ISO-8859-9');

return $this->hashString($hashStr, self::HASH_ALGORITHM);
}
Expand Down
Loading

0 comments on commit 0bdaefa

Please sign in to comment.