diff --git a/examples/finansbank-payfor/3d-host/_config.php b/examples/finansbank-payfor/3d-host/_config.php index 12a70e67..cfaaadca 100644 --- a/examples/finansbank-payfor/3d-host/_config.php +++ b/examples/finansbank-payfor/3d-host/_config.php @@ -17,14 +17,6 @@ 'store_key' => '12345678', //MerchantPass only needed for 3D payment 'env' => 'test', 'lang' => \Mews\Pos\PayForPos::LANG_EN, - 'customData' => (object) [ - /** - * 0 : İşlemin E-commerce olduğunu ifade eder. - * 1 : İşlemin MO TO olduğunu ifade ede - */ - 'moto' => '0', - 'mbrId' => 5, //Kurum Kodu - ] ]; try { diff --git a/examples/finansbank-payfor/3d-pay/_config.php b/examples/finansbank-payfor/3d-pay/_config.php index a71485db..4c2bddde 100644 --- a/examples/finansbank-payfor/3d-pay/_config.php +++ b/examples/finansbank-payfor/3d-pay/_config.php @@ -17,14 +17,6 @@ 'store_key' => '12345678', //MerchantPass only needed for 3D payment 'env' => 'test', 'lang' => \Mews\Pos\PayForPos::LANG_EN, - 'customData' => (object) [ - /** - * 0 : İşlemin E-commerce olduğunu ifade eder. - * 1 : İşlemin MO TO olduğunu ifade ede - */ - 'moto' => '0', - 'mbrId' => 5, //Kurum Kodu - ] ]; try { diff --git a/examples/finansbank-payfor/3d/_config.php b/examples/finansbank-payfor/3d/_config.php index c7782539..87107e9a 100644 --- a/examples/finansbank-payfor/3d/_config.php +++ b/examples/finansbank-payfor/3d/_config.php @@ -17,14 +17,6 @@ 'store_key' => '12345678', //MerchantPass only needed for 3D payment 'env' => 'test', 'lang' => \Mews\Pos\PayForPos::LANG_EN, - 'customData' => (object) [ - /** - * 0 : İşlemin E-commerce olduğunu ifade eder. - * 1 : İşlemin MO TO olduğunu ifade ede - */ - 'moto' => '0', - 'mbrId' => 5, //Kurum Kodu - ] ]; try { diff --git a/examples/finansbank-payfor/regular/_config.php b/examples/finansbank-payfor/regular/_config.php index 1096cd4f..526dfdbc 100644 --- a/examples/finansbank-payfor/regular/_config.php +++ b/examples/finansbank-payfor/regular/_config.php @@ -16,14 +16,6 @@ 'password' => 'UcBN0', 'env' => 'test', 'lang' => \Mews\Pos\PayForPos::LANG_EN, - 'customData' => (object) [ - /** - * 0 : İşlemin E-commerce olduğunu ifade eder. - * 1 : İşlemin MO TO olduğunu ifade ede - */ - 'moto' => '0', - 'mbrId' => 5, //Kurum Kodu - ] ]; try { diff --git a/src/PayForPos.php b/src/PayForPos.php index 85281263..c3f69628 100644 --- a/src/PayForPos.php +++ b/src/PayForPos.php @@ -25,6 +25,23 @@ class PayForPos implements PosInterface const LANG_TR = 'tr'; const LANG_EN = 'en'; + /** + * Kurum kodudur. (Banka tarafından verilir) + */ + const MBR_ID = '5'; + + /** + * MOTO (Mail Order Telephone Order) 0 for false, 1 for true + */ + const MOTO = '0'; + + /** + * Raw Response Data + * + * @var object + */ + protected $data; + /** * Response Codes * @@ -99,12 +116,6 @@ class PayForPos implements PosInterface */ private $response; - /** - * Raw Response Data - * - * @var object - */ - protected $data; public function __construct($config, $account, array $currencies) { @@ -470,7 +481,7 @@ public function createXML(array $data, $encoding = 'UTF-8'): string */ public function create3DHash() { - $hashStr = $this->account->customData->mbrId . $this->order->id + $hashStr = self::MBR_ID . $this->order->id . $this->order->amount . $this->order->success_url . $this->order->fail_url . $this->type . $this->order->installment . $this->order->rand @@ -746,11 +757,11 @@ protected function getDefaultPaymentResponse() protected function createRegularPaymentXML() { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, - 'MOTO' => $this->account->customData->moto, + 'MOTO' => self::MOTO, 'OrderId' => $this->order->id, 'SecureType' => 'NonSecure', 'TxnType' => $this->type, @@ -775,11 +786,11 @@ protected function createRegularPaymentXML() protected function createRegularPostXML() { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, - 'MOTO' => $this->account->customData->moto, + 'MOTO' => self::MOTO, 'OrgOrderId' => $this->order->id, 'SecureType' => 'NonSecure', 'TxnType' => $this->type, @@ -822,7 +833,7 @@ protected function create3DPaymentXML($responseData) protected function createOrderStatusXML() { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, @@ -843,7 +854,7 @@ protected function createOrderStatusXML() protected function createRefundXML() { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, @@ -866,7 +877,7 @@ protected function createRefundXML() protected function createCancelXML() { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, @@ -891,7 +902,7 @@ protected function createCancelXML() protected function createHistoryXML($customQueryData) { $requestData = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantId' => $this->account->client_id, 'UserCode' => $this->account->username, 'UserPass' => $this->account->password, @@ -918,7 +929,7 @@ protected function createHistoryXML($customQueryData) protected function getCommon3DFormData($withCrediCard = false) { $inputs = [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => self::MBR_ID, 'MerchantID' => $this->account->client_id, 'UserCode' => $this->account->username, 'OrderId' => $this->order->id, diff --git a/tests/PayForTest.php b/tests/PayForTest.php index 9d7edb3b..c58d1b87 100644 --- a/tests/PayForTest.php +++ b/tests/PayForTest.php @@ -39,14 +39,6 @@ protected function setUp(): void 'store_key' => '12345678', //MerchantPass only needed for 3D payment 'env' => 'test', 'lang' => PayForPos::LANG_EN, - 'customData' => (object) [ - /** - * 0 : İşlemin E-commerce olduğunu ifade eder. - * 1 : İşlemin MO TO olduğunu ifade ede - */ - 'moto' => '0', - 'mbrId' => 5, //Kurum Kodu - ], ]; $this->card = new CreditCardPayFor('5555444433332222', '22', '01', '123', 'ahmet'); @@ -95,7 +87,7 @@ public function testGet3DFormData() $form = [ 'gateway' => $this->config['banks'][$this->account->bank]['urls']['gateway'][$this->account->env], 'inputs' => [ - 'MbrId' => $this->account->customData->mbrId, + 'MbrId' => PayForPos::MBR_ID, 'MerchantID' => $this->account->client_id, 'UserCode' => $this->account->username, 'OrderId' => $this->order->id,