Browse Source

クレジットカード対応

develop
sosuke.iwabuchi 1 year ago
parent
commit
05f01a7828
18 changed files with 128 additions and 34 deletions
  1. +1
    -0
      package.json
  2. +2
    -1
      src/apps/入金予定結果/index.tsx
  3. +66
    -0
      src/apps/各種申請/buttons/クレジットカード登録承認ボタン.ts
  4. +17
    -16
      src/apps/各種申請/buttons/口座変更承認ボタン.ts
  5. +3
    -6
      src/apps/各種申請/buttons/駐車場利用方法変更承認ボタン.ts
  6. +3
    -1
      src/apps/各種申請/index.tsx
  7. +3
    -1
      src/common/message.ts
  8. +1
    -1
      src/common/rest-api-client.ts
  9. +1
    -1
      src/mypage/lib.ts
  10. +1
    -0
      src/mypage/メール.ts
  11. +1
    -1
      src/rest-api/bulk.ts
  12. +1
    -1
      src/rest-api/url.ts
  13. +1
    -1
      src/rest-api/顧客マスタ.ts
  14. +3
    -1
      src/types/入金予定結果.ts
  15. +6
    -0
      src/types/各種申請.ts
  16. +3
    -2
      tsconfig.json
  17. +7
    -0
      webpack.config.js
  18. +8
    -1
      yarn.lock

+ 1
- 0
package.json View File

@@ -36,6 +36,7 @@
"eslint": "^6.8.0",
"fork-ts-checker-webpack-plugin": "^5.2.0",
"glob": "^7.1.6",
"lodash-webpack-plugin": "^0.11.6",
"ts-loader": "^8.0.17",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^4.1.2",


+ 2
- 1
src/apps/入金予定結果/index.tsx View File

@@ -19,7 +19,8 @@ import { 定期申込予約フィールド名 } from "@/types/定期申込予約
import { 顧客マスタフィールド名 } from "@/types/顧客マスタ";
import { KintoneRestAPIClient } from "@kintone/rest-api-client";
import { addDays, format, setHours } from "date-fns";
import { get, set } from "lodash";
import get from "lodash/get";
import set from "lodash/set";
import Swal from "sweetalert2";

const client = new KintoneRestAPIClient();


+ 66
- 0
src/apps/各種申請/buttons/クレジットカード登録承認ボタン.ts View File

@@ -0,0 +1,66 @@
import { apptemplate } from "@/common/app-template";
import { AppID } from "@/common/appids";
import { now } from "@/common/datetime";
import { setHeaderButton } from "@/common/header-button";
import { makeDatetimeStr, makeRecordData } from "@/common/rest-api-client";
import { Message } from "@/exception";
import { ShowConfirmDialog, SuccessDialog } from "@/middleware/swal";
import { EmailID, sendEmail } from "@/mypage/メール";
import bulkRequest from "@/rest-api/bulk";
import { get顧客マスタ } from "@/rest-api/顧客マスタ";
import {
各種申請,
各種申請フィールド名,
状況Dropdown,
申請種別Dropdown,
} from "@/types/各種申請";
import { addHours } from "date-fns";
import { v4 as uuidV4 } from "uuid";
import { 各種申請完了 } from "./common";

export const クレジットカード登録承認ボタン = (record: 各種申請) => {
if (
record.状況.value !== 状況Dropdown.完了 &&
record.申請種別.value === 申請種別Dropdown.クレジット支払変更申請
) {
setHeaderButton(
"クレジット支払変更申請 承認",
apptemplate(async ({ needReloadAtEnd }) => {
const confirm = await ShowConfirmDialog({ title: "承認しますか" });
if (!confirm.isConfirmed) return;
// 顧客マスタへの反映
const customer = await get顧客マスタ({
顧客コード: Number(record.顧客コード.value),
});
if (customer === null) throw new Error("顧客不正");

bulkRequest.update({
app: AppID.各種申請,
id: record.$id.value,
record: makeRecordData({
[各種申請フィールド名.クレジット支払変更申請_トークン]: uuidV4(),
[各種申請フィールド名.クレジット支払変更申請_有効期限]:
makeDatetimeStr(addHours(now(), 24)),
}),
});

// 申請の完了
await 各種申請完了(record);

// データ保存
await bulkRequest.save();

// メールの送信
const email = await sendEmail(EmailID.クレジットカード登録, {
application_no: record.申請番号.value,
});
if (!email) {
throw new Message("メール送信失敗 データは反映済み");
}

await SuccessDialog.fire();
needReloadAtEnd(true);
})
);
}
};

+ 17
- 16
src/apps/各種申請/buttons/口座変更承認ボタン.ts View File

@@ -25,26 +25,27 @@ export const 口座変更承認ボタン = (record: 各種申請) => {
});
if (customer === null) throw new Error("顧客不正");

let updateData = makeRecordData({
[顧客マスタフィールド名.口座登録催促予定日時]: "",
[顧客マスタフィールド名.銀行支店コード]:
record.口座変更申請_変更後_銀行支店ID.value,
[顧客マスタフィールド名.引落預金種別]:
record.口座変更申請_変更後_口座種目.value,
[顧客マスタフィールド名.引落口座名義人カナ]:
record.口座変更申請_変更後_口座名義カナ.value,
[顧客マスタフィールド名.引落口座番号]:
record.口座変更申請_変更後_口座番号.value,
[顧客マスタフィールド名.ゆうちょ口座記号]:
record.口座変更申請_変更後_ゆうちょ口座記号.value,
[顧客マスタフィールド名.ゆうちょ口座番号]:
record.口座変更申請_変更後_ゆうちょ口座番号.value,
});

// 顧客マスタへの反映
await bulkRequest.update({
app: AppID.顧客マスタ,
id: customer.$id.value,
record: makeRecordData({
[顧客マスタフィールド名.支払方法]: "口座振替",
[顧客マスタフィールド名.口座登録催促予定日時]: "",
[顧客マスタフィールド名.銀行支店コード]:
record.口座変更申請_変更後_銀行支店ID.value,
[顧客マスタフィールド名.引落預金種別]:
record.口座変更申請_変更後_口座種目.value,
[顧客マスタフィールド名.引落口座名義人カナ]:
record.口座変更申請_変更後_口座名義カナ.value,
[顧客マスタフィールド名.引落口座番号]:
record.口座変更申請_変更後_口座番号.value,
[顧客マスタフィールド名.ゆうちょ口座記号]:
record.口座変更申請_変更後_ゆうちょ口座記号.value,
[顧客マスタフィールド名.ゆうちょ口座番号]:
record.口座変更申請_変更後_ゆうちょ口座番号.value,
}),
record: updateData,
});

// 各種申請の完了


+ 3
- 6
src/apps/各種申請/buttons/駐車場利用方法変更承認ボタン.ts View File

@@ -1,24 +1,21 @@
import { apptemplate } from "@/common/app-template";
import { AppID } from "@/common/appids";
import { setHeaderButton } from "@/common/header-button";
import { MessageBag } from "@/common/message";
import { makeRecordData } from "@/common/rest-api-client";
import { 契約情報更新イベント } from "@/event/契約情報更新";
import { Message } from "@/exception";
import {
ErrorDialog,
FormDialog,
ShowConfirmDialog,
ShowFormDialog,
SuccessDialog,
} from "@/middleware/swal";
import { EmailID, sendEmail } from "@/mypage/メール";
import { 定期契約更新 } from "@/mypage/IC定期";
import bulkRequest from "@/rest-api/bulk";
import { get車室情報管理 } from "@/rest-api/車室情報管理";
import { 各種申請, 状況Dropdown, 申請種別Dropdown } from "@/types/各種申請";
import { 車室情報管理フィールド名 } from "@/types/車室情報管理";
import { 各種申請完了 } from "./common";
import { 定期契約更新 } from "@/mypage/IC定期";
import { Message } from "@/exception";
import { MessageBag } from "@/common/message";

export const 駐車場利用方法変更承認ボタン = (record: 各種申請) => {
if (


+ 3
- 1
src/apps/各種申請/index.tsx View File

@@ -2,7 +2,7 @@ import { eventHnalder } from "@/common/app-template";
import { initMenuBox } from "@/common/header-button";
import { KintoneEvent } from "@/common/kintone-event";
import { 各種申請, 申請詳細グループ } from "@/types/各種申請";
import { get } from "lodash";
import get from "lodash/get";
import { setup } from "..";
import { 口座変更承認ボタン } from "./buttons/口座変更承認ボタン";
import { 解約承認ボタン } from "./buttons/解約承認ボタン";
@@ -10,6 +10,7 @@ import { 利用者情報変更承認ボタン } from "./buttons/利用者情報
import { 車両番号変更承認ボタン } from "./buttons/車両番号変更承認ボタン";
import { 車庫証明発行手数料入金予定作成ボタン } from "./buttons/車庫証明発行手数料入金予定作成ボタン";
import { 駐車場利用方法変更承認ボタン } from "./buttons/駐車場利用方法変更承認ボタン";
import { クレジットカード登録承認ボタン } from "./buttons/クレジットカード登録承認ボタン";

setup(() => {
kintone.events.on(
@@ -25,6 +26,7 @@ setup(() => {
車両番号変更承認ボタン(record);
車庫証明発行手数料入金予定作成ボタン(record);
駐車場利用方法変更承認ボタン(record);
クレジットカード登録承認ボタン(record);
})
);



+ 3
- 1
src/common/message.ts View File

@@ -1,4 +1,6 @@
import { Dictionary } from "lodash";
interface Dictionary<T> {
[index: string]: T;
}

export class MessageBag {
private generalMessage: string = "";


+ 1
- 1
src/common/rest-api-client.ts View File

@@ -1,4 +1,4 @@
import { get } from "lodash";
import get from "lodash/get";
import { formatDateStr } from "./datetime";

export type Field = {


+ 1
- 1
src/mypage/lib.ts View File

@@ -1,7 +1,7 @@
import { myPageConfig } from "@/config/mypage";
import { MyPageApiID } from ".";
import { MessageBag } from "@/common/message";
import { get } from "lodash";
import get from "lodash/get";

type MyPageApiResponse = {
result: "SUCCESS" | "FAILED";


+ 1
- 0
src/mypage/メール.ts View File

@@ -14,6 +14,7 @@ export const EmailID = {
定期選考_当選のお知らせ: "定期選考_当選のお知らせ",
定期選考_落選のお知らせ: "定期選考_落選のお知らせ",
口座振替_未納者通知: "口座振替・未納者通知",
クレジットカード登録: "クレジットカード登録",
} as const;
export type EmailID = (typeof EmailID)[keyof typeof EmailID];



+ 1
- 1
src/rest-api/bulk.ts View File

@@ -1,7 +1,7 @@
import { AppID } from "@/common/appids";
import { Field } from "@/common/rest-api-client";
import { KintoneRestAPIClient } from "@kintone/rest-api-client";
import { chunk } from "lodash";
import chunk from "lodash/chunk";

const UPDATE_PARAM = {
method: "PUT",


+ 1
- 1
src/rest-api/url.ts View File

@@ -1,5 +1,5 @@
import { AppID } from "@/common/appids";
import { get } from "lodash";
import get from "lodash/get";
import { sprintf } from "sprintf";

export const getDetailUrl = (app: AppID, レコード番号: string | number) => {


+ 1
- 1
src/rest-api/顧客マスタ.ts View File

@@ -4,7 +4,7 @@ import { 顧客マスタ, 顧客マスタフィールド名 } from "@/types/顧
import { KintoneRestAPIClient } from "@kintone/rest-api-client";
import { sprintf } from "sprintf";
import { QueryBuilder } from "./query";
import { max } from "lodash";
import max from "lodash/max";

const client = new KintoneRestAPIClient();



+ 3
- 1
src/types/入金予定結果.ts View File

@@ -1,6 +1,8 @@
import { KintoneRecordField } from "@kintone/rest-api-client";
import { AppRecord } from ".";
import { get, has, set } from "lodash";
import get from "lodash/get";
import set from "lodash/set";
import has from "lodash/has";

const F = {
車室情報管理レコード番号: "contract_record_number",


+ 6
- 0
src/types/各種申請.ts View File

@@ -5,6 +5,8 @@ const F = {
申請種別: "申請種別",
申請番号: "申請番号",
状況: "状況",
クレジット支払変更申請_トークン: "クレジット支払変更申請_トークン",
クレジット支払変更申請_有効期限: "クレジット支払変更申請_有効期限",
} as const;

export const 状況Dropdown = {
@@ -24,6 +26,7 @@ export const 申請種別Dropdown = {
口座変更申請: "口座変更申請",
プラン変更: "プラン変更",
IC定期_駐車場利用方法変更申請: "IC定期_駐車場利用方法変更申請",
クレジット支払変更申請: "クレジット支払変更申請",
} as const;
export type 申請種別Dropdown =
(typeof 申請種別Dropdown)[keyof typeof 申請種別Dropdown];
@@ -46,6 +49,7 @@ export const 申請詳細グループ = {
[申請種別Dropdown.プラン変更]: "プラン変更申請",
[申請種別Dropdown.IC定期_駐車場利用方法変更申請]:
"IC定期_駐車場利用方法変更申請",
[申請種別Dropdown.クレジット支払変更申請]: "クレジット支払変更申請",
} as const;
export type 申請詳細グループ =
(typeof 申請詳細グループ)[keyof typeof 申請詳細グループ];
@@ -133,4 +137,6 @@ export type 各種申請 = AppRecord & {
IC定期_駐車場利用方法変更申請_変更前: KintoneRecordField.SingleLineText;
IC定期_駐車場利用方法変更申請_変更後: KintoneRecordField.SingleLineText;
IC定期_駐車場利用方法変更申請_備考: KintoneRecordField.MultiLineText;
[F.クレジット支払変更申請_トークン]: KintoneRecordField.SingleLineText;
[F.クレジット支払変更申請_有効期限]: KintoneRecordField.DateTime;
};

+ 3
- 2
tsconfig.json View File

@@ -2,12 +2,13 @@
"compilerOptions": {
"sourceMap": true,
// TSはECMAScript 5に変換
"target": "ES2015",
"target": "ESNext",
// TSのモジュールはES Modulesとして出力
"module": "ES2015",
"module": "ES6",
// 厳密モードとして設定
"strict": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"baseUrl": ".",
"paths": {


+ 7
- 0
webpack.config.js View File

@@ -5,6 +5,8 @@ const { exec } = require('child_process');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const Dotenv = require('dotenv-webpack');
const dotenv = require('dotenv');
const { format } = require('date-fns');
@@ -23,6 +25,10 @@ const entries = glob.sync('*/index.+(js|ts|tsx)', { cwd: basePath }).reduce(
);

module.exports = {
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
entry: entries,
cache: false,
resolve: {
@@ -70,6 +76,7 @@ module.exports = {
// new Dotenv({ systemvars: true }),
new ForkTsCheckerWebpackPlugin(),
// new BundleAnalyzerPlugin(),
new LodashModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.BUILD_TIME': JSON.stringify(format(new Date(), 'yyyy-MM-dd HH:mm:ss')),
}),


+ 8
- 1
yarn.lock View File

@@ -4229,12 +4229,19 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"

lodash-webpack-plugin@^0.11.6:
version "0.11.6"
resolved "https://registry.yarnpkg.com/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.6.tgz#8204c6b78beb62ce5211217dfe783c21557ecd33"
integrity sha512-nsHN/+IxZK/C425vGC8pAxkKJ8KQH2+NJnhDul14zYNWr6HJcA95w+oRR7Cp0oZpOdMplDZXmjVROp8prPk7ig==
dependencies:
lodash "^4.17.20"

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==

lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21:
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==


Loading…
Cancel
Save