| @@ -52,8 +52,6 @@ class PaymentInfoController extends WebController | |||||
| $model->customerCode = $param->customerCode; | $model->customerCode = $param->customerCode; | ||||
| $model->autoPaymentNo = $param->acid; | $model->autoPaymentNo = $param->acid; | ||||
| $model->shopOrderNo = $param->cod; | $model->shopOrderNo = $param->cod; | ||||
| $model->paymentInterval = $this->getPaymentInterval(); | |||||
| $model->paymentAmount = $this->getPaymentAmount(); | |||||
| // 機密な情報をリクエストデータから除外して登録する | // 機密な情報をリクエストデータから除外して登録する | ||||
| $requestArr = request()->toArray(); | $requestArr = request()->toArray(); | ||||
| @@ -70,38 +68,4 @@ class PaymentInfoController extends WebController | |||||
| return response()->view('robot-payment.creditcard.ok'); | 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 ""; | |||||
| } | |||||
| } | } | ||||
| @@ -53,27 +53,25 @@ class PaymentResultController extends WebController | |||||
| throw $e; | throw $e; | ||||
| } | } | ||||
| $this->クレジット支払結果登録($info); | |||||
| $this->クレジット支払結果登録(); | |||||
| return response()->view('robot-payment.creditcard.ok'); | return response()->view('robot-payment.creditcard.ok'); | ||||
| } | } | ||||
| private function クレジット支払結果登録(CreditcardAutoPaymentInfo $info) | |||||
| private function クレジット支払結果登録() | |||||
| { | { | ||||
| $param = $this->param; | $param = $this->param; | ||||
| $result = new CreditcardAutoPaymentResult(); | $result = new CreditcardAutoPaymentResult(); | ||||
| $result->creditcardAutoPaymentNo = $info->autoPaymentNo; | |||||
| $result->creditcardAutoPaymentNo = $param->acid; | |||||
| $result->paymentNo = $param->gid; | $result->paymentNo = $param->gid; | ||||
| $result->paymentDate = DateUtil::now(); | $result->paymentDate = DateUtil::now(); | ||||
| $result->paymentResult = $this->get決済結果($param->rst); | $result->paymentResult = $this->get決済結果($param->rst); | ||||
| $result->errorCode = $param->ec; | $result->errorCode = $param->ec; | ||||
| $result->paymentAmount = $info->paymentAmount; | |||||
| $result->paymentAmount = $param->ta ?? 0; | |||||
| // 機密な情報をリクエストデータから除外して登録する | // 機密な情報をリクエストデータから除外して登録する | ||||
| $requestArr = request()->toArray(); | $requestArr = request()->toArray(); | ||||
| unset($requestArr["token"]); | |||||
| unset($requestArr["id"]); | unset($requestArr["id"]); | ||||
| unset($requestArr["pa"]); | unset($requestArr["pa"]); | ||||
| $result->dataResult = json_encode( | $result->dataResult = json_encode( | ||||
| @@ -6,18 +6,16 @@ use App\Http\Controllers\Web\BaseParam; | |||||
| /** | /** | ||||
| * @property string $gid 決済番号 決済毎に発行されるユニークID | * @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 $ec エラーコード | ||||
| * @property string $god オーダーコード 決済毎に発行されるユニークID | |||||
| * @property string $cod 店舗オーダー番号 決済データ送信時に送信された店舗オーダー番号 | * @property string $cod 店舗オーダー番号 決済データ送信時に送信された店舗オーダー番号 | ||||
| * @property ?int $am 決済金額 | * @property ?int $am 決済金額 | ||||
| * @property ?int $tx 税金額 | * @property ?int $tx 税金額 | ||||
| * @property ?int $sf 送料 | * @property ?int $sf 送料 | ||||
| * @property ?int $ta 合計金額 | * @property ?int $ta 合計金額 | ||||
| * @property string $acid 自動課金番号 対象の自動課金番号 | * @property string $acid 自動課金番号 対象の自動課金番号 | ||||
| * @property ?string $customerCode カスタム-顧客コード | |||||
| * @property ?string $token カスタム-トークン | |||||
| * | |||||
| * ※決済金額、税金額、送料、合計金額はAPI仕様書には載っていないが、テストで送られることを確認 | |||||
| */ | */ | ||||
| class PaymentResultParam extends BaseParam | class PaymentResultParam extends BaseParam | ||||
| { | { | ||||
| @@ -26,17 +24,13 @@ class PaymentResultParam extends BaseParam | |||||
| return [ | return [ | ||||
| 'gid' => $this->str(), | 'gid' => $this->str(), | ||||
| 'rst' => $this->str(), | 'rst' => $this->str(), | ||||
| 'ap' => $this->str(), | |||||
| 'ec' => $this->str(true), | 'ec' => $this->str(true), | ||||
| 'god' => $this->str(), | |||||
| 'cod' => $this->str(), | 'cod' => $this->str(), | ||||
| 'am' => $this->numeric(), | 'am' => $this->numeric(), | ||||
| 'tx' => $this->numeric(true), | 'tx' => $this->numeric(true), | ||||
| 'sf' => $this->numeric(true), | 'sf' => $this->numeric(true), | ||||
| 'ta' => $this->numeric(true), | 'ta' => $this->numeric(true), | ||||
| 'acid' => $this->str(), | 'acid' => $this->str(), | ||||
| 'customer_code' => $this->str(true), | |||||
| 'token' => $this->str(true), | |||||
| ]; | ]; | ||||
| } | } | ||||
| } | } | ||||
| @@ -11,8 +11,6 @@ use Illuminate\Support\Carbon; | |||||
| * @property string $customerName 顧客名 | * @property string $customerName 顧客名 | ||||
| * @property string $autoPaymentNo 自動課金番号 | * @property string $autoPaymentNo 自動課金番号 | ||||
| * @property string $shopOrderNo 店舗側オーダー番号 | * @property string $shopOrderNo 店舗側オーダー番号 | ||||
| * @property string $paymentInterval 課金周期 | |||||
| * @property int $paymentAmount 課金金額 | |||||
| * @property ?string $dataResult 受信電文 | * @property ?string $dataResult 受信電文 | ||||
| */ | */ | ||||
| class CreditcardAutoPaymentInfo extends KintoneModel | class CreditcardAutoPaymentInfo extends KintoneModel | ||||
| @@ -23,8 +21,6 @@ class CreditcardAutoPaymentInfo extends KintoneModel | |||||
| const FIELD_CUSTOMER_NAME = "顧客名"; | const FIELD_CUSTOMER_NAME = "顧客名"; | ||||
| const FIELD_AUTO_PAYMENT_NO = "自動課金番号"; | const FIELD_AUTO_PAYMENT_NO = "自動課金番号"; | ||||
| const FIELD_SHOP_ORDER_NO = "店舗側オーダー番号"; | const FIELD_SHOP_ORDER_NO = "店舗側オーダー番号"; | ||||
| const FIELD_PAYMENT_INTERVAL = "課金周期"; | |||||
| const FIELD_PAYMENT_AMOUNT = "課金金額"; | |||||
| const FIELD_DATA_RESULT = "受信電文"; | const FIELD_DATA_RESULT = "受信電文"; | ||||
| protected const FIELDS = [ | protected const FIELDS = [ | ||||
| @@ -33,8 +29,6 @@ class CreditcardAutoPaymentInfo extends KintoneModel | |||||
| self::FIELD_CUSTOMER_NAME => FieldType::SINGLE_LINE_TEXT, | self::FIELD_CUSTOMER_NAME => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_AUTO_PAYMENT_NO => FieldType::SINGLE_LINE_TEXT, | self::FIELD_AUTO_PAYMENT_NO => FieldType::SINGLE_LINE_TEXT, | ||||
| self::FIELD_SHOP_ORDER_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, | self::FIELD_DATA_RESULT => FieldType::MULTI_LINE_TEXT, | ||||
| ]; | ]; | ||||
| @@ -117,7 +117,7 @@ class Customer extends KintoneModel | |||||
| public function allowAccessMyPage(): bool | public function allowAccessMyPage(): bool | ||||
| { | { | ||||
| $target = $this->allowAccessMyPage; | $target = $this->allowAccessMyPage; | ||||
| if (is_array($target) && Arr::has($this->allowAccessMyPage, "許可")) { | |||||
| if (is_array($target) && in_array("許可", $this->allowAccessMyPage, true)) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| @@ -127,7 +127,7 @@ class Customer extends KintoneModel | |||||
| public function allowPayByCreditcard(): bool | public function allowPayByCreditcard(): bool | ||||
| { | { | ||||
| $target = $this->allowPayByCreditcard; | $target = $this->allowPayByCreditcard; | ||||
| if (is_array($target) && Arr::has($this->allowPayByCreditcard, "許可")) { | |||||
| if (is_array($target) && in_array("許可", $this->allowPayByCreditcard, true)) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||