|
- <?php
-
- namespace App\Http\API\SMBC\Payment;
-
- use App\Exceptions\ConfigException;
- use App\Kintone\Models\Customer;
- use Illuminate\Support\Carbon;
- use Illuminate\Support\Facades\Http;
-
- class SMBC
- {
- const CONDITION_ADDR5_FROM_MY_PAGE = "マイページからの申請";
-
-
- public static function poll(Carbon $from, Carbon $to)
- {
- $url = config('smbc.payment.searchUrl');
- if (!$url) {
- throw new ConfigException("smbc.payment.searchUrl", $url);
- }
-
- $password = config('smbc.payment.searchPassword');
- if (!$password) {
- throw new ConfigException("smbc.payment.searchPassword", $password);
- }
-
- $sendData = [
- 'version' => "213",
- 'shori_kbn' => "0500",
- 'shop_cd' => "7068054",
- 'syuno_co_cd' => "58800",
- 'shop_pwd' => $password,
-
- // 更新日時のFROM-TO検索条件
- 'jotai_date_from' => $from->format('Ymd'),
- 'jotai_time_from' => $from->format('Hi'),
- 'jotai_date_to' => $to->format('Ymd'),
- 'jotai_time_to' => $to->format('Hi'),
-
- // ソート指定
- 'sort_list' => "13", // 処理日時
- 'sort_jun' => "1" // 昇順
- ];
-
- $res = Http::withHeaders([
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Content-Encoding' => 'Shift_JIS'
- ])->asForm()->post(
- $url,
- $sendData
- );
-
- if ($res->failed()) {
- throw $res->toException();
- }
-
- return new PollResult($res->body());
- }
-
- public static function getRegisterStartParam(Customer $customer)
- {
-
- $password = config('smbc.bankAccountRegister.systemPassword');
- if (!$password) {
- throw new ConfigException('smbc.bankAccountRegister.systemPassword', $password);
- }
-
- $url = config('smbc.bankAccountRegister.registerUrl');
- if (!$url) {
- throw new ConfigException('smbc.bankAccountRegister.registerUrl', $url);
- }
-
- $param = [
- 'bill_no' => sprintf("%012d", $customer->customerCode),
- 'bill_name' => $customer->customerName,
- 'bill_kana' => mb_convert_kana($customer->customerNameKana, "ks"),
-
- 'version' => "130",
- 'bill_method' => "01",
- 'shop_cd' => "7694156",
- 'syuno_co_cd' => "58763",
- 'shop_pwd' => $password,
- 'shoporder_no' => "",
- 'koushin_kbn' => "1",
- 'shop_phon_hyoji_kbn' => "1",
- 'shop_mail_hyoji_kbn' => "1",
- 'kessai_id' => "0101",
-
- 'bill_adr_5' => self::CONDITION_ADDR5_FROM_MY_PAGE,
- ];
- $param['fs'] = hash('sha256', $param['shop_cd'] . $param['syuno_co_cd'] . $param['bill_no'] . $param['shoporder_no'] . $param['shop_pwd']);
-
- $data = [
- 'url' => $url,
- 'param' => $param,
- ];
-
- return $data;
- }
- }
|