Skip to content

Commit

Permalink
Merge pull request #220 from mewebstudio/218-vakifkatilimpos-kismi-ia…
Browse files Browse the repository at this point in the history
…de-destegi

218 vakifkatilimpos kismi iade destegi
  • Loading branch information
nuryagdym authored Jul 1, 2024
2 parents 069584f + eaf0d5e commit a907693
Show file tree
Hide file tree
Showing 58 changed files with 636 additions and 421 deletions.
19 changes: 10 additions & 9 deletions src/DataMapper/RequestDataMapper/AkbankPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ class AkbankPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => [
PosInterface::TX_TYPE_PAY_AUTH => [
PosInterface::MODEL_NON_SECURE => '1000',
PosInterface::MODEL_3D_SECURE => '3000',
PosInterface::MODEL_3D_PAY => '3000',
PosInterface::MODEL_3D_HOST => '3000',
],
PosInterface::TX_TYPE_PAY_PRE_AUTH => [
PosInterface::TX_TYPE_PAY_PRE_AUTH => [
PosInterface::MODEL_NON_SECURE => '1004',
PosInterface::MODEL_3D_SECURE => '3004',
PosInterface::MODEL_3D_PAY => '3004',
PosInterface::MODEL_3D_HOST => '3004',
],
PosInterface::TX_TYPE_PAY_POST_AUTH => '1005',
PosInterface::TX_TYPE_REFUND => '1002',
PosInterface::TX_TYPE_CANCEL => '1003',
PosInterface::TX_TYPE_ORDER_HISTORY => '1010',
PosInterface::TX_TYPE_HISTORY => '1009',
PosInterface::TX_TYPE_PAY_POST_AUTH => '1005',
PosInterface::TX_TYPE_REFUND => '1002',
PosInterface::TX_TYPE_REFUND_PARTIAL => '1002',
PosInterface::TX_TYPE_CANCEL => '1003',
PosInterface::TX_TYPE_ORDER_HISTORY => '1010',
PosInterface::TX_TYPE_HISTORY => '1009',
];

/**
Expand Down Expand Up @@ -261,13 +262,13 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
*
* {@inheritDoc}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

$requestData = $this->getRequestAccountData($posAccount) + [
'version' => self::API_VERSION,
'txnCode' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'txnCode' => $this->mapTxType($refundTxType),
'requestDateTime' => $this->formatRequestDateTime($order['transaction_time']),
'randomNumber' => $this->crypt->generateRandomString(),
'transaction' => [
Expand Down
19 changes: 10 additions & 9 deletions src/DataMapper/RequestDataMapper/EstPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ class EstPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Credit',
PosInterface::TX_TYPE_STATUS => 'ORDERSTATUS',
PosInterface::TX_TYPE_HISTORY => 'ORDERHISTORY',
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Credit',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'Credit',
PosInterface::TX_TYPE_STATUS => 'ORDERSTATUS',
PosInterface::TX_TYPE_HISTORY => 'ORDERHISTORY',
];

/**
Expand Down Expand Up @@ -199,14 +200,14 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* {@inheritDoc}
* @return array{OrderId: string, Currency: string, Type: string, Total?: string, Name: string, Password: string, ClientId: string}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

$requestData = [
'OrderId' => (string) $order['id'],
'Currency' => $this->mapCurrency($order['currency']),
'Type' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'Type' => $this->mapTxType($refundTxType),
];

if (isset($order['amount'])) {
Expand Down
19 changes: 10 additions & 9 deletions src/DataMapper/RequestDataMapper/GarantiPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ class GarantiPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'sales',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'preauth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'postauth',
PosInterface::TX_TYPE_CANCEL => 'void',
PosInterface::TX_TYPE_REFUND => 'refund',
PosInterface::TX_TYPE_HISTORY => 'orderhistoryinq',
PosInterface::TX_TYPE_STATUS => 'orderinq',
PosInterface::TX_TYPE_PAY_AUTH => 'sales',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'preauth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'postauth',
PosInterface::TX_TYPE_CANCEL => 'void',
PosInterface::TX_TYPE_REFUND => 'refund',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'refund',
PosInterface::TX_TYPE_HISTORY => 'orderhistoryinq',
PosInterface::TX_TYPE_STATUS => 'orderinq',
];

protected array $recurringOrderFrequencyMapping = [
Expand Down Expand Up @@ -254,7 +255,7 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
*
* {@inheritDoc}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

Expand All @@ -269,7 +270,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o
'OrderID' => $order['id'],
],
'Transaction' => [
'Type' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'Type' => $this->mapTxType($refundTxType),
'InstallmentCnt' => $this->mapInstallment($order['installment']),
'Amount' => $this->formatAmount($order['amount']), //sabit olarak amount 100 gonderilecek,
'CurrencyCode' => $this->mapCurrency($order['currency']),
Expand Down
17 changes: 9 additions & 8 deletions src/DataMapper/RequestDataMapper/InterPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ class InterPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritdoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_STATUS => 'StatusHistory',
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'Refund',
PosInterface::TX_TYPE_STATUS => 'StatusHistory',
];

/**
Expand Down Expand Up @@ -170,15 +171,15 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* {@inheritDoc}
* @return array{OrderId: null, orgOrderId: string, PurchAmount: string, TxnType: string, SecureType: string, Lang: string, MOTO: string, UserCode: string, UserPass: string, ShopCode: string}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

return $this->getRequestAccountData($posAccount) + [
'OrderId' => null,
'orgOrderId' => (string) $order['id'],
'PurchAmount' => (string) $order['amount'],
'TxnType' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'TxnType' => $this->mapTxType($refundTxType),
'SecureType' => $this->secureTypeMappings[PosInterface::MODEL_NON_SECURE],
'Lang' => $this->getLang($posAccount, $order),
'MOTO' => self::MOTO,
Expand Down
17 changes: 7 additions & 10 deletions src/DataMapper/RequestDataMapper/KuveytPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class KuveytPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_CANCEL => 'SaleReversal',
PosInterface::TX_TYPE_STATUS => 'GetMerchantOrderDetail',
PosInterface::TX_TYPE_REFUND => 'Drawback', // Also there is a "PartialDrawback"
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_CANCEL => 'SaleReversal',
PosInterface::TX_TYPE_STATUS => 'GetMerchantOrderDetail',
PosInterface::TX_TYPE_REFUND => 'Drawback',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'PartialDrawback',
];

/**
Expand Down Expand Up @@ -309,13 +310,10 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* @param KuveytPosAccount $posAccount
* {@inheritDoc}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

$isPartialRefund = isset($order['order_amount']) && $order['order_amount'] > $order['amount'];
$txType = $isPartialRefund ? 'PartialDrawback' : $this->mapTxType(PosInterface::TX_TYPE_REFUND);

$result = [
'IsFromExternalNetwork' => true,
'BusinessKey' => 0,
Expand All @@ -337,7 +335,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o
'SubMerchantId' => 0,
'CardType' => $this->cardTypeMapping[CreditCardInterface::CARD_TYPE_VISA], //Default gönderilebilir.
'BatchID' => 0,
'TransactionType' => $txType,
'TransactionType' => $this->mapTxType($refundTxType),
'InstallmentCount' => 0,
'Amount' => $this->formatAmount($order['amount']),
'DisplayAmount' => 0,
Expand Down Expand Up @@ -466,7 +464,6 @@ protected function prepareRefundOrder(array $order): array
'auth_code' => $order['auth_code'],
'transaction_id' => $order['transaction_id'],
'amount' => $order['amount'],
'order_amount' => $order['order_amount'] ?? null,
'currency' => $order['currency'] ?? PosInterface::CURRENCY_TRY,
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class PayFlexCPV4PosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capture',
PosInterface::TX_TYPE_CANCEL => 'Cancel',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_HISTORY => 'TxnHistory',
PosInterface::TX_TYPE_STATUS => 'OrderInquiry',
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capture',
PosInterface::TX_TYPE_CANCEL => 'Cancel',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'Refund',
PosInterface::TX_TYPE_HISTORY => 'TxnHistory',
PosInterface::TX_TYPE_STATUS => 'OrderInquiry',
];

/**
Expand Down Expand Up @@ -241,12 +242,12 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* @return array{MerchantId: string, Password: string, TransactionType: string, ReferenceTransactionId: string,
* ClientIp: string, CurrencyAmount: string}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

return $this->getRequestAccountData($posAccount) + [
'TransactionType' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'TransactionType' => $this->mapTxType($refundTxType),
'ReferenceTransactionId' => (string) $order['transaction_id'],
'ClientIp' => (string) $order['ip'],
'CurrencyAmount' => $this->formatAmount($order['amount']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ class PayFlexV4PosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capture',
PosInterface::TX_TYPE_CANCEL => 'Cancel',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_STATUS => 'status',
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capture',
PosInterface::TX_TYPE_CANCEL => 'Cancel',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'Refund',
PosInterface::TX_TYPE_STATUS => 'status',
];

/**
Expand Down Expand Up @@ -233,14 +234,14 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* @return array{MerchantId: string, Password: string, TransactionType: string, ReferenceTransactionId: string,
* ClientIp: string, CurrencyAmount: string}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

return [
'MerchantId' => $posAccount->getClientId(),
'Password' => $posAccount->getPassword(),
'TransactionType' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'TransactionType' => $this->mapTxType($refundTxType),
'ReferenceTransactionId' => (string) $order['transaction_id'],
'ClientIp' => (string) $order['ip'],
'CurrencyAmount' => $this->formatAmount($order['amount']),
Expand Down
19 changes: 10 additions & 9 deletions src/DataMapper/RequestDataMapper/PayForPosRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ class PayForPosRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_HISTORY => 'TxnHistory',
PosInterface::TX_TYPE_STATUS => 'OrderInquiry',
PosInterface::TX_TYPE_PAY_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'PreAuth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'PostAuth',
PosInterface::TX_TYPE_CANCEL => 'Void',
PosInterface::TX_TYPE_REFUND => 'Refund',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'Refund',
PosInterface::TX_TYPE_HISTORY => 'TxnHistory',
PosInterface::TX_TYPE_STATUS => 'OrderInquiry',
];

/**
Expand Down Expand Up @@ -155,7 +156,7 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
* {@inheritDoc}
* @return array{MbrId: string, SecureType: string, Lang: string, OrgOrderId: string, TxnType: string, PurchAmount: string, Currency: string, MerchantId: string, UserCode: string, UserPass: string}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

Expand All @@ -164,7 +165,7 @@ public function createRefundRequestData(AbstractPosAccount $posAccount, array $o
'SecureType' => $this->secureTypeMappings[PosInterface::MODEL_NON_SECURE],
'Lang' => $this->getLang($posAccount, $order),
'OrgOrderId' => (string) $order['id'],
'TxnType' => $this->mapTxType(PosInterface::TX_TYPE_REFUND),
'TxnType' => $this->mapTxType($refundTxType),
'PurchAmount' => (string) $order['amount'],
'Currency' => $this->mapCurrency($order['currency']),
];
Expand Down
17 changes: 9 additions & 8 deletions src/DataMapper/RequestDataMapper/PosNetRequestDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ class PosNetRequestDataMapper extends AbstractRequestDataMapper
* {@inheritDoc}
*/
protected array $txTypeMappings = [
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capt',
PosInterface::TX_TYPE_CANCEL => 'reverse',
PosInterface::TX_TYPE_REFUND => 'return',
PosInterface::TX_TYPE_STATUS => 'agreement',
PosInterface::TX_TYPE_PAY_AUTH => 'Sale',
PosInterface::TX_TYPE_PAY_PRE_AUTH => 'Auth',
PosInterface::TX_TYPE_PAY_POST_AUTH => 'Capt',
PosInterface::TX_TYPE_CANCEL => 'reverse',
PosInterface::TX_TYPE_REFUND => 'return',
PosInterface::TX_TYPE_REFUND_PARTIAL => 'return',
PosInterface::TX_TYPE_STATUS => 'agreement',
];

/**
Expand Down Expand Up @@ -201,11 +202,11 @@ public function createCancelRequestData(AbstractPosAccount $posAccount, array $o
*
* {@inheritDoc}
*/
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order): array
public function createRefundRequestData(AbstractPosAccount $posAccount, array $order, string $refundTxType): array
{
$order = $this->prepareRefundOrder($order);

$txType = $this->mapTxType(PosInterface::TX_TYPE_REFUND);
$txType = $this->mapTxType($refundTxType);
$requestData = [
'mid' => $posAccount->getClientId(),
'tid' => $posAccount->getTerminalId(),
Expand Down
Loading

0 comments on commit a907693

Please sign in to comment.