Skip to content

Commit d7c4fb9

Browse files
committed
remove unused headers & encode additionnal data in CustomField when making the request :)
1 parent 8c0a738 commit d7c4fb9

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/PayTech.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function send(InvoiceItem $invoiceItem)
2828
'ipn_url' => Config::getIpnUrl(),
2929
'success_url' => Config::getIsMobile() ? Config::MOBILE_SUCCESS_URL : Config::getSuccessUrl(),
3030
'cancel_url' => Config::getIsMobile() ? Config::MOBILE_CANCEL_URL : Config::getCancelUrl(),
31-
'custom_field' => CustomField::retrieve()
31+
'custom_field' => json_encode(CustomField::retrieve())
3232
], []);
3333

3434
// @codeCoverageIgnoreStart

src/Utils/Check.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,26 @@
1111
abstract class Check
1212
{
1313

14-
const authorizeCurrency = [
14+
const authorizedCurrency = [
1515
'XOF',
1616
'USD',
1717
'CAD',
1818
'GBP',
1919
'MAD'
2020
];
2121

22+
const autorizedEnv = [
23+
'TEST',
24+
'PROD'
25+
];
26+
2227
public static function isCurrencyAllowed($currency)
2328
{
24-
return array_search($currency, self::authorizeCurrency);
29+
return array_search($currency, self::authorizedCurrency);
30+
}
31+
32+
public static function isEnvAllowed($env)
33+
{
34+
return array_search($$env, self::autorizedEnv);
2535
}
2636
}

src/Utils/MakeRequest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ public static function json($url, $data = [], $headers = [])
4141
{
4242
self::setHeaders([
4343
'Content-Type' => 'application/json;charset=utf-8',
44-
'PAYTECH-ENV' => \PayTech\Config::getEnv(),
45-
'User-Agent' => \PayTech\PayTech::VERSION_NAME,
4644
'API_KEY' => \PayTech\Config::getApiKey(),
4745
'API_SECRET' => \PayTech\Config::getApiSecret()
4846

@@ -61,8 +59,6 @@ public static function post($url, $data = [], $headers = [])
6159
{
6260
self::setHeaders([
6361
'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
64-
'PAYTECH-ENV' => \PayTech\Config::getEnv(),
65-
'User-Agent' => \PayTech\PayTech::VERSION_NAME,
6662
'API_KEY' => \PayTech\Config::getApiKey(),
6763
'API_SECRET' => \PayTech\Config::getApiSecret()
6864
]);
@@ -77,8 +73,6 @@ public static function post($url, $data = [], $headers = [])
7773
public static function get($url, $headers = [])
7874
{
7975
self::setHeaders([
80-
'PAYTECH-ENV' => \PayTech\Config::getEnv(),
81-
'User-Agent' => \PayTech\PayTech::VERSION_NAME,
8276
'API_KEY' => \PayTech\Config::getApiKey(),
8377
'API_SECRET' => \PayTech\Config::getApiSecret()
8478
]);

0 commit comments

Comments
 (0)