diff --git a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentInfoController.php b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentInfoController.php index d96ebc4..4b22ded 100644 --- a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentInfoController.php +++ b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentInfoController.php @@ -52,8 +52,6 @@ class PaymentInfoController extends WebController $model->customerCode = $param->customerCode; $model->autoPaymentNo = $param->acid; $model->shopOrderNo = $param->cod; - $model->paymentInterval = $this->getPaymentInterval(); - $model->paymentAmount = $this->getPaymentAmount(); // 機密な情報をリクエストデータから除外して登録する $requestArr = request()->toArray(); @@ -70,38 +68,4 @@ class PaymentInfoController extends WebController return response()->view('robot-payment.creditcard.ok'); } - - private function getPaymentAmount(): int - { - $param = $this->param; - return intval($param->acam) + intval($param->actx) + intval($param->acsf); - } - - private function getPaymentInterval(): string - { - $code = $this->param->actp; - if ($code === "2") { - return "毎週課金"; - } - if ($code === "3") { - return "隔週課金"; - } - if ($code === "4") { - return "毎月課金"; - } - if ($code === "5") { - return "隔月課金"; - } - if ($code === "6") { - return "3ヶ月課金"; - } - if ($code === "7") { - return "6ヶ月課金"; - } - if ($code === "8") { - return "1年課金"; - } - - return ""; - } } diff --git a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultController.php b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultController.php index 3edf8ba..657630d 100644 --- a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultController.php +++ b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultController.php @@ -53,27 +53,25 @@ class PaymentResultController extends WebController throw $e; } - $this->クレジット支払結果登録($info); + $this->クレジット支払結果登録(); return response()->view('robot-payment.creditcard.ok'); } - private function クレジット支払結果登録(CreditcardAutoPaymentInfo $info) + private function クレジット支払結果登録() { $param = $this->param; - $result = new CreditcardAutoPaymentResult(); - $result->creditcardAutoPaymentNo = $info->autoPaymentNo; + $result->creditcardAutoPaymentNo = $param->acid; $result->paymentNo = $param->gid; $result->paymentDate = DateUtil::now(); $result->paymentResult = $this->get決済結果($param->rst); $result->errorCode = $param->ec; - $result->paymentAmount = $info->paymentAmount; + $result->paymentAmount = $param->ta ?? 0; // 機密な情報をリクエストデータから除外して登録する $requestArr = request()->toArray(); - unset($requestArr["token"]); unset($requestArr["id"]); unset($requestArr["pa"]); $result->dataResult = json_encode( diff --git a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultParam.php b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultParam.php index 88460f7..23b58fe 100644 --- a/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultParam.php +++ b/app/Http/Controllers/Web/RobotPayment/CreditCard/PaymentResultParam.php @@ -6,18 +6,16 @@ use App\Http\Controllers\Web\BaseParam; /** * @property string $gid 決済番号 決済毎に発行されるユニークID - * @property string $rst 決済結果(1:決済成功 2:決済失敗) - * @property string $ap カード会社承認番号 決済毎に発行されるユニークID + * @property string $rst 決済結果(決済成功「1」決済失敗「2」リトライ課金失敗「3」ユーザー様による課金停止「4」お試し期間中にリトライ課金課金2回失敗「5」) * @property ?string $ec エラーコード - * @property string $god オーダーコード 決済毎に発行されるユニークID * @property string $cod 店舗オーダー番号 決済データ送信時に送信された店舗オーダー番号 * @property ?int $am 決済金額 * @property ?int $tx 税金額 * @property ?int $sf 送料 * @property ?int $ta 合計金額 * @property string $acid 自動課金番号 対象の自動課金番号 - * @property ?string $customerCode カスタム-顧客コード - * @property ?string $token カスタム-トークン + * + * ※決済金額、税金額、送料、合計金額はAPI仕様書には載っていないが、テストで送られることを確認 */ class PaymentResultParam extends BaseParam { @@ -26,17 +24,13 @@ class PaymentResultParam extends BaseParam return [ 'gid' => $this->str(), 'rst' => $this->str(), - 'ap' => $this->str(), 'ec' => $this->str(true), - 'god' => $this->str(), 'cod' => $this->str(), 'am' => $this->numeric(), 'tx' => $this->numeric(true), 'sf' => $this->numeric(true), 'ta' => $this->numeric(true), 'acid' => $this->str(), - 'customer_code' => $this->str(true), - 'token' => $this->str(true), ]; } } diff --git a/app/Kintone/Models/CreditcardAutoPaymentInfo.php b/app/Kintone/Models/CreditcardAutoPaymentInfo.php index 23817a3..c02c13e 100644 --- a/app/Kintone/Models/CreditcardAutoPaymentInfo.php +++ b/app/Kintone/Models/CreditcardAutoPaymentInfo.php @@ -11,8 +11,6 @@ use Illuminate\Support\Carbon; * @property string $customerName 顧客名 * @property string $autoPaymentNo 自動課金番号 * @property string $shopOrderNo 店舗側オーダー番号 - * @property string $paymentInterval 課金周期 - * @property int $paymentAmount 課金金額 * @property ?string $dataResult 受信電文 */ class CreditcardAutoPaymentInfo extends KintoneModel @@ -23,8 +21,6 @@ class CreditcardAutoPaymentInfo extends KintoneModel const FIELD_CUSTOMER_NAME = "顧客名"; const FIELD_AUTO_PAYMENT_NO = "自動課金番号"; const FIELD_SHOP_ORDER_NO = "店舗側オーダー番号"; - const FIELD_PAYMENT_INTERVAL = "課金周期"; - const FIELD_PAYMENT_AMOUNT = "課金金額"; const FIELD_DATA_RESULT = "受信電文"; protected const FIELDS = [ @@ -33,8 +29,6 @@ class CreditcardAutoPaymentInfo extends KintoneModel self::FIELD_CUSTOMER_NAME => FieldType::SINGLE_LINE_TEXT, self::FIELD_AUTO_PAYMENT_NO => FieldType::SINGLE_LINE_TEXT, self::FIELD_SHOP_ORDER_NO => FieldType::SINGLE_LINE_TEXT, - self::FIELD_PAYMENT_INTERVAL => FieldType::DROP_DOWN, - self::FIELD_PAYMENT_AMOUNT => FieldType::NUMBER, self::FIELD_DATA_RESULT => FieldType::MULTI_LINE_TEXT, ]; diff --git a/app/Kintone/Models/Customer.php b/app/Kintone/Models/Customer.php index a9d8c54..dc212d8 100644 --- a/app/Kintone/Models/Customer.php +++ b/app/Kintone/Models/Customer.php @@ -117,7 +117,7 @@ class Customer extends KintoneModel public function allowAccessMyPage(): bool { $target = $this->allowAccessMyPage; - if (is_array($target) && Arr::has($this->allowAccessMyPage, "許可")) { + if (is_array($target) && in_array("許可", $this->allowAccessMyPage, true)) { return true; } return false; @@ -127,7 +127,7 @@ class Customer extends KintoneModel public function allowPayByCreditcard(): bool { $target = $this->allowPayByCreditcard; - if (is_array($target) && Arr::has($this->allowPayByCreditcard, "許可")) { + if (is_array($target) && in_array("許可", $this->allowPayByCreditcard, true)) { return true; } return false;