Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize and format codebase #139

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions samples/clone_stored_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
require_once('config/sample_config.php');

$request = array(
'sourceCardUserKey' => 'fac377f2-ab15-4696-88d2-5e71b27ec378',
'sourceCardToken' => '11a078c4-3c32-4796-90b1-51ee5517a212',
'targetMerchantId' => 1,
'sourceCardUserKey' => 'fac377f2-ab15-4696-88d2-5e71b27ec378',
'sourceCardToken' => '11a078c4-3c32-4796-90b1-51ee5517a212',
'targetMerchantId' => 1,
);

$response = SampleConfig::craftgate()->payment()->cloneCard($request);
Expand Down
1 change: 0 additions & 1 deletion samples/create_member_as_buyer_and_sub_merchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_once('config/sample_config.php');

use Craftgate\Model\MemberType;
use Craftgate\Model\SettlementEarningsDestination;
use Craftgate\Util\Guid;

$request = array(
Expand Down
4 changes: 0 additions & 4 deletions samples/create_merchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

require_once('config/sample_config.php');

use Craftgate\Model\MemberType;
use Craftgate\Model\SettlementEarningsDestination;
use Craftgate\Util\Guid;

$request = array(
'name' => "newMerchant",
'legalCompanyTitle' => "legalCompanyTitle",
Expand Down
8 changes: 0 additions & 8 deletions samples/delete_merchant_pos.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

use Craftgate\Model\CardAssociation;
use Craftgate\Model\Currency;
use Craftgate\Model\PaymentAuthenticationType;
use Craftgate\Model\PosIntegrator;
use Craftgate\Model\PosOperationType;
use Craftgate\Model\PosStatus;
use Craftgate\Model\PosUserType;

require_once('config/sample_config.php');


Expand Down
2 changes: 0 additions & 2 deletions samples/init_apm_deposit_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

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

$request = array(
'apmType' => ApmType::PAPARA,
Expand Down
2 changes: 1 addition & 1 deletion samples/init_bizum_apm_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)
),
'additionalParams' => array(
'buyerPhoneNumber' => "34700000000",
'buyerPhoneNumber' => "34700000000",
)
);

Expand Down
2 changes: 1 addition & 1 deletion samples/init_iwallet_apm_payment_with_card_password.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'callbackUrl' => 'https://www.your-website.com/craftgate-apm-callback',
'apmUserIdentity' => '1111222233334444',
'additionalParams' => array(
"otpCode" => "1122"
"otpCode" => "1122"
),
'items' => array(
array(
Expand Down
4 changes: 2 additions & 2 deletions samples/init_juzdan_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

require_once('config/sample_config.php');

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

$request = array(
Expand Down Expand Up @@ -47,6 +47,6 @@
'loanCampaignId' => 1
);

$response = SampleConfig::craftgate()->juzdan()-> initJuzdanPayment($request);
$response = SampleConfig::craftgate()->juzdan()->initJuzdanPayment($request);

print_r($response);
40 changes: 20 additions & 20 deletions samples/init_metropol_apm_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
use Craftgate\Util\Guid;

$request = array(
'apmType' => ApmType::METROPOL,
'price' => 1,
'paidPrice' => 1,
'currency' => Currency::TL,
'paymentGroup' => PaymentGroup::LISTING_OR_SUBSCRIPTION,
'conversationId' => 'myConversationId',
'externalId' => 'optional-externalId',
'items' => array(
array(
'externalId' => Guid::generate(),
'name' => 'Item 1',
'price' => 0.40
),
array(
'externalId' => Guid::generate(),
'name' => 'Item 2',
'price' => 0.60
)
'apmType' => ApmType::METROPOL,
'price' => 1,
'paidPrice' => 1,
'currency' => Currency::TL,
'paymentGroup' => PaymentGroup::LISTING_OR_SUBSCRIPTION,
'conversationId' => 'myConversationId',
'externalId' => 'optional-externalId',
'items' => array(
array(
'externalId' => Guid::generate(),
'name' => 'Item 1',
'price' => 0.40
),
'additionalParams' => array(
'cardNumber' => '6375780115068760'
array(
'externalId' => Guid::generate(),
'name' => 'Item 2',
'price' => 0.60
)
),
'additionalParams' => array(
'cardNumber' => '6375780115068760'
)
);

$response = SampleConfig::craftgate()->payment()->initApmPayment($request);
Expand Down
2 changes: 1 addition & 1 deletion samples/init_paymob_apm_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
),
'additionalParams' => array(
'integrationId' => '11223344'
),
),
);

$response = SampleConfig::craftgate()->payment()->initApmPayment($request);
Expand Down
2 changes: 1 addition & 1 deletion samples/init_ykb_world_pay_pos_apm_payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require_once('config/sample_config.php');

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

$request = array(
Expand Down
7 changes: 0 additions & 7 deletions samples/retrieve_merchant_pos.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php

use Craftgate\Model\Currency;
use Craftgate\Model\PaymentAuthenticationType;
use Craftgate\Model\PosIntegrator;
use Craftgate\Model\PosOperationType;
use Craftgate\Model\PosStatus;
use Craftgate\Model\PosUserType;

require_once('config/sample_config.php');


Expand Down
8 changes: 0 additions & 8 deletions samples/retrieve_merchant_pos_commissions.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

use Craftgate\Model\CardAssociation;
use Craftgate\Model\Currency;
use Craftgate\Model\PaymentAuthenticationType;
use Craftgate\Model\PosIntegrator;
use Craftgate\Model\PosOperationType;
use Craftgate\Model\PosStatus;
use Craftgate\Model\PosUserType;

require_once('config/sample_config.php');


Expand Down
1 change: 0 additions & 1 deletion samples/search_payout_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Craftgate\Model\AccountOwner;
use Craftgate\Model\Currency;
use Craftgate\Model\PayoutAccountType;

$request = array(
'currency' => Currency::USD,
Expand Down
6 changes: 0 additions & 6 deletions samples/update_merchant_pos_status.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?php

use Craftgate\Model\CardAssociation;
use Craftgate\Model\Currency;
use Craftgate\Model\PaymentAuthenticationType;
use Craftgate\Model\PosIntegrator;
use Craftgate\Model\PosOperationType;
use Craftgate\Model\PosStatus;
use Craftgate\Model\PosUserType;

require_once('config/sample_config.php');

Expand Down
2 changes: 0 additions & 2 deletions samples/update_payout_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

require_once('config/sample_config.php');

use Craftgate\Model\AccountOwner;
use Craftgate\Model\Currency;
use Craftgate\Model\PayoutAccountType;

$request = array(
Expand Down
2 changes: 1 addition & 1 deletion samples/verify_webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
'payloadId' => '584'
);

$isVerified = SampleConfig::craftgate()->hook()->isWebhookVerified($merchantHookKey,$incomingSignature, $webhookData);
$isVerified = SampleConfig::craftgate()->hook()->isWebhookVerified($merchantHookKey, $incomingSignature, $webhookData);

print_r($isVerified);
3 changes: 0 additions & 3 deletions src/Adapter/MasterpassPaymentAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Craftgate\Adapter;

use Craftgate\Util\QueryBuilder;
use Craftgate\Util\Signature;

class MasterpassPaymentAdapter extends BaseAdapter
{
public function checkMasterpassUser(array $request)
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/PaymentAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ public function initBnplPayment(array $request)

public function approveBnplPayment($paymentId)
{
$path = "/payment/v1/bnpl-payments/" . $paymentId . "/approve";
$path = "/payment/v1/bnpl-payments/" . $paymentId . "/approve";
return $this->httpPost($path);
}

public function verifyBnplPayment(array $request)
{
$path = "/payment/v1/bnpl-payments/verify";
$path = "/payment/v1/bnpl-payments/verify";
return $this->httpPost($path, $request);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/SettlementAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function createPayoutAccount(array $request)
return $this->httpPost($path, $request);
}

public function updatePayoutAccount($id,array $request)
public function updatePayoutAccount($id, array $request)
{
$path = "/settlement/v1/payout-accounts/" . $id;
return $this->httpPut($path, $request);
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/WalletAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function searchWalletTransactions($walletId, array $request)

public function updateMemberWallet($memberId, $walletId, array $request)
{
$path = "/wallet/v1/members/" . $memberId . "/wallets/". $walletId;
$path = "/wallet/v1/members/" . $memberId . "/wallets/" . $walletId;
return $this->httpPut($path, $request);
}

Expand Down
1 change: 1 addition & 0 deletions src/Craftgate.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function juzdan()
{
return new JuzdanPaymentAdapter($this->options);
}

public function bkmExpress()
{
return new BkmExpressPaymentAdapter($this->options);
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public static function generateHash($hashString)

public static function generateWebhookSignature($merchantHookKey, $hashString)
{
return base64_encode(hash_hmac('sha256', $hashString, $merchantHookKey,true));
return base64_encode(hash_hmac('sha256', $hashString, $merchantHookKey, true));
}
}