pokepay_partner_ruby_sdk 0.1.14 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/docs/index.md +1201 -145
  4. data/lib/pokepay_partner_ruby_sdk/client.rb +24 -13
  5. data/lib/pokepay_partner_ruby_sdk/request/create_campaign.rb +20 -0
  6. data/lib/pokepay_partner_ruby_sdk/request/create_cpm_transaction.rb +17 -0
  7. data/lib/pokepay_partner_ruby_sdk/request/create_exchange_transaction.rb +2 -2
  8. data/lib/pokepay_partner_ruby_sdk/request/create_external_transaction.rb +18 -0
  9. data/lib/pokepay_partner_ruby_sdk/request/create_payment_transaction.rb +2 -2
  10. data/lib/pokepay_partner_ruby_sdk/request/create_topup_transaction.rb +2 -2
  11. data/lib/pokepay_partner_ruby_sdk/request/create_topup_transaction_with_check.rb +2 -2
  12. data/lib/pokepay_partner_ruby_sdk/request/create_transaction.rb +2 -2
  13. data/lib/pokepay_partner_ruby_sdk/request/create_transfer_transaction.rb +2 -2
  14. data/lib/pokepay_partner_ruby_sdk/request/create_user_account.rb +15 -0
  15. data/lib/pokepay_partner_ruby_sdk/request/delete_account.rb +15 -0
  16. data/lib/pokepay_partner_ruby_sdk/request/get_cpm_token.rb +15 -0
  17. data/lib/pokepay_partner_ruby_sdk/request/get_transaction.rb +2 -2
  18. data/lib/pokepay_partner_ruby_sdk/request/list_user_accounts.rb +2 -2
  19. data/lib/pokepay_partner_ruby_sdk/request/refund_external_transaction.rb +15 -0
  20. data/lib/pokepay_partner_ruby_sdk/request/refund_transaction.rb +2 -2
  21. data/lib/pokepay_partner_ruby_sdk/request/update_account.rb +2 -2
  22. data/lib/pokepay_partner_ruby_sdk/request/update_customer_account.rb +15 -0
  23. data/lib/pokepay_partner_ruby_sdk/response/account.rb +3 -0
  24. data/lib/pokepay_partner_ruby_sdk/response/account_deleted.rb +11 -0
  25. data/lib/pokepay_partner_ruby_sdk/response/account_detail.rb +3 -0
  26. data/lib/pokepay_partner_ruby_sdk/response/account_status.rb +11 -0
  27. data/lib/pokepay_partner_ruby_sdk/response/account_with_user.rb +3 -0
  28. data/lib/pokepay_partner_ruby_sdk/response/account_without_private_money_detail.rb +3 -0
  29. data/lib/pokepay_partner_ruby_sdk/response/campaign.rb +41 -0
  30. data/lib/pokepay_partner_ruby_sdk/response/cashtray_attempt.rb +1 -1
  31. data/lib/pokepay_partner_ruby_sdk/response/cashtray_with_result.rb +2 -2
  32. data/lib/pokepay_partner_ruby_sdk/response/cpm_token.rb +26 -0
  33. data/lib/pokepay_partner_ruby_sdk/response/external_transaction.rb +31 -0
  34. data/lib/pokepay_partner_ruby_sdk/response/private_money.rb +2 -0
  35. data/lib/pokepay_partner_ruby_sdk/response/product.rb +21 -0
  36. data/lib/pokepay_partner_ruby_sdk/response/transaction_detail.rb +39 -0
  37. data/lib/pokepay_partner_ruby_sdk/version.rb +1 -1
  38. data/lib/pokepay_partner_ruby_sdk.rb +15 -0
  39. data/partner.yaml +1326 -39
  40. data/pokepay_partner_ruby_sdk.gemspec +3 -3
  41. metadata +21 -6
data/partner.yaml CHANGED
@@ -36,6 +36,8 @@ tags:
36
36
  - name: Account
37
37
  - name: Private Money
38
38
  - name: Bulk
39
+ - name: Event
40
+ - name: Campaign
39
41
 
40
42
  components:
41
43
  schemas:
@@ -94,6 +96,11 @@ components:
94
96
  type: array
95
97
  items:
96
98
  $ref: '#/components/schemas/PrivateMoney'
99
+ AccountStatus:
100
+ x-pokepay-schema-type: "response"
101
+ type: string
102
+ enum: [active, suspended, pre-closed, closed]
103
+ title: 'ウォレット状態'
97
104
  Account:
98
105
  x-pokepay-schema-type: "response"
99
106
  properties:
@@ -107,6 +114,8 @@ components:
107
114
  is_suspended:
108
115
  type: boolean
109
116
  title: 'ウォレットが凍結されているかどうか'
117
+ status:
118
+ $ref: '#/components/schemas/AccountStatus'
110
119
  private_money:
111
120
  $ref: '#/components/schemas/PrivateMoney'
112
121
  title: '設定マネー情報'
@@ -120,6 +129,8 @@ components:
120
129
  type: string
121
130
  is_suspended:
122
131
  type: boolean
132
+ status:
133
+ $ref: '#/components/schemas/AccountStatus'
123
134
  private_money:
124
135
  $ref: '#/components/schemas/PrivateMoney'
125
136
  user:
@@ -134,6 +145,8 @@ components:
134
145
  type: string
135
146
  is_suspended:
136
147
  type: boolean
148
+ status:
149
+ $ref: '#/components/schemas/AccountStatus'
137
150
  balance:
138
151
  type: number
139
152
  format: decimal
@@ -166,6 +179,9 @@ components:
166
179
  private_money:
167
180
  $ref: '#/components/schemas/PrivateMoney'
168
181
  title: '設定マネー情報'
182
+ AccountDeleted:
183
+ x-pokepay-schema-type: "response"
184
+ properties: {}
169
185
  AccountBalance:
170
186
  x-pokepay-schema-type: "response"
171
187
  properties:
@@ -264,6 +280,40 @@ components:
264
280
  token:
265
281
  type: string
266
282
  title: チャージQRコードを解析したときに出てくるURL
283
+ CpmToken:
284
+ x-pokepay-schema-type: "response"
285
+ type: object
286
+ properties:
287
+ cpm_token:
288
+ type: string
289
+ minLength: 22
290
+ maxLength: 22
291
+ account:
292
+ $ref: '#/components/schemas/AccountDetail'
293
+ transaction:
294
+ $ref: '#/components/schemas/Transaction'
295
+ nullable: true
296
+ event:
297
+ $ref: '#/components/schemas/ExternalTransaction'
298
+ nullable: true
299
+ scopes:
300
+ type: array
301
+ title: 許可された取引種別
302
+ description: エンドユーザーがCPMトークンを生成する際に指定する、CPMトークンに許可された取引の種別。
303
+ items:
304
+ type: string
305
+ enum: [payment, topup, external-transaction]
306
+ expires_at:
307
+ type: string
308
+ format: date-time
309
+ title: CPMトークンの失効日時
310
+ metadata:
311
+ type: string
312
+ format: json
313
+ title: エンドユーザー側メタデータ
314
+ description: |-
315
+ 取引作成時に店舗側から指定されるメタデータです。
316
+ 全てのkeyとvalueが文字列であるようなフラットな構造のJSON文字列です。
267
317
 
268
318
  Cashtray:
269
319
  x-pokepay-schema-type: "response"
@@ -428,6 +478,9 @@ components:
428
478
  type: boolean
429
479
  nullable: true
430
480
  title: '加盟店によるチャージが有効かどうか'
481
+ display_money_and_point:
482
+ type: string
483
+ enum: [both, money-only, point-only]
431
484
  Organization:
432
485
  x-pokepay-schema-type: "response"
433
486
  properties:
@@ -480,6 +533,51 @@ components:
480
533
  description:
481
534
  type: string
482
535
  title: '取引説明文'
536
+ TransactionDetail:
537
+ x-pokepay-schema-type: "response"
538
+ properties:
539
+ id:
540
+ type: string
541
+ format: uuid
542
+ title: '取引ID'
543
+ type:
544
+ type: string
545
+ title: '取引種別 (チャージ=topup, 支払い=payment)'
546
+ is_modified:
547
+ type: boolean
548
+ title: '返金された取引かどうか'
549
+ sender:
550
+ $ref: '#/components/schemas/User'
551
+ title: '送金者情報'
552
+ sender_account:
553
+ $ref: '#/components/schemas/Account'
554
+ title: '送金ウォレット情報'
555
+ receiver:
556
+ $ref: '#/components/schemas/User'
557
+ title: '受取者情報'
558
+ receiver_account:
559
+ $ref: '#/components/schemas/Account'
560
+ title: '受取ウォレット情報'
561
+ amount:
562
+ type: number
563
+ title: '決済総額 (マネー額 + ポイント額)'
564
+ money_amount:
565
+ type: number
566
+ title: '決済マネー額'
567
+ point_amount:
568
+ type: number
569
+ title: '決済ポイント額'
570
+ done_at:
571
+ type: string
572
+ format: date-time
573
+ title: '取引日時'
574
+ description:
575
+ type: string
576
+ title: '取引説明文'
577
+ transfers:
578
+ type: array
579
+ items:
580
+ $ref: '#/components/schemas/Transfer'
483
581
  ShopWithMetadata:
484
582
  x-pokepay-schema-type: "response"
485
583
  properties:
@@ -590,7 +688,7 @@ components:
590
688
  format: date-time
591
689
  type:
592
690
  type: string
593
- enum: [topup, payment, transfer, exchange]
691
+ enum: [topup, payment, transfer, exchange, cashback, expire]
594
692
  is_modified:
595
693
  type: boolean
596
694
  BulkTransaction:
@@ -644,6 +742,8 @@ components:
644
742
  type: string
645
743
  is_suspended:
646
744
  type: boolean
745
+ status:
746
+ $ref: '#/components/schemas/AccountStatus'
647
747
  private_money_id:
648
748
  type: string
649
749
  format: uuid
@@ -676,12 +776,64 @@ components:
676
776
  format: date-time
677
777
  type:
678
778
  type: string
679
- enum: [topup, payment, refund-topup, refund-payment, transfer, exchange-inflow, exchange-outflow, campaign-topup, refund-campaign, use-coupon, refund-coupon]
779
+ enum: [topup, payment, refund-topup, refund-payment, transfer, exchange-inflow, exchange-outflow, campaign-topup, refund-campaign, use-coupon, refund-coupon, cashback, expire]
680
780
  description:
681
781
  type: string
682
782
  transaction_id:
683
783
  type: string
684
784
  format: uuid
785
+ ExternalTransaction:
786
+ x-pokepay-schema-type: "response"
787
+ properties:
788
+ id:
789
+ type: string
790
+ format: uuid
791
+ title: ポケペイ外部取引ID
792
+ is_modified:
793
+ type: boolean
794
+ title: 返金された取引かどうか
795
+ sender:
796
+ $ref: '#/components/schemas/User'
797
+ title: 送金者情報
798
+ sender_account:
799
+ $ref: '#/components/schemas/Account'
800
+ title: 送金ウォレット情報
801
+ receiver:
802
+ $ref: '#/components/schemas/User'
803
+ title: 受取者情報
804
+ receiver_account:
805
+ $ref: '#/components/schemas/Account'
806
+ title: 受取ウォレット情報
807
+ amount:
808
+ type: number
809
+ title: 決済額
810
+ done_at:
811
+ type: string
812
+ format: date-time
813
+ title: 取引日時
814
+ description:
815
+ type: string
816
+ title: 取引説明文
817
+ Product:
818
+ x-pokepay-schema-type: "response"
819
+ properties:
820
+ jan_code:
821
+ type: string
822
+ maxLength: 64
823
+ name:
824
+ type: string
825
+ maxLength: 256
826
+ unit_price:
827
+ type: number
828
+ minimum: 0
829
+ price:
830
+ type: number
831
+ minimum: 0
832
+ is_discounted:
833
+ type: boolean
834
+ other:
835
+ type: string
836
+ format: json
685
837
 
686
838
  OrganizationSummary:
687
839
  x-pokepay-schema-type: "response"
@@ -831,7 +983,68 @@ components:
831
983
  minimum: 0
832
984
  pagination:
833
985
  $ref: '#/components/schemas/Pagination'
834
-
986
+ Campaign:
987
+ x-pokepay-schema-type: "response"
988
+ properties:
989
+ id:
990
+ type: string
991
+ format: uuid
992
+ title: 'キャンペーンID'
993
+ name:
994
+ type: string
995
+ maxLength: 256
996
+ title: 'キャペーン名'
997
+ applicable_shops:
998
+ type: array
999
+ title: 'キャンペーン適用対象の店舗リスト'
1000
+ nullable: true
1001
+ items:
1002
+ $ref: '#/components/schemas/User'
1003
+ is_exclusive:
1004
+ type: boolean
1005
+ title: 'キャンペーンの重複を許すかどうかのフラグ'
1006
+ starts_at:
1007
+ type: string
1008
+ format: date-time
1009
+ title: 'キャンペーン開始日時'
1010
+ ends_at:
1011
+ type: string
1012
+ format: date-time
1013
+ title: 'キャンペーン終了日時'
1014
+ point_expires_at:
1015
+ type: string
1016
+ format: date-time
1017
+ title: 'キャンペーンによって付与されるポイントの失効日時'
1018
+ nullable: true
1019
+ point_expires_in_days:
1020
+ type: integer
1021
+ minimum: 1
1022
+ title: 'キャンペーンによって付与されるポイントの有効期限(相対指定、単位は日)'
1023
+ nullable: true
1024
+ priority:
1025
+ type: integer
1026
+ title: 'キャンペーンの優先順位'
1027
+ description:
1028
+ type: string
1029
+ maxLength: 200
1030
+ title: 'キャンペーン説明文'
1031
+ bear_point_shop:
1032
+ title: 'ポイントを負担する店舗'
1033
+ $ref: '#/components/schemas/User'
1034
+ private_money:
1035
+ title: 'キャンペーンを適用するマネー'
1036
+ $ref: '#/components/schemas/PrivateMoney'
1037
+ point_calculation_rule:
1038
+ type: string
1039
+ title: 'ポイント計算ルール (banklisp表記)'
1040
+ point_calculation_rule_object:
1041
+ type: string
1042
+ format: json
1043
+ title: 'ポイント計算ルール (JSON文字列による表記)'
1044
+ status:
1045
+ type: string
1046
+ enum: [enabled, disabled]
1047
+ title: 'キャンペーンの現在の状態'
835
1048
  BadRequest:
836
1049
  x-pokepay-schema-type: "response"
837
1050
  oneOf:
@@ -1042,6 +1255,22 @@ paths:
1042
1255
  ユーザーIDです。
1043
1256
 
1044
1257
  指定したユーザーIDのウォレット一覧を取得します。パートナーキーと紐づく組織が発行しているマネーのウォレットのみが表示されます。
1258
+ requestBody:
1259
+ required: true
1260
+ content:
1261
+ application/json:
1262
+ schema:
1263
+ properties:
1264
+ page:
1265
+ type: integer
1266
+ minimum: 1
1267
+ title: 'ページ番号'
1268
+ description: 取得したいページ番号です。デフォルト値は1です。
1269
+ per_page:
1270
+ type: integer
1271
+ minimum: 1
1272
+ title: '1ページ分の取引数'
1273
+ description: 1ページ当たりのウォレット数です。デフォルト値は50です。
1045
1274
  responses:
1046
1275
  '200':
1047
1276
  description: OK
@@ -1055,6 +1284,54 @@ paths:
1055
1284
  $ref: '#/components/responses/Forbidden'
1056
1285
  '404':
1057
1286
  $ref: '#/components/responses/NotFound'
1287
+ post:
1288
+ tags:
1289
+ - Account
1290
+ summary: 'エンドユーザーのウォレットを作成する'
1291
+ x-pokepay-operator-name: "CreateUserAccount"
1292
+ x-pokepay-allow-server-side: true
1293
+ parameters:
1294
+ - in: path
1295
+ name: user_id
1296
+ required: true
1297
+ schema:
1298
+ type: string
1299
+ format: uuid
1300
+ title: 'ユーザーID'
1301
+ description: |-
1302
+ ユーザーIDです。
1303
+ requestBody:
1304
+ required: true
1305
+ content:
1306
+ application/json:
1307
+ schema:
1308
+ required: ["private_money_id"]
1309
+ properties:
1310
+ private_money_id:
1311
+ title: 'マネーID'
1312
+ description: |-
1313
+ マネーIDです。
1314
+
1315
+ 作成するウォレットのマネーを指定します。このパラメータは必須です。
1316
+ type: string
1317
+ format: uuid
1318
+ name:
1319
+ title: 'ウォレット名'
1320
+ type: string
1321
+ maxLength: 256
1322
+ external_id:
1323
+ title: '外部ID'
1324
+ type: string
1325
+ maxLength: 50
1326
+ responses:
1327
+ '200':
1328
+ description: OK
1329
+ content:
1330
+ application/json:
1331
+ schema:
1332
+ $ref: '#/components/schemas/AccountDetail'
1333
+ '422':
1334
+ $ref: '#/components/responses/UnprocessableEntity'
1058
1335
  /accounts/{account_id}:
1059
1336
  get:
1060
1337
  tags:
@@ -1117,19 +1394,73 @@ paths:
1117
1394
  type: boolean
1118
1395
  title: 'ウォレットが凍結されているかどうか'
1119
1396
  description: ウォレットの凍結状態です。真にするとウォレットが凍結され、そのウォレットでは新規取引ができなくなります。偽にすると凍結解除されます。
1397
+ status:
1398
+ type: string
1399
+ enum: [active, suspended, pre-closed]
1400
+ title: 'ウォレット状態'
1401
+ description: ウォレットの状態です。
1402
+ can_transfer_topup:
1403
+ type: boolean
1404
+ title: 'チャージ可能かどうか'
1405
+ description: 店舗ユーザーがエンドユーザーにチャージ可能かどうかです。真にするとチャージ可能となり、偽にするとチャージ不可能となります。
1120
1406
  responses:
1121
1407
  '200':
1122
1408
  description: OK
1123
1409
  content:
1124
1410
  application/json:
1125
1411
  schema:
1126
- $ref: '#/components/schemas/AccountDetail'
1412
+ $ref: '#/components/schemas/Account'
1413
+ '400':
1414
+ $ref: '#/components/responses/BadRequest'
1415
+ '403':
1416
+ $ref: '#/components/responses/Forbidden'
1417
+ '404':
1418
+ $ref: '#/components/responses/NotFound'
1419
+ delete:
1420
+ tags:
1421
+ - Customer
1422
+ summary: 'ウォレットを退会する'
1423
+ description: ウォレットを退会します。一度ウォレットを退会した後は、そのウォレットを再び利用可能な状態に戻すことは出来ません。
1424
+ x-pokepay-operator-name: "DeleteAccount"
1425
+ x-pokepay-allow-server-side: true
1426
+ parameters:
1427
+ - in: path
1428
+ name: account_id
1429
+ required: true
1430
+ schema:
1431
+ type: string
1432
+ format: uuid
1433
+ title: 'ウォレットID'
1434
+ description: |-
1435
+ ウォレットIDです。
1436
+
1437
+ 指定したウォレットIDのウォレットを退会します。
1438
+ requestBody:
1439
+ required: true
1440
+ content:
1441
+ application/json:
1442
+ schema:
1443
+ properties:
1444
+ cashback:
1445
+ type: boolean
1446
+ title: '返金有無'
1447
+ description: 退会時の返金有無です。エンドユーザに返金を行う場合、真を指定して下さい。現在のマネー残高を全て現金で返金したものとして記録されます。
1448
+ responses:
1449
+ '200':
1450
+ description: OK
1451
+ content:
1452
+ application/json:
1453
+ schema:
1454
+ $ref: '#/components/schemas/AccountDeleted'
1127
1455
  '400':
1128
1456
  $ref: '#/components/responses/BadRequest'
1129
1457
  '403':
1130
1458
  $ref: '#/components/responses/Forbidden'
1131
1459
  '404':
1132
1460
  $ref: '#/components/responses/NotFound'
1461
+ '422':
1462
+ $ref: '#/components/responses/UnprocessableEntity'
1463
+
1133
1464
  /accounts/{account_id}/balances:
1134
1465
  get:
1135
1466
  tags:
@@ -1258,6 +1589,62 @@ paths:
1258
1589
  $ref: '#/components/responses/Forbidden'
1259
1590
  '404':
1260
1591
  $ref: '#/components/responses/NotFound'
1592
+ /accounts/{account_id}/customers:
1593
+ patch:
1594
+ tags:
1595
+ - Customer
1596
+ summary: 'ウォレット情報を更新する'
1597
+ description: ウォレットの状態を更新します。
1598
+ x-pokepay-operator-name: "UpdateCustomerAccount"
1599
+ x-pokepay-allow-server-side: true
1600
+ parameters:
1601
+ - in: path
1602
+ name: account_id
1603
+ required: true
1604
+ schema:
1605
+ type: string
1606
+ format: uuid
1607
+ title: 'ウォレットID'
1608
+ description: |-
1609
+ ウォレットIDです。
1610
+
1611
+ 指定したウォレットIDのウォレットの状態を更新します。
1612
+ requestBody:
1613
+ required: true
1614
+ content:
1615
+ application/json:
1616
+ schema:
1617
+ properties:
1618
+ status:
1619
+ type: string
1620
+ enum: [active, suspended, pre-closed]
1621
+ title: 'ウォレット状態'
1622
+ description: ウォレットの状態です。
1623
+ account_name:
1624
+ title: 'アカウント名'
1625
+ type: string
1626
+ maxLength: 256
1627
+ description: 変更するウォレット名です。
1628
+ external_id:
1629
+ title: '外部ID'
1630
+ type: string
1631
+ maxLength: 50
1632
+ description: 変更する外部IDです。
1633
+ responses:
1634
+ '200':
1635
+ description: OK
1636
+ content:
1637
+ application/json:
1638
+ schema:
1639
+ $ref: '#/components/schemas/AccountWithUser'
1640
+ '400':
1641
+ $ref: '#/components/responses/BadRequest'
1642
+ '403':
1643
+ $ref: '#/components/responses/Forbidden'
1644
+ '404':
1645
+ $ref: '#/components/responses/NotFound'
1646
+ '422':
1647
+ $ref: '#/components/responses/UnprocessableEntity'
1261
1648
  /accounts/customers:
1262
1649
  get:
1263
1650
  tags:
@@ -1305,6 +1692,11 @@ paths:
1305
1692
  type: boolean
1306
1693
  title: 'ウォレットが凍結状態かどうかでフィルターする'
1307
1694
  description: このパラメータが指定されている場合、ウォレットの凍結状態で結果がフィルターされます。デフォルトでは未指定です。
1695
+ status:
1696
+ type: string
1697
+ enum: [active, suspended, pre-closed]
1698
+ title: 'ウォレット状態'
1699
+ description: このパラメータが指定されている場合、ウォレットの状態で結果がフィルターされます。デフォルトでは未指定です。
1308
1700
  external_id:
1309
1701
  type: string
1310
1702
  maxLength: 50
@@ -1656,6 +2048,7 @@ paths:
1656
2048
  - Check
1657
2049
  summary: 'チャージQRコードの発行'
1658
2050
  x-pokepay-operator-name: "CreateCheck"
2051
+ x-pokepay-allow-server-side: true
1659
2052
  requestBody:
1660
2053
  required: true
1661
2054
  content:
@@ -1723,6 +2116,37 @@ paths:
1723
2116
  $ref: '#/components/schemas/Check'
1724
2117
  '400':
1725
2118
  $ref: '#/components/responses/InvalidParameters'
2119
+ /cpm/{cpm_token}:
2120
+ get:
2121
+ tags:
2122
+ - Transaction
2123
+ summary: 'CPMトークンの状態取得'
2124
+ description: CPMトークンの現在の状態を取得します。CPMトークンの有効期限やCPM取引の状態を返します。
2125
+ x-pokepay-operator-name: "GetCpmToken"
2126
+ x-pokepay-allow-server-side: true
2127
+ parameters:
2128
+ - in: path
2129
+ name: cpm_token
2130
+ required: true
2131
+ schema:
2132
+ type: string
2133
+ minLength: 22
2134
+ maxLength: 22
2135
+ title: CPMトークン
2136
+ description: CPM取引時にエンドユーザーが店舗に提示するバーコードを解析して得られる22桁の文字列です。
2137
+ responses:
2138
+ '200':
2139
+ description: OK
2140
+ content:
2141
+ application/json:
2142
+ schema:
2143
+ $ref: '#/components/schemas/CpmToken'
2144
+ '400':
2145
+ $ref: '#/components/responses/BadRequest'
2146
+ '403':
2147
+ $ref: '#/components/responses/Forbidden'
2148
+ '422':
2149
+ $ref: '#/components/responses/UnprocessableEntity'
1726
2150
  /transactions:
1727
2151
  get:
1728
2152
  tags:
@@ -1848,13 +2272,19 @@ paths:
1848
2272
  エンドユーザーから店舗への送金取引(支払い)
1849
2273
 
1850
2274
  3. exchange-outflow
1851
-   他マネーへの流出
2275
+ 他マネーへの流出
1852
2276
 
1853
2277
  4. exchange-inflow
1854
2278
  他マネーからの流入
2279
+
2280
+ 5. cashback
2281
+ 退会時返金取引
2282
+
2283
+ 6. expire
2284
+ 退会時失効取引
1855
2285
  items:
1856
2286
  type: string
1857
- enum: [topup, payment, exchange_outflow, exchange_inflow]
2287
+ enum: [topup, payment, exchange_outflow, exchange_inflow, cashback, expire]
1858
2288
  description:
1859
2289
  type: string
1860
2290
  maxLength: 200
@@ -1922,7 +2352,7 @@ paths:
1922
2352
  content:
1923
2353
  application/json:
1924
2354
  schema:
1925
- $ref: '#/components/schemas/Transaction'
2355
+ $ref: '#/components/schemas/TransactionDetail'
1926
2356
  '400':
1927
2357
  $ref: '#/components/responses/BadRequest'
1928
2358
  '403':
@@ -1977,21 +2407,23 @@ paths:
1977
2407
 
1978
2408
  ポイント支払い時に実際お金を負担する店舗を指定します。
1979
2409
  money_amount:
1980
- type: number
2410
+ type: integer
1981
2411
  minimum: 0
1982
2412
  title: 'マネー額'
1983
2413
  description: |-
1984
2414
  マネー額です。
1985
2415
 
1986
2416
  送金するマネー額を指定します。
2417
+ デフォルト値は0で、money_amountとpoint_amountの両方が0のときにはinvalid_parameter_both_point_and_money_are_zero(エラーコード400)が返ります。
1987
2418
  point_amount:
1988
- type: number
2419
+ type: integer
1989
2420
  minimum: 0
1990
2421
  title: 'ポイント額'
1991
2422
  description: |-
1992
2423
  ポイント額です。
1993
2424
 
1994
2425
  送金するポイント額を指定します。
2426
+ デフォルト値は0で、money_amountとpoint_amountの両方が0のときにはinvalid_parameter_both_point_and_money_are_zero(エラーコード400)が返ります。
1995
2427
  point_expires_at:
1996
2428
  type: string
1997
2429
  format: date-time
@@ -2008,6 +2440,16 @@ paths:
2008
2440
 
2009
2441
  任意入力で、取引履歴に表示される説明文です。
2010
2442
  example: 初夏のチャージキャンペーン
2443
+ metadata:
2444
+ type: string
2445
+ format: json
2446
+ title: '取引メタデータ'
2447
+ description: |-
2448
+ 取引作成時に指定されるメタデータです。
2449
+
2450
+ 任意入力で、全てのkeyとvalueが文字列であるようなフラットな構造のJSON文字列で指定します。
2451
+ example: |-
2452
+ {"key":"value"}
2011
2453
  request_id:
2012
2454
  type: string
2013
2455
  format: uuid
@@ -2025,7 +2467,7 @@ paths:
2025
2467
  content:
2026
2468
  application/json:
2027
2469
  schema:
2028
- $ref: '#/components/schemas/Transaction'
2470
+ $ref: '#/components/schemas/TransactionDetail'
2029
2471
  '400':
2030
2472
  $ref: '#/components/responses/BadRequest'
2031
2473
  '403':
@@ -2072,7 +2514,7 @@ paths:
2072
2514
  content:
2073
2515
  application/json:
2074
2516
  schema:
2075
- $ref: '#/components/schemas/Transaction'
2517
+ $ref: '#/components/schemas/TransactionDetail'
2076
2518
  '400':
2077
2519
  $ref: '#/components/responses/BadRequest'
2078
2520
  '403':
@@ -2108,37 +2550,211 @@ paths:
2108
2550
  送金先の店舗を指定します。
2109
2551
  customer_id:
2110
2552
  type: string
2111
- format: uuid
2112
- title: 'エンドユーザーID'
2553
+ format: uuid
2554
+ title: 'エンドユーザーID'
2555
+ description: |-
2556
+ エンドユーザーIDです。
2557
+
2558
+ 送金元のエンドユーザーを指定します。
2559
+ private_money_id:
2560
+ type: string
2561
+ format: uuid
2562
+ title: 'マネーID'
2563
+ description: |-
2564
+ マネーIDです。
2565
+
2566
+ マネーを指定します。
2567
+ amount:
2568
+ type: integer
2569
+ minimum: 0
2570
+ title: '支払い額'
2571
+ description: |-
2572
+ マネー額です。
2573
+
2574
+ 送金するマネー額を指定します。
2575
+ description:
2576
+ type: string
2577
+ maxLength: 200
2578
+ title: '取引履歴に表示する説明文'
2579
+ description: |-
2580
+ 取引説明文です。
2581
+
2582
+ 任意入力で、取引履歴に表示される説明文です。
2583
+ example: たい焼き(小倉)
2584
+ metadata:
2585
+ type: string
2586
+ format: json
2587
+ title: '取引メタデータ'
2588
+ description: |-
2589
+ 取引作成時に指定されるメタデータです。
2590
+
2591
+ 任意入力で、全てのkeyとvalueが文字列であるようなフラットな構造のJSON文字列で指定します。
2592
+ example: |-
2593
+ {"key":"value"}
2594
+ products:
2595
+ type: array
2596
+ items:
2597
+ type: object
2598
+ properties:
2599
+ jan_code:
2600
+ type: string
2601
+ maxLength: 64
2602
+ name:
2603
+ type: string
2604
+ maxLength: 256
2605
+ unit_price:
2606
+ type: number
2607
+ minimum: 0
2608
+ price:
2609
+ type: number
2610
+ minimum: 0
2611
+ is_discounted:
2612
+ type: boolean
2613
+ other:
2614
+ type: string
2615
+ format: json
2616
+ example: |-
2617
+ {"jan_code":"abc",
2618
+ "name":"name1",
2619
+ "unit_price":100,
2620
+ "price": 100,
2621
+ "is_discounted": false,
2622
+ "other":"{}"}
2623
+ title: '商品情報データ'
2624
+ description: |-
2625
+ 一つの取引に含まれる商品情報データです。
2626
+ 以下の内容からなるJSONオブジェクトの配列で指定します。
2627
+
2628
+ - `jan_code`: JANコード。64字以下の文字列
2629
+ - `name`: 商品名。256字以下の文字列
2630
+ - `unit_price`: 商品単価。0以上の数値
2631
+ - `price`: 全体の金額(例: 商品単価 × 個数)。0以上の数値
2632
+ - `is_discounted`: 賞味期限が近いなどの理由で商品が値引きされているかどうかのフラグ。boolean
2633
+ - `other`: その他商品に関する情報。JSONオブジェクトで指定します。
2634
+ request_id:
2635
+ type: string
2636
+ format: uuid
2637
+ title: 'リクエストID'
2638
+ description: |-
2639
+ 取引作成APIの羃等性を担保するためのリクエスト固有のIDです。
2640
+
2641
+ 取引作成APIで結果が受け取れなかったなどの理由で再試行する際に、二重に取引が作られてしまうことを防ぐために、クライアント側から指定されます。指定は任意で、UUID V4フォーマットでランダム生成した文字列です。リクエストIDは一定期間で削除されます。
2642
+
2643
+ リクエストIDを指定したとき、まだそのリクエストIDに対する取引がない場合、新規に取引が作られレスポンスとして返されます。もしそのリクエストIDに対する取引が既にある場合、既存の取引がレスポンスとして返されます。
2644
+ example: '9dbfd997-b948-40d3-a3bf-6bc1a01368d2'
2645
+ responses:
2646
+ '200':
2647
+ description: OK
2648
+ content:
2649
+ application/json:
2650
+ schema:
2651
+ $ref: '#/components/schemas/TransactionDetail'
2652
+ '400':
2653
+ $ref: '#/components/responses/BadRequest'
2654
+ '403':
2655
+ $ref: '#/components/responses/Forbidden'
2656
+ '422':
2657
+ $ref: '#/components/responses/UnprocessableEntity'
2658
+ /transactions/cpm:
2659
+ post:
2660
+ tags:
2661
+ - Transaction
2662
+ summary: 'CPMトークンによる取引作成'
2663
+ description: |
2664
+ CPMトークンにより取引を作成します。
2665
+ CPMトークンに設定されたスコープの取引を作ることができます。
2666
+ x-pokepay-operator-name: "CreateCpmTransaction"
2667
+ x-pokepay-allow-server-side: true
2668
+ requestBody:
2669
+ required: true
2670
+ content:
2671
+ application/json:
2672
+ schema:
2673
+ required: ["cpm_token", "shop_id", "amount"]
2674
+ properties:
2675
+ cpm_token:
2676
+ type: string
2677
+ minLength: 22
2678
+ maxLength: 22
2679
+ title: 'CPMトークン'
2113
2680
  description: |-
2114
- エンドユーザーIDです。
2681
+ エンドユーザーによって作られ、アプリなどに表示され、店舗に対して提示される22桁の文字列です。
2115
2682
 
2116
- 送金元のエンドユーザーを指定します。
2117
- private_money_id:
2683
+ エンドユーザーによって許可された取引のスコープを持っています。
2684
+ shop_id:
2118
2685
  type: string
2119
2686
  format: uuid
2120
- title: 'マネーID'
2687
+ title: '店舗ID'
2121
2688
  description: |-
2122
- マネーIDです。
2689
+ 店舗IDです。
2123
2690
 
2124
- マネーを指定します。
2691
+ 支払いやチャージを行う店舗を指定します。
2125
2692
  amount:
2126
2693
  type: number
2127
- minimum: 0
2128
- title: '支払い額'
2694
+ title: '取引金額'
2129
2695
  description: |-
2130
- マネー額です。
2696
+ 取引金額を指定します。
2131
2697
 
2132
- 送金するマネー額を指定します。
2698
+ 正の値を与えるとチャージになり、負の値を与えると支払いとなります。
2133
2699
  description:
2134
2700
  type: string
2135
2701
  maxLength: 200
2136
- title: '取引履歴に表示する説明文'
2702
+ title: '取引説明文'
2137
2703
  description: |-
2138
2704
  取引説明文です。
2139
2705
 
2140
- 任意入力で、取引履歴に表示される説明文です。
2706
+ エンドユーザーアプリの取引履歴などに表示されます。
2141
2707
  example: たい焼き(小倉)
2708
+ metadata:
2709
+ type: string
2710
+ format: json
2711
+ title: '店舗側メタデータ'
2712
+ description: |-
2713
+ 取引作成時に店舗側から指定されるメタデータです。
2714
+
2715
+ 任意入力で、全てのkeyとvalueが文字列であるようなフラットな構造のJSON文字列で指定します。
2716
+ example: |-
2717
+ {"key":"value"}
2718
+ products:
2719
+ type: array
2720
+ items:
2721
+ type: object
2722
+ properties:
2723
+ jan_code:
2724
+ type: string
2725
+ maxLength: 64
2726
+ name:
2727
+ type: string
2728
+ maxLength: 256
2729
+ unit_price:
2730
+ type: number
2731
+ minimum: 0
2732
+ price:
2733
+ type: number
2734
+ minimum: 0
2735
+ is_discounted:
2736
+ type: boolean
2737
+ other:
2738
+ type: string
2739
+ format: json
2740
+ example: |-
2741
+ {"jan_code":"abc",
2742
+ "name":"name1",
2743
+ "unit_price":100,
2744
+ "price": 100,
2745
+ "is_discounted": false,
2746
+ "other":"{}"}
2747
+ title: 商品情報データ
2748
+ description: |-
2749
+ 一つの取引に含まれる商品情報データです。
2750
+ 以下の内容からなるJSONオブジェクトの配列で指定します。
2751
+
2752
+ - `jan_code`: JANコード。64字以下の文字列
2753
+ - `name`: 商品名。256字以下の文字列
2754
+ - `unit_price`: 商品単価。0以上の数値
2755
+ - `price`: 全体の金額(例: 商品単価 × 個数)。0以上の数値
2756
+ - `is_discounted`: 賞味期限が近いなどの理由で商品が値引きされているかどうかのフラグ。boolean
2757
+ - `other`: その他商品に関する情報。JSONオブジェクトで指定します。
2142
2758
  request_id:
2143
2759
  type: string
2144
2760
  format: uuid
@@ -2156,7 +2772,64 @@ paths:
2156
2772
  content:
2157
2773
  application/json:
2158
2774
  schema:
2159
- $ref: '#/components/schemas/Transaction'
2775
+ $ref: '#/components/schemas/TransactionDetail'
2776
+ examples:
2777
+ example-1:
2778
+ value:
2779
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2780
+ type: string
2781
+ is_modified: true
2782
+ sender:
2783
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2784
+ name: string
2785
+ is_merchant: true
2786
+ sender_account:
2787
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2788
+ name: string
2789
+ is_suspended: true
2790
+ private_money:
2791
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2792
+ name: string
2793
+ unit: string
2794
+ is_exclusive: true
2795
+ description: string
2796
+ oneline_message: string
2797
+ organization:
2798
+ code: string
2799
+ name: string
2800
+ max_balance: 0
2801
+ transfer_limit: 0
2802
+ type: own
2803
+ expiration_type: static
2804
+ enable_topup_by_member: true
2805
+ receiver:
2806
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2807
+ name: string
2808
+ is_merchant: true
2809
+ receiver_account:
2810
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2811
+ name: string
2812
+ is_suspended: true
2813
+ private_money:
2814
+ id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
2815
+ name: string
2816
+ unit: string
2817
+ is_exclusive: true
2818
+ description: string
2819
+ oneline_message: string
2820
+ organization:
2821
+ code: string
2822
+ name: string
2823
+ max_balance: 0
2824
+ transfer_limit: 0
2825
+ type: own
2826
+ expiration_type: static
2827
+ enable_topup_by_member: true
2828
+ amount: 0
2829
+ money_amount: 0
2830
+ point_amount: 0
2831
+ done_at: '2019-08-24T14:15:22Z'
2832
+ description: string
2160
2833
  '400':
2161
2834
  $ref: '#/components/responses/BadRequest'
2162
2835
  '403':
@@ -2212,6 +2885,16 @@ paths:
2212
2885
  マネー額です。
2213
2886
 
2214
2887
  送金するマネー額を指定します。
2888
+ metadata:
2889
+ type: string
2890
+ format: json
2891
+ title: '取引メタデータ'
2892
+ description: |-
2893
+ 取引作成時に指定されるメタデータです。
2894
+
2895
+ 任意入力で、全てのkeyとvalueが文字列であるようなフラットな構造のJSON文字列で指定します。
2896
+ example: |-
2897
+ {"key":"value"}
2215
2898
  description:
2216
2899
  type: string
2217
2900
  maxLength: 200
@@ -2238,7 +2921,7 @@ paths:
2238
2921
  content:
2239
2922
  application/json:
2240
2923
  schema:
2241
- $ref: '#/components/schemas/Transaction'
2924
+ $ref: '#/components/schemas/TransactionDetail'
2242
2925
  '400':
2243
2926
  $ref: '#/components/responses/BadRequest'
2244
2927
  '403':
@@ -2289,7 +2972,7 @@ paths:
2289
2972
  content:
2290
2973
  application/json:
2291
2974
  schema:
2292
- $ref: '#/components/schemas/Transaction'
2975
+ $ref: '#/components/schemas/TransactionDetail'
2293
2976
  '400':
2294
2977
  $ref: '#/components/responses/BadRequest'
2295
2978
  '422':
@@ -2393,7 +3076,7 @@ paths:
2393
3076
  content:
2394
3077
  application/json:
2395
3078
  schema:
2396
- $ref: '#/components/schemas/Transaction'
3079
+ $ref: '#/components/schemas/TransactionDetail'
2397
3080
  '400':
2398
3081
  $ref: '#/components/responses/InvalidParameters'
2399
3082
  '403':
@@ -2404,8 +3087,16 @@ paths:
2404
3087
  post:
2405
3088
  tags:
2406
3089
  - Transaction
2407
- summary: '返金する'
2408
- x-pokepay-operator-name: "RefundTransaction"
3090
+ summary: '取引をキャンセルする'
3091
+ description: |-
3092
+ 取引IDを指定して取引をキャンセルします。
3093
+
3094
+ 発行体の管理者は自組織の直営店、または発行しているマネーの決済加盟店組織での取引をキャンセルできます。
3095
+ キャンセル対象の取引に付随するポイント還元キャンペーンやクーポン適用も取り消されます。
3096
+
3097
+ チャージ取引のキャンセル時に返金すべき残高が足りないときは `account_balance_not_enough (422)` エラーが返ります。
3098
+ 取引をキャンセルできるのは1回きりです。既にキャンセルされた取引を重ねてキャンセルしようとすると `transaction_already_refunded (422)` エラーが返ります。
3099
+ x-pokepay-operator-name: RefundTransaction
2409
3100
  x-pokepay-allow-server-side: true
2410
3101
  parameters:
2411
3102
  - in: path
@@ -2432,7 +3123,186 @@ paths:
2432
3123
  content:
2433
3124
  application/json:
2434
3125
  schema:
2435
- $ref: '#/components/schemas/Transaction'
3126
+ $ref: '#/components/schemas/TransactionDetail'
3127
+ '403':
3128
+ $ref: '#/components/responses/Forbidden'
3129
+ '422':
3130
+ $ref: '#/components/responses/UnprocessableEntity'
3131
+ /external-transactions:
3132
+ post:
3133
+ tags:
3134
+ - Event
3135
+ summary: 'ポケペイ外部取引を作成する'
3136
+ description: |
3137
+ ポケペイ外部取引を作成します。
3138
+
3139
+ ポケペイ外の現金決済やクレジットカード決済に対してポケペイのポイントを付けたいというときに使用します。
3140
+ x-pokepay-operator-name: "CreateExternalTransaction"
3141
+ x-pokepay-allow-server-side: true
3142
+ requestBody:
3143
+ required: true
3144
+ content:
3145
+ application/json:
3146
+ schema:
3147
+ required:
3148
+ - private_money_id
3149
+ - shop_id
3150
+ - customer_id
3151
+ - amount
3152
+ properties:
3153
+ shop_id:
3154
+ type: string
3155
+ format: uuid
3156
+ title: 店舗ID
3157
+ description: |-
3158
+ 店舗IDです。
3159
+
3160
+ ポケペイ外部取引が行なう店舗を指定します。
3161
+ customer_id:
3162
+ type: string
3163
+ format: uuid
3164
+ title: エンドユーザーID
3165
+ description: |-
3166
+ エンドユーザーIDです。
3167
+
3168
+ エンドユーザーを指定します。
3169
+ private_money_id:
3170
+ type: string
3171
+ format: uuid
3172
+ title: マネーID
3173
+ description: |-
3174
+ マネーIDです。
3175
+
3176
+ マネーを指定します。
3177
+ amount:
3178
+ type: integer
3179
+ minimum: 0
3180
+ title: 取引額
3181
+ description: |-
3182
+ 取引金額です。
3183
+ description:
3184
+ type: string
3185
+ maxLength: 200
3186
+ title: 取引説明文
3187
+ description: |-
3188
+ 取引説明文です。
3189
+
3190
+ 任意入力で、取引履歴に表示される説明文です。
3191
+ example: たい焼き(小倉)
3192
+ metadata:
3193
+ type: string
3194
+ format: json
3195
+ title: ポケペイ外部取引メタデータ
3196
+ description: |-
3197
+ ポケペイ外部取引作成時に指定され、取引と紐付けられるメタデータです。
3198
+
3199
+ 任意入力で、全てのkeyとvalueが文字列であるようなフラットな構造のJSONで指定します。
3200
+ example: |-
3201
+ {"key":"value"}
3202
+ products:
3203
+ type: array
3204
+ items:
3205
+ type: object
3206
+ properties:
3207
+ jan_code:
3208
+ type: string
3209
+ maxLength: 64
3210
+ name:
3211
+ type: string
3212
+ maxLength: 256
3213
+ unit_price:
3214
+ type: number
3215
+ minimum: 0
3216
+ price:
3217
+ type: number
3218
+ minimum: 0
3219
+ is_discounted:
3220
+ type: boolean
3221
+ other:
3222
+ type: string
3223
+ format: json
3224
+ example: |-
3225
+ {"jan_code":"abc",
3226
+ "name":"name1",
3227
+ "unit_price":100,
3228
+ "price": 100,
3229
+ "is_discounted": false,
3230
+ "other":"{}"}
3231
+ title: '商品情報データ'
3232
+ description: |-
3233
+ 一つの取引に含まれる商品情報データです。
3234
+ 以下の内容からなるJSONオブジェクトの配列で指定します。
3235
+
3236
+ - `jan_code`: JANコード。64字以下の文字列
3237
+ - `name`: 商品名。256字以下の文字列
3238
+ - `unit_price`: 商品単価。0以上の数値
3239
+ - `price`: 全体の金額(例: 商品単価 × 個数)。0以上の数値
3240
+ - `is_discounted`: 賞味期限が近いなどの理由で商品が値引きされているかどうかのフラグ。boolean
3241
+ - `other`: その他商品に関する情報。JSONオブジェクトで指定します。
3242
+ request_id:
3243
+ type: string
3244
+ format: uuid
3245
+ title: リクエストID
3246
+ description: |-
3247
+ 取引作成APIの羃等性を担保するためのリクエスト固有のIDです。
3248
+
3249
+ 取引作成APIで結果が受け取れなかったなどの理由で再試行する際に、二重に取引が作られてしまうことを防ぐために、クライアント側から指定されます。指定は任意で、UUID V4フォーマットでランダム生成した文字列です。リクエストIDは一定期間で削除されます。
3250
+
3251
+ リクエストIDを指定したとき、まだそのリクエストIDに対する取引がない場合、新規に取引が作られレスポンスとして返されます。もしそのリクエストIDに対する取引が既にある場合、既存の取引がレスポンスとして返されます。
3252
+ example: 9dbfd997-b948-40d3-a3bf-6bc1a01368d2
3253
+ responses:
3254
+ '200':
3255
+ description: OK
3256
+ content:
3257
+ application/json:
3258
+ schema:
3259
+ $ref: '#/components/schemas/ExternalTransaction'
3260
+ '400':
3261
+ $ref: '#/components/responses/BadRequest'
3262
+ '403':
3263
+ $ref: '#/components/responses/Forbidden'
3264
+ '422':
3265
+ $ref: '#/components/responses/UnprocessableEntity'
3266
+ /external-transactions/{event_id}/refund:
3267
+ post:
3268
+ tags:
3269
+ - Event
3270
+ summary: 'ポケペイ外部取引をキャンセルする'
3271
+ description: |-
3272
+ 取引IDを指定して取引をキャンセルします。
3273
+
3274
+ 発行体の管理者は自組織の直営店、または発行しているマネーの決済加盟店組織での取引をキャンセルできます。
3275
+ キャンセル対象のポケペイ外部取引に付随するポイント還元キャンペーンも取り消されます。
3276
+
3277
+ 取引をキャンセルできるのは1回きりです。既にキャンセルされた取引を重ねてキャンセルしようとすると `transaction_already_refunded (422)` エラーが返ります。
3278
+ x-pokepay-operator-name: RefundExternalTransaction
3279
+ x-pokepay-allow-server-side: true
3280
+ parameters:
3281
+ - in: path
3282
+ name: event_id
3283
+ required: true
3284
+ schema:
3285
+ type: string
3286
+ format: uuid
3287
+ title: '取引ID'
3288
+ requestBody:
3289
+ required: true
3290
+ content:
3291
+ application/json:
3292
+ schema:
3293
+ properties:
3294
+ description:
3295
+ type: string
3296
+ maxLength: 200
3297
+ title: '取引履歴に表示する返金事由'
3298
+ example: '返品対応のため'
3299
+ responses:
3300
+ '200':
3301
+ description: OK
3302
+ content:
3303
+ application/json:
3304
+ schema:
3305
+ $ref: '#/components/schemas/ExternalTransaction'
2436
3306
  '403':
2437
3307
  $ref: '#/components/responses/Forbidden'
2438
3308
  '422':
@@ -2485,7 +3355,7 @@ paths:
2485
3355
  type: array
2486
3356
  items:
2487
3357
  type: string
2488
- enum: [topup, payment, transfer, exchange]
3358
+ enum: [topup, payment, transfer, exchange, cashback, expire]
2489
3359
  transfer_types:
2490
3360
  type: array
2491
3361
  description: |-
@@ -2507,9 +3377,15 @@ paths:
2507
3377
 
2508
3378
  5. coupon
2509
3379
  クーポンによる値引き処理、またはそのキャンセル取引
3380
+
3381
+ 6. cashback
3382
+ 退会時の返金取引
3383
+
3384
+ 7. expire
3385
+ 退会時失効取引
2510
3386
  items:
2511
3387
  type: string
2512
- enum: [topup, payment, exchange, transfer, coupon, campaign]
3388
+ enum: [topup, payment, exchange, transfer, coupon, campaign, cashback, expire]
2513
3389
  description:
2514
3390
  type: string
2515
3391
  maxLength: 200
@@ -2546,7 +3422,7 @@ paths:
2546
3422
  type: string
2547
3423
  maxLength: 32
2548
3424
  title: '新規組織コード'
2549
- example: ox_supermarket
3425
+ example: ox-supermarket
2550
3426
  name:
2551
3427
  type: string
2552
3428
  maxLength: 256
@@ -2576,7 +3452,7 @@ paths:
2576
3452
  type: string
2577
3453
  pattern: '^$|^[0-9]{4}$'
2578
3454
  title: '銀行金融機関コード'
2579
- example: 99X
3455
+ example: '1234'
2580
3456
  bank_branch_name:
2581
3457
  type: string
2582
3458
  maxLength: 64
@@ -2586,7 +3462,7 @@ paths:
2586
3462
  type: string
2587
3463
  pattern: '^(|[0-9]{3})$'
2588
3464
  title: '銀行支店コード'
2589
- example: 99X
3465
+ example: '123'
2590
3466
  bank_account_type:
2591
3467
  type: string
2592
3468
  enum: [saving, current, other]
@@ -2596,7 +3472,7 @@ paths:
2596
3472
  maxLength: 7
2597
3473
  pattern: '[0-9]{0,7}'
2598
3474
  title: '銀行口座番号'
2599
- example: 9999999
3475
+ example: '1234567'
2600
3476
  bank_account_holder_name:
2601
3477
  # TODO: flico
2602
3478
  type: string
@@ -3150,7 +4026,8 @@ paths:
3150
4026
  フィルターとして使われ、指定された受取ユーザーでの取引のみ一覧に表示されます。
3151
4027
  type:
3152
4028
  type: string
3153
- title: '取引種別、チャージ=topup、支払い=payment、個人間送金=transfer'
4029
+ enum: [topup, payment, exchange, transfer, cashback, expire]
4030
+ title: '取引種別'
3154
4031
  description: |-
3155
4032
  取引の種類でフィルターします。
3156
4033
 
@@ -3164,6 +4041,10 @@ paths:
3164
4041
  他マネーへの流出(outflow)/他マネーからの流入(inflow)
3165
4042
  4. transfer
3166
4043
  個人間送金
4044
+ 5. cashback
4045
+ ウォレット退会時返金
4046
+ 6. expire
4047
+ ウォレット退会時失効
3167
4048
  is_modified:
3168
4049
  type: boolean
3169
4050
  title: 'キャンセル済みかどうか'
@@ -3492,3 +4373,409 @@ paths:
3492
4373
  $ref: '#/components/responses/NotFound'
3493
4374
  '422':
3494
4375
  $ref: '#/components/responses/UnprocessableEntity'
4376
+ /campaigns:
4377
+ post:
4378
+ tags:
4379
+ - Campaign
4380
+ summary: 'ポイント付与キャンペーンを作る'
4381
+ description: |
4382
+ ポイント付与キャンペーンを作成します。
4383
+ x-pokepay-operator-name: "CreateCampaign"
4384
+ x-pokepay-allow-server-side: true
4385
+ requestBody:
4386
+ required: true
4387
+ content:
4388
+ application/json:
4389
+ schema:
4390
+ required: ["name", "private_money_id", "starts_at", "ends_at","priority", "event"]
4391
+ properties:
4392
+ name:
4393
+ title: 'キャンペーン名'
4394
+ type: string
4395
+ maxLength: 256
4396
+ description: |-
4397
+ キャンペーン名です(必須項目)。
4398
+
4399
+ ポイント付与によってできるチャージ取引の説明文に転記されます。取引説明文はエンドユーザーからも確認できます。
4400
+ private_money_id:
4401
+ type: string
4402
+ format: uuid
4403
+ title: 'マネーID'
4404
+ description: |-
4405
+ キャンペーン対象のマネーのIDです(必須項目)。
4406
+ starts_at:
4407
+ type: string
4408
+ format: date-time
4409
+ title: 'キャンペーン開始日時'
4410
+ description: |-
4411
+ キャンペーン開始日時です(必須項目)。
4412
+ キャンペーン期間中のみポイントが付与されます。
4413
+ 開始日時よりも終了日時が前のときはcampaign_invalid_periodエラー(422)になります。
4414
+ ends_at:
4415
+ type: string
4416
+ format: date-time
4417
+ title: 'キャンペーン終了日時'
4418
+ description: |-
4419
+ キャンペーン終了日時です(必須項目)。
4420
+ キャンペーン期間中のみポイントが付与されます。
4421
+ 開始日時よりも終了日時が前のときはcampaign_invalid_periodエラー(422)になります。
4422
+ priority:
4423
+ type: integer
4424
+ title: 'キャンペーンの適用優先度'
4425
+ description: |-
4426
+ キャンペーンの適用優先度です。
4427
+
4428
+ 優先度が大きいものから順に適用判定されていきます。
4429
+ キャンペーン期間が重なっている同一の優先度のキャンペーンが存在するとcampaign_period_overlapsエラー(422)になります。
4430
+ event:
4431
+ type: string
4432
+ enum: [topup, payment, external-transaction]
4433
+ title: 'イベント種別'
4434
+ description: |-
4435
+ キャンペーンのトリガーとなるイベントの種類を指定します(必須項目)。
4436
+
4437
+ 以下のいずれかを指定できます。
4438
+
4439
+ 1. topup
4440
+ 店舗からエンドユーザーへの送金取引(チャージ)
4441
+ 2. payment
4442
+ エンドユーザーから店舗への送金取引(支払い)
4443
+ 3. external-transaction
4444
+ ポケペイ外の取引(現金決済など)
4445
+ bear_point_shop_id:
4446
+ type: string
4447
+ format: uuid
4448
+ title: 'ポイント負担先店舗ID'
4449
+ description: |-
4450
+ ポイントを負担する店舗のIDです。デフォルトではマネー発行体の本店が設定されます。
4451
+ description:
4452
+ type: string
4453
+ maxLength: 200
4454
+ title: 'キャンペーンの説明文'
4455
+ description: |-
4456
+ キャンペーンの内容を記載します。管理画面などでキャンペーンを管理するための説明文になります。
4457
+ status:
4458
+ type: string
4459
+ enum: [enabled, disabled]
4460
+ title: 'キャンペーン作成時の状態'
4461
+ description: |-
4462
+ キャンペーン作成時の状態を指定します。デフォルトではenabledです。
4463
+
4464
+ 以下のいずれかを指定できます。
4465
+
4466
+ 1. enabled
4467
+ 有効
4468
+ 2. disabled
4469
+ 無効
4470
+ point_expires_at:
4471
+ type: string
4472
+ format: date-time
4473
+ title: 'ポイント有効期限(絶対日時指定)'
4474
+ description: |-
4475
+ キャンペーンによって付与されるポイントの有効期限を絶対日時で指定します。
4476
+ 省略した場合はマネーに設定された有効期限と同じものがポイントの有効期限となります。
4477
+ point_expires_in_days:
4478
+ type: integer
4479
+ minimum: 1
4480
+ title: 'ポイント有効期限(相対日数指定)'
4481
+ description: |-
4482
+ キャンペーンによって付与されるポイントの有効期限を相対日数で指定します。
4483
+ 省略した場合はマネーに設定された有効期限と同じものがポイントの有効期限となります。
4484
+ is_exclusive:
4485
+ type: boolean
4486
+ title: 'キャンペーンの重複設定'
4487
+ description: |-
4488
+ キャンペーンの重ね掛けを行うかどうかのフラグです。
4489
+
4490
+ これにtrueを指定すると他のキャンペーンと同時適用されません。デフォルト値はtrueです。
4491
+ falseを指定すると次の優先度の重ね掛け可能なキャンペーンの適用判定に進みます。
4492
+ subject:
4493
+ type: string
4494
+ enum: [money, all]
4495
+ title: 'ポイント付与の対象金額の種別'
4496
+ description: |-
4497
+ ポイント付与額を計算する対象となる金額の種類を指定します。デフォルト値はallです。
4498
+ eventとしてexternal-transactionを指定した場合はポイントとマネーの区別がないためsubjectの指定に関わらず常にallとなります。
4499
+
4500
+ 以下のいずれかを指定できます。
4501
+
4502
+ 1. money
4503
+ moneyを指定すると決済額の中で「マネー」を使って支払った額を対象にします
4504
+
4505
+ 2. all
4506
+ all を指定すると決済額全体を対象にします (「ポイント」での取引額を含む)
4507
+ 注意: event を topup にしたときはポイントの付与に対しても適用されます
4508
+ amount_based_point_rules:
4509
+ type: array
4510
+ items:
4511
+ type: object
4512
+ properties:
4513
+ point_amount:
4514
+ type: number
4515
+ format: decimal
4516
+ minimum: 0
4517
+ title: '付与ポイント量'
4518
+ description: |-
4519
+ キャンペーンにより付与するポイント量。(必須項目)
4520
+
4521
+ point_amount_unitにより指定される単位が絶対額のときは小数点以下が切り捨てられ整数として扱われます。
4522
+ パーセント指定の時は小数を許容し、割合計算後に小数点以下が切り捨てられます。
4523
+ いずれの場合も実際に付与されるポイントは整数のみです。
4524
+ point_amount_unit:
4525
+ type: string
4526
+ enum: [percent, absolute]
4527
+ title: '付与ポイント量の単位'
4528
+ description: |-
4529
+ キャンペーンにより付与するポイント量の単位を指定します。(必須項目)
4530
+
4531
+ 以下のいずれかを指定できます。
4532
+
4533
+ 1. percent
4534
+ 付与するポイント量が元取引の取引額に応じて割合で変化するときに指定します。
4535
+
4536
+ 2. absolute
4537
+ 付与するポイント量が元取引の取引額に依存しない絶対額であるときに指定します。
4538
+ subject_more_than:
4539
+ type: integer
4540
+ minimum: 0
4541
+ title: '対象金額の下限値 (x <)'
4542
+ description: |-
4543
+ 対象金額の下限値 (x <) を指定します (ただし、指定された金額は含まない)。
4544
+ subject_more_than_or_equal といずれかのみ指定できます。
4545
+ subject_more_than_or_equal:
4546
+ type: integer
4547
+ minimum: 0
4548
+ title: '対象金額の下限値 (x <=)'
4549
+ description: |-
4550
+ 対象金額の下限値 (x <=) を指定します。
4551
+ subject_more_than といずれかのみ指定できます。
4552
+ subject_less_than:
4553
+ type: integer
4554
+ minimum: 0
4555
+ title: '対象金額の上限値 (< x)'
4556
+ description: |-
4557
+ 対象金額の上限値 (< x) を指定します (ただし、指定された金額は含まない)。
4558
+ subject_less_than_or_equal といずれかのみ指定できます。
4559
+ subject_less_than_or_equal:
4560
+ type: integer
4561
+ minimum: 0
4562
+ title: '対象金額の上限値 (<= x)'
4563
+ description: |-
4564
+ 対象金額の上限値 (<= x) を指定します。
4565
+ subject_less_than といずれかのみ指定できます。
4566
+ example: |-
4567
+ {
4568
+ "point_amount": 5,
4569
+ "point_amount_unit": "percent",
4570
+ "subject_more_than_or_equal": 1000,
4571
+ "subject_less_than": 5000
4572
+ }
4573
+
4574
+ title: '取引金額ベースのポイント付与ルール'
4575
+ description: |-
4576
+ 金額をベースとしてポイント付与を行うルールを指定します。
4577
+ amount_based_point_rules と product_based_point_rules はどちらか一方しか指定できません。
4578
+ 各ルールは一つのみ適用され、条件に重複があった場合は先に記載されたものが優先されます。
4579
+
4580
+ 例:
4581
+ ```javascript
4582
+ [
4583
+ // 1000円以上、5000円未満の決済には 5%
4584
+ {
4585
+ "point_amount": 5,
4586
+ "point_amount_unit": "percent",
4587
+ "subject_more_than_or_equal": 1000,
4588
+ "subject_less_than": 5000
4589
+ },
4590
+ // 5000円以上の決済には 10%
4591
+ {
4592
+ "point_amount": 10,
4593
+ "point_amount_unit": "percent",
4594
+ "subject_more_than_or_equal": 5000
4595
+ },
4596
+ ]
4597
+ ```
4598
+
4599
+ product_based_point_rules:
4600
+ type: array
4601
+ items:
4602
+ type: object
4603
+ properties:
4604
+ point_amount:
4605
+ type: number
4606
+ format: decimal
4607
+ minimum: 0
4608
+ title: '付与ポイント量'
4609
+ description: |-
4610
+ キャンペーンにより付与するポイント量。単位は point_amount_unit で指定します。(必須項目)
4611
+
4612
+ point_amount_unitにより指定される単位が絶対額のときは小数点以下が切り捨てられ整数として扱われます。
4613
+ パーセント指定の時は小数を許容し、割合計算後に小数点以下が切り捨てられます。
4614
+ いずれの場合も実際に付与されるポイントは整数のみです。
4615
+ point_amount_unit:
4616
+ type: string
4617
+ enum: [percent, absolute]
4618
+ title: '付与ポイント量の単位'
4619
+ description: |-
4620
+ キャンペーンにより付与するポイント量の単位を指定します。(必須項目)
4621
+
4622
+ 以下のいずれかを指定できます。
4623
+
4624
+ 1. percent
4625
+ 付与するポイント量が元取引の取引額に応じて割合で変化するときに指定します。
4626
+
4627
+ 2. absolute
4628
+ 付与するポイント量が元取引の取引額に依存しない絶対額であるときに指定します。
4629
+ product_code:
4630
+ type: string
4631
+ maxLength: 64
4632
+ title: '対象の製品コード'
4633
+ description: |-
4634
+ 対象の製品コード (JANコードやISBNコードなど) を指定します。(必須項目)
4635
+
4636
+ SQLのLIKE文のようにワイルドカードを使った製品コードのパターンを指定することもできます (例: 978-% でISBNコード)
4637
+ items:
4638
+ type: string
4639
+ required_count:
4640
+ type: integer
4641
+ minimum: 1
4642
+ title: '必要購入個数'
4643
+ description: |-
4644
+ キャンペーン適用のための対象商品の必要購入個数を指定します (例:商品Aを2個以上購入するとn%ポイント)。
4645
+ デフォルト値は1です。
4646
+ is_multiply_by_count:
4647
+ type: boolean
4648
+ title: '複数個購入したときにポイント付与額に個数を掛けるかどうか'
4649
+ description: |-
4650
+ キャンペーン対象の商品を複数個購入したときに、個数に応じてポイント付与額を増やすかどうかのフラグです。
4651
+ デフォルト値は false です。
4652
+ starts_at:
4653
+ type: string
4654
+ format: date-time
4655
+ title: '商品個別のキャンペーン開始日時'
4656
+ description: |-
4657
+ このルールを適用する開始日時を指定します。
4658
+ デフォルトではキャンペーン全体の開始日時が指定されます。
4659
+ 商品個別にキャンペーン期間指定をする場合は、キャンペーン全体の期間指定の範囲内に入っている必要があります。
4660
+ ends_at:
4661
+ type: string
4662
+ format: date-time
4663
+ title: '商品個別のキャンペーン終了日時'
4664
+ description: |-
4665
+ このルールを適用する終了日時を指定します。
4666
+ デフォルトではキャンペーン全体の終了日時が指定されます。
4667
+ 商品個別にキャンペーン期間指定をする場合は、キャンペーン全体の期間指定の範囲内に入っている必要があります。
4668
+ example: |-
4669
+ {
4670
+ "point_amount": 5,
4671
+ "point_amount_unit": "percent",
4672
+ "product_code": "4912345678904",
4673
+ "is_multiply_by_count": true,
4674
+ "required_count": 2
4675
+ }
4676
+
4677
+ title: '商品情報ベースのポイント付与ルール'
4678
+ description: |-
4679
+ 商品情報をベースとしてポイント付与を行うルールを指定します。
4680
+ ルールは商品ごとに設定可能で、ルールの配列として指定します。
4681
+ amount_based_point_rules と product_based_point_rules はどちらか一方しか指定できません。
4682
+ event が payment か external-transaction の時のみ有効です。
4683
+ 各ルールの順序は問わず、適用可能なものは全て適用されます。
4684
+ 一つの決済の中で複数の商品がキャンペーン適用可能な場合はそれぞれの商品についてのルールが適用され、ポイント付与額はその合算になります。
4685
+
4686
+ 例:
4687
+ ```javascript
4688
+ [
4689
+ // 対象商品の購入額から5%ポイント付与。複数購入時は単価の5%が付与される。
4690
+ {
4691
+ "point_amount": 5,
4692
+ "point_amount_unit": "percent",
4693
+ "product_code": "4912345678904",
4694
+ },
4695
+ // 対象商品の購入額から5%ポイント付与。複数購入時は購入総額の5%が付与される。
4696
+ {
4697
+ "point_amount": 5,
4698
+ "point_amount_unit": "percent",
4699
+ "product_code": "4912345678904",
4700
+ "is_multiply_by_count": true,
4701
+ },
4702
+ // 対象商品を2つ以上購入したら500ポイント付与(固定額付与)
4703
+ {
4704
+ "point_amount": 500,
4705
+ "point_amount_unit": absolute",
4706
+ "product_code": "4912345678904",
4707
+ "required_count": 2
4708
+ },
4709
+ // 書籍は10%ポイント付与
4710
+ // ※ISBNの形式はレジがポケペイに送信する形式に準じます
4711
+ {
4712
+ "point_amount": 10,
4713
+ "point_amount_unit": "percent",
4714
+ "product_code": "978-%",
4715
+ },
4716
+ // 一部の出版社の書籍は10%ポイント付与
4717
+ {
4718
+ "point_amount": 10,
4719
+ "point_amount_unit": "percent",
4720
+ "product_code": "978-4-01-%", // 旺文社
4721
+ }
4722
+ ]
4723
+ ```
4724
+
4725
+ applicable_days_of_week:
4726
+ type: array
4727
+ items:
4728
+ type: integer
4729
+ minimun: 0
4730
+ maximum: 6
4731
+ title: 'キャンペーンを適用する曜日 (複数指定)'
4732
+ describe: |-
4733
+ キャンペーンを適用する曜日を指定します (複数指定)。
4734
+ 曜日は整数で表します。月曜を 0 とし、日曜を 6 とします。
4735
+ 指定しなかった場合は全日を対象にします (曜日による適用条件なし)
4736
+ applicable_time_ranges:
4737
+ type: array
4738
+ items:
4739
+ type: object
4740
+ properties:
4741
+ from:
4742
+ type: string
4743
+ description: |-
4744
+ 時間帯の開始時刻 (HH:mmの形式)
4745
+ to:
4746
+ type: string
4747
+ description: |-
4748
+ 時間帯の終了時刻 (HH:mmの形式)
4749
+ example: |-
4750
+ {
4751
+ "from": "12:00",
4752
+ "to": "23:59"
4753
+ }
4754
+
4755
+ title: 'キャンペーンを適用する時間帯 (複数指定)'
4756
+ describe: |-
4757
+ キャンペーンを適用する時間帯を指定します (複数指定可)。
4758
+ 時間帯はfromとtoからなるオブジェクトで指定します。
4759
+ fromとtoは両方必要です。
4760
+ applicable_shop_ids:
4761
+ type: array
4762
+ items:
4763
+ type: string
4764
+ format: uuid
4765
+ title: 'キャンペーン適用対象となる店舗IDのリスト'
4766
+ describe: |-
4767
+ キャンペーンを適用する店舗IDを指定します (複数指定)。
4768
+ 指定しなかった場合は全店舗が対象になります。
4769
+ responses:
4770
+ '200':
4771
+ description: OK
4772
+ content:
4773
+ application/json:
4774
+ schema:
4775
+ $ref: '#/components/schemas/Campaign'
4776
+ '400':
4777
+ $ref: '#/components/responses/BadRequest'
4778
+ '403':
4779
+ $ref: '#/components/responses/Forbidden'
4780
+ '422':
4781
+ $ref: '#/components/responses/UnprocessableEntity'