Commit ea88fdba authored by Antonio.Suerte's avatar Antonio.Suerte

User Update Notifier Integration

parent f07f5c52
......@@ -49,7 +49,6 @@ class LogicSetting extends SettingModelClass {
if($this -> getAction() == NO_STRING
&& $this -> getType() == TYPE_COMPLETE) { // プロフィール登録
$this -> updateProfile();
} else if($this -> getAction() == CONTROL_SETTING_KYC
&& $this -> getType() == TYPE_SAVE) { // KYC登録(個人)
$this -> load();
......@@ -154,12 +153,17 @@ class LogicSetting extends SettingModelClass {
// メール送信用にデータを取得しておく
$rs = $this -> getAccountCommon($this -> getUserData(PARAM_USER_ACCOUNT));
$row = $this -> getRowData($rs);
$params = $this -> getUpdateDataProfile();
// データの登録
$this -> accessModify('UPDATE_USER_PROFILE', $params);
$userUpdate = $this -> accessModify('UPDATE_USER_PROFILE', $params);
if(!$userUpdate)
return;
$this -> notifyChangesToSlack($row, $params);
// 旧データの取得
$sendParams[] = $params[NO_COUNT]; // 口座番号
$sendParams[] = $this -> getColumnData($row, COLUMN_LAST_NAME)
......@@ -177,8 +181,7 @@ class LogicSetting extends SettingModelClass {
$sendParams[] = $this -> getColumnData($row, COLUMN_ADDRESS); // 住所
$sendParams[] = $this -> getColumnData($row, COLUMN_ZIP_CODE); // 郵便番号
$sendParams[] = $this -> getColumnData($row, COLUMN_TEL); // 電話番号
// CRM連携(更新)
$this -> crmUpdateRecords($this -> getUpdateDataCRM());
......@@ -196,6 +199,72 @@ class LogicSetting extends SettingModelClass {
, VAR_NOTICE_MAIL_ADDRESS);
}
private function notifyChangesToSlack($previous, $changes){
$changes = [
"Country" => [
"old" => $previous[PARAM_COUNTRY],
"new" => $changes[VAL_INT_7]
],
"State" => [
"old" => $previous[PARAM_STATE],
"new" => $changes[VAL_INT_1]
],
"City" => [
"old" => $previous[PARAM_CITY],
"new" => $changes[VAL_INT_2]
],
"Address" => [
"old" => $previous[PARAM_ADDRESS],
"new" => $changes[VAL_INT_4]
],
"Zip Code" => [
"old" => $previous[PARAM_ZIP_CODE],
"new" => $changes[VAL_INT_3]
],
"Tel. No" => [
"old" => $previous[PARAM_TEL],
"new" => $changes[VAL_INT_6]
]
];
$fullName = "{$previous[PARAM_FIRST_NAME]} {$previous[PARAM_LAST_NAME]}";
$updateDetails = "User-Profile Updated: ({$fullName} - {$previous[PARAM_USER_ACCOUNT]})\n\n";
foreach($changes as $key => $change){
$indication = ($change["old"] == $change["new"]
? "Same"
: "{$change["old"]} -> {$change["new"]}");
$updateDetails .= "{$key}: {$indication}\n";
}
$message = ["text" => $updateDetails];
$slackChannels = $this -> getSettingConfiguration("slack_notif_channel");
$handle = curl_init();
curl_setopt_array($handle, [
CURLOPT_URL => $slackChannels -> user_details_channel,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "utf8",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_POSTFIELDS => json_encode($message),
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-type: application/json",
]
]);
curl_exec($handle);
if($err = curl_error($handle))
echo $err;
curl_close($handle);
}
/*-------------------------------------------------------------------------
* @function_name: ユーザプロフィール画像のアップロード
* @parameter : なし
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment