diff --git a/client/client/client.gen.ts b/client/client/client.gen.ts index d2e55a1..14dc0a0 100644 --- a/client/client/client.gen.ts +++ b/client/client/client.gen.ts @@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => { ...options, fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, headers: mergeHeaders(_config.headers, options.headers), - serializedBody: undefined, + serializedBody: undefined as string | undefined, }; if (opts.security) { @@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => { } if (opts.body !== undefined && opts.bodySerializer) { - opts.serializedBody = opts.bodySerializer(opts.body); + opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined; } // remove Content-Type header if body is empty to avoid sending invalid requests @@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => { }); }; + const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options }); + return { - buildUrl, + buildUrl: _buildUrl, connect: makeMethodFn('CONNECT'), delete: makeMethodFn('DELETE'), get: makeMethodFn('GET'), diff --git a/client/core/bodySerializer.gen.ts b/client/core/bodySerializer.gen.ts index 8ad92c9..67daca6 100644 --- a/client/core/bodySerializer.gen.ts +++ b/client/core/bodySerializer.gen.ts @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize export type QuerySerializer = (query: Record) => string; -export type BodySerializer = (body: any) => any; +export type BodySerializer = (body: unknown) => unknown; type QuerySerializerOptionsObject = { allowReserved?: boolean; @@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: }; export const formDataBodySerializer = { - bodySerializer: | Array>>( - body: T, - ): FormData => { + bodySerializer: (body: unknown): FormData => { const data = new FormData(); - Object.entries(body).forEach(([key, value]) => { + Object.entries(body as Record).forEach(([key, value]) => { if (value === undefined || value === null) { return; } @@ -60,15 +58,15 @@ export const formDataBodySerializer = { }; export const jsonBodySerializer = { - bodySerializer: (body: T): string => + bodySerializer: (body: unknown): string => JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), }; export const urlSearchParamsBodySerializer = { - bodySerializer: | Array>>(body: T): string => { + bodySerializer: (body: unknown): string => { const data = new URLSearchParams(); - Object.entries(body).forEach(([key, value]) => { + Object.entries(body as Record).forEach(([key, value]) => { if (value === undefined || value === null) { return; } diff --git a/client/core/params.gen.ts b/client/core/params.gen.ts index 6099cab..7955601 100644 --- a/client/core/params.gen.ts +++ b/client/core/params.gen.ts @@ -96,7 +96,7 @@ interface Params { const stripEmptySlots = (params: Params) => { for (const [slot, value] of Object.entries(params)) { - if (value && typeof value === 'object' && !Object.keys(value).length) { + if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) { delete params[slot as Slot]; } } diff --git a/client/sdk.gen.ts b/client/sdk.gen.ts index 91d5ba7..4e76fe5 100644 --- a/client/sdk.gen.ts +++ b/client/sdk.gen.ts @@ -29,6 +29,8 @@ export const getAllPaymentMethods = (optio /** * Create Payment Method + * + * **このエンドポイントはテストモードでのみ使用できます。** */ export const createPaymentMethod = (options: Options) => (options.client ?? client).post({ security: [{ scheme: 'basic', type: 'http' }, { scheme: 'bearer', type: 'http' }], diff --git a/client/types.gen.ts b/client/types.gen.ts index ea95700..230d4d6 100644 --- a/client/types.gen.ts +++ b/client/types.gen.ts @@ -3025,6 +3025,12 @@ export type ProductDetailsResponse = { * 商品 ID */ id: string; + /** + * Livemode + * + * 本番環境かどうか + */ + livemode: boolean; /** * Name * @@ -3061,6 +3067,18 @@ export type ProductDetailsResponse = { * この製品の公開されているウェブページの URL */ url: string | null; + /** + * Created At + * + * 作成日時 (UTC, ISO 8601 形式) + */ + created_at: string; + /** + * Updated At + * + * 更新日時 (UTC, ISO 8601 形式) + */ + updated_at: string; }; /** @@ -3679,6 +3697,12 @@ export type TaxRateDetailsResponse = { * 税率 ID */ id: string; + /** + * Livemode + * + * 本番環境かどうか + */ + livemode: boolean; /** * Display Name * @@ -3713,6 +3737,18 @@ export type TaxRateDetailsResponse = { * 説明。管理画面内のみで表示され、顧客には表示されません。 */ description: string | null; + /** + * Created At + * + * 作成日時 (UTC, ISO 8601 形式) + */ + created_at: string; + /** + * Updated At + * + * 更新日時 (UTC, ISO 8601 形式) + */ + updated_at: string; /** * Metadata * @@ -5887,6 +5923,18 @@ export type GetAllTaxRatesData = { * このIDより前のデータを取得 */ ending_before?: string; + /** + * Active + * + * この税率が有効であるかどうか。無効にした場合でも、すでに設定されている定期課金などでは使用可能です。 + */ + active?: boolean | null; + /** + * Inclusive + * + * 税込みかどうか。税込 = `true` 税抜 = `false` + */ + inclusive?: boolean | null; }; url: '/v2/tax_rates'; }; diff --git a/package.json b/package.json index d178ee0..57a5fcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@payjp/payjpv2", - "version": "1.0.6", + "version": "1.0.7", "type": "module", "main": "dist/index.cjs", "module": "dist/index.mjs", diff --git a/payjpv2.ts b/payjpv2.ts index 37c3f8d..14a4d4f 100644 --- a/payjpv2.ts +++ b/payjpv2.ts @@ -5,7 +5,7 @@ import { type Client, } from "./client/client"; -const BINDINGS_VERSION = '1.0.6'; +const BINDINGS_VERSION = '1.0.7'; const DEFAULT_BASE_URL = "https://api.pay.jp"; export interface ClientConfig {