Skip to content

Commit

Permalink
Add BKM Express Integration (#126)
Browse files Browse the repository at this point in the history
* BKM Express Integration

* Abb BKM Express Integration
  • Loading branch information
deryacakmak committed Jul 3, 2024
1 parent 2772c49 commit 832cf42
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
13 changes: 13 additions & 0 deletions samples/complete_bkm_express_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

require_once('config/sample_config.php');

$request = array(
'status' => true,
'message' => 'İşlem Başarılı',
'ticketId' => 'dcfdc163-0545-46d7-8f86-5a11718e56ec'
);

$response = SampleConfig::craftgate()->bkmExpress()->complete($request);

print_r($response);
36 changes: 36 additions & 0 deletions samples/init_bkm_express_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require_once('config/sample_config.php');

use Craftgate\Model\Currency;
use Craftgate\Model\PaymentGroup;
use Craftgate\Util\Guid;

$request = array(
'price' => 100,
'paidPrice' => 100,
'currency' => Currency::TL,
'paymentGroup' => PaymentGroup::LISTING_OR_SUBSCRIPTION,
'conversationId' => '456d1297-908e-4bd6-a13b-4be31a6e47d5',
'items' => array(
array(
'externalId' => Guid::generate(),
'name' => 'Item 1',
'price' => 30
),
array(
'externalId' => Guid::generate(),
'name' => 'Item 2',
'price' => 50
),
array(
'externalId' => Guid::generate(),
'name' => 'Item 3',
'price' => 20
)
)
);

$response = SampleConfig::craftgate()->bkmExpress()->init($request);

print_r($response);
7 changes: 7 additions & 0 deletions samples/retrieve_bkm_express_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

require_once('config/sample_config.php');

$response = SampleConfig::craftgate()->bkmExpress()->retrievePayment("dcfdc163-0545-46d7-8f86-5a11718e56ec");

print_r($response);
24 changes: 24 additions & 0 deletions src/Adapter/BkmExpressPaymentAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Craftgate\Adapter;

class BkmExpressPaymentAdapter extends BaseAdapter
{
public function init(array $request)
{
$path = "/payment/v1/bkm-express/init";
return $this->httpPost($path, $request);
}

public function complete(array $request)
{
$path = "/payment/v1/bkm-express/complete";
return $this->httpPost($path, $request);
}

public function retrievePayment($ticketId)
{
$path = "/payment/v1/bkm-express/payments/" . $ticketId;
return $this->httpGet($path);
}
}
5 changes: 5 additions & 0 deletions src/Craftgate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Craftgate;

use Craftgate\Adapter\BankAccountTrackingAdapter;
use Craftgate\Adapter\BkmExpressPaymentAdapter;
use Craftgate\Adapter\FileReportingAdapter;
use Craftgate\Adapter\FraudAdapter;
use Craftgate\Adapter\HookAdapter;
Expand Down Expand Up @@ -124,4 +125,8 @@ public function juzdan()
{
return new JuzdanPaymentAdapter($this->options);
}
public function bkmExpress()
{
return new BkmExpressPaymentAdapter($this->options);
}
}
1 change: 1 addition & 0 deletions src/Model/PaymentAuthenticationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ class PaymentAuthenticationType
{
const THREE_DS = 'THREE_DS';
const NON_THREE_DS = 'NON_THREE_DS';
const BKM_EXPRESS = 'BKM_EXPRESS';
}

0 comments on commit 832cf42

Please sign in to comment.