Skip to content

Commit 3b96b34

Browse files
committed
Merge branch 'master' of https://github.com/ashtru/sdk-php into loggingObjects
Conflicts: lib/net/authorize/util/Log.php
2 parents 80c03b2 + 0cb22dd commit 3b96b34

3 files changed

Lines changed: 34 additions & 11 deletions

File tree

lib/net/authorize/api/controller/base/ApiOperationBase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ public function executeWithApiResponse($endPoint = \net\authorize\api\constants\
111111
public function execute($endPoint = \net\authorize\api\constants\ANetEnvironment::CUSTOM)
112112
{
113113
$this->beforeExecute();
114-
// $this->logger->debugFormat("Request object :%s", $this->apiRequest);
115-
$this->logger->debug($this->apiRequest);
114+
116115
$this->logger->info("Request Serialization Begin");
117116
$xmlRequest = $this->serializer->serialize($this->apiRequest, 'xml');
118117
$this->logger->info("Request Serialization End");

lib/net/authorize/util/ANetSensitiveFields.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ private static function getDefaulSensitiveXmlTags(){
1919
}
2020
public static function getSensitiveXmlTags(){
2121
$sensitiveTags = array();
22-
if (file_exists(ANET_SENSITIVE_XMLTAGS_JSON_FILE)) {
22+
$configFilePath = dirname(__FILE__) . "/" . ANET_SENSITIVE_XMLTAGS_JSON_FILE;
23+
$userConfigFilePath = ANET_SENSITIVE_XMLTAGS_JSON_FILE;
24+
if (file_exists($userConfigFilePath)) { //client config for tags
2325
//read list of tags(and associate regex-patterns and replacements) from .json file
24-
$sensitiveTags = json_decode(file_get_contents(ANET_SENSITIVE_XMLTAGS_JSON_FILE));
25-
if (json_last_error() === JSON_ERROR_NONE) {
26-
// JSON is valid
26+
$sensitiveTags = json_decode(file_get_contents($configFilePath));
27+
if (json_last_error() === JSON_ERROR_NONE) {// JSON is valid
2728
}
2829
else{
29-
echo "ERROR: Invalid json in: " . ANET_SENSITIVE_XMLTAGS_JSON_FILE . " json_last_error_msg : " . json_last_error_msg();
30+
echo "ERROR: Invalid json in: " . $userConfigFilePath . " json_last_error_msg : " . json_last_error_msg();
3031
return self::getDefaulSensitiveXmlTags();
3132
}
3233
}
33-
else {
34-
// if not present, create a local config file
35-
$sensitiveTags = self::getDefaulSensitiveXmlTags();
36-
file_put_contents(ANET_SENSITIVE_XMLTAGS_JSON_FILE, json_encode($sensitiveTags, JSON_PRETTY_PRINT));
34+
else if (file_exists($configFilePath)) { //default sdk config for tags
35+
$sensitiveTags = json_decode(file_get_contents($configFilePath));
36+
if (json_last_error() === JSON_ERROR_NONE) {
37+
}
38+
else{
39+
exit("ERROR: Invalid json in: " . $configFilePath . " json_last_error_msg : " . json_last_error_msg());
40+
}
3741
}
3842
//Check for disableMask flag in case of client json.
3943
$applySensitiveTags = array();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"tagName": "cardCode",
4+
"pattern": "",
5+
"replacement": "",
6+
"disableMask": false
7+
},
8+
{
9+
"tagName": "cardNumber",
10+
"pattern": "^(\\d+)(\\d{4})$",
11+
"replacement": "$xxxx-$3$4",
12+
"disableMask": false
13+
},
14+
{
15+
"tagName": "expirationDate",
16+
"pattern": "",
17+
"replacement": "",
18+
"disableMask": false
19+
}
20+
]

0 commit comments

Comments
 (0)