@cinerino/sdk 3.160.0 → 3.161.0

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 (111) hide show
  1. package/example/playground/public/lib/bundle.js +183 -170
  2. package/example/src/authorizeOrder.ts +2 -1
  3. package/example/src/cancelReservations.ts +2 -1
  4. package/example/src/chevre/assetTransaction/processReserve.ts +4 -3
  5. package/example/src/chevre/authorizeOrder.ts +2 -1
  6. package/example/src/chevre/createEvents.ts +2 -1
  7. package/example/src/chevre/createOrder.ts +2 -1
  8. package/example/src/chevre/findOrderByConfirmationNumber.ts +2 -1
  9. package/example/src/chevre/searchAcceptedOffersByConfirmationNumber.ts +2 -1
  10. package/example/src/chevre/searchEventOffers.ts +2 -1
  11. package/example/src/chevre/searchEvents.ts +2 -1
  12. package/example/src/chevre/searchReservations.ts +2 -1
  13. package/example/src/chevre/updateOrder.ts +2 -1
  14. package/example/src/createCommentOnOrder.ts +2 -1
  15. package/example/src/createEvents.ts +2 -1
  16. package/example/src/findOrderByConfirmationNumber.ts +2 -1
  17. package/example/src/getMembershipOwnershipCode.ts +4 -2
  18. package/example/src/openAccountByToken.ts +2 -1
  19. package/example/src/person/manageReservationToken.ts +4 -2
  20. package/example/src/searchOffers.ts +2 -1
  21. package/example/src/searchOrderAcceptedOffers.ts +2 -1
  22. package/example/src/searchOrders.ts +2 -1
  23. package/example/src/searchPaymentServices.ts +3 -28
  24. package/example/src/searchPaymentServicesOnMovieTicketIF.ts +2 -1
  25. package/example/src/searchProducts.ts +2 -1
  26. package/example/src/searchProjects.ts +29 -0
  27. package/example/src/searchSellers.ts +30 -0
  28. package/example/src/transaction/checkPaymentCard.ts +2 -1
  29. package/example/src/transaction/processMoneyTransfer.ts +4 -2
  30. package/example/src/transaction/processMoneyTransferFromOrder.ts +2 -1
  31. package/example/src/transaction/processOrderMoneyTransferByCash.ts +6 -3
  32. package/example/src/transaction/processOrderMoneyTransferByCreditCard.ts +6 -3
  33. package/example/src/transaction/processPlaceOrderByAnonymousCreditCardAndMembership.ts +6 -3
  34. package/example/src/transaction/processPlaceOrderByAnonymousCreditCardAndMyMembership.ts +9 -5
  35. package/example/src/transaction/processPlaceOrderByCash.ts +12 -6
  36. package/example/src/transaction/processPlaceOrderByMovieTicket.ts +6 -3
  37. package/example/src/transaction/processPlaceOrderByNewMembershipCoupon4COA.ts +6 -3
  38. package/example/src/transaction/processPlaceOrderByPaymentCard.ts +6 -3
  39. package/example/src/transaction/processPublishPaymentUrl.ts +6 -3
  40. package/example/src/transaction/processReturnOrder.ts +2 -1
  41. package/example/src/transaction/searchEventOffers.ts +4 -2
  42. package/example/src/transaction/test/lockTransactionTest.ts +2 -1
  43. package/example/src/updateOrder.ts +2 -1
  44. package/lib/abstract/chevre/account.d.ts +2 -2
  45. package/lib/abstract/chevre/accountTitle.d.ts +2 -2
  46. package/lib/abstract/chevre/accountTransaction.d.ts +2 -2
  47. package/lib/abstract/chevre/action.d.ts +2 -2
  48. package/lib/abstract/chevre/additionalProperty.d.ts +2 -2
  49. package/lib/abstract/chevre/aggregation.d.ts +1 -1
  50. package/lib/abstract/chevre/assetTransaction/cancelReservation.d.ts +2 -2
  51. package/lib/abstract/chevre/assetTransaction/moneyTransfer.d.ts +2 -2
  52. package/lib/abstract/chevre/assetTransaction/pay.d.ts +2 -2
  53. package/lib/abstract/chevre/assetTransaction/refund.d.ts +2 -2
  54. package/lib/abstract/chevre/assetTransaction/registerService.d.ts +2 -2
  55. package/lib/abstract/chevre/assetTransaction/reserve.d.ts +2 -2
  56. package/lib/abstract/chevre/assetTransaction.d.ts +2 -2
  57. package/lib/abstract/chevre/authorization.d.ts +2 -2
  58. package/lib/abstract/chevre/award.d.ts +2 -2
  59. package/lib/abstract/chevre/categoryCode.d.ts +2 -2
  60. package/lib/abstract/chevre/comment.d.ts +2 -2
  61. package/lib/abstract/chevre/creativeWork.d.ts +2 -2
  62. package/lib/abstract/chevre/customer.d.ts +2 -2
  63. package/lib/abstract/chevre/emailMessage.d.ts +2 -2
  64. package/lib/abstract/chevre/event.d.ts +2 -2
  65. package/lib/abstract/chevre/holdReservation.d.ts +2 -2
  66. package/lib/abstract/chevre/iam.d.ts +2 -2
  67. package/lib/abstract/chevre/me.d.ts +1 -1
  68. package/lib/abstract/chevre/merchantReturnPolicy.d.ts +2 -2
  69. package/lib/abstract/chevre/offer.d.ts +2 -2
  70. package/lib/abstract/chevre/offerCatalog.d.ts +2 -2
  71. package/lib/abstract/chevre/offerItemCondition.d.ts +2 -2
  72. package/lib/abstract/chevre/order.d.ts +3 -3
  73. package/lib/abstract/chevre/payment.d.ts +2 -2
  74. package/lib/abstract/chevre/permit.d.ts +2 -2
  75. package/lib/abstract/chevre/person/ownershipInfo.d.ts +2 -2
  76. package/lib/abstract/chevre/person.d.ts +2 -2
  77. package/lib/abstract/chevre/place.d.ts +2 -2
  78. package/lib/abstract/chevre/priceSpecification.d.ts +2 -2
  79. package/lib/abstract/chevre/product.d.ts +2 -2
  80. package/lib/abstract/chevre/project.d.ts +1 -1
  81. package/lib/abstract/chevre/reservation.d.ts +1 -4
  82. package/lib/abstract/chevre/reservation.js +0 -14
  83. package/lib/abstract/chevre/seller.d.ts +2 -2
  84. package/lib/abstract/chevre/task.d.ts +2 -2
  85. package/lib/abstract/chevre/token.d.ts +2 -2
  86. package/lib/abstract/chevre/transaction/moneyTransfer.d.ts +2 -2
  87. package/lib/abstract/chevre/transaction/placeOrder.d.ts +2 -2
  88. package/lib/abstract/chevre/transaction/returnOrder.d.ts +2 -2
  89. package/lib/abstract/chevre/transactionNumber.d.ts +2 -2
  90. package/lib/abstract/chevre/trip.d.ts +2 -2
  91. package/lib/abstract/chevre/userPool.d.ts +2 -2
  92. package/lib/abstract/index.d.ts +0 -3
  93. package/lib/abstract/index.js +0 -4
  94. package/lib/abstract/pecorino/accountTransaction.d.ts +1 -1
  95. package/lib/abstract/pecorino/permit.d.ts +1 -1
  96. package/lib/abstract/service/order.d.ts +1 -1
  97. package/lib/abstract/service/person/ownershipInfo.d.ts +2 -2
  98. package/lib/abstract/service/person.d.ts +2 -2
  99. package/lib/abstract/service/project.d.ts +1 -1
  100. package/lib/abstract/service/reservation.d.ts +1 -1
  101. package/lib/abstract/service/seller.d.ts +2 -2
  102. package/lib/abstract/service/transaction/placeOrder4sskts.d.ts +0 -2
  103. package/lib/abstract/service/transaction/placeOrder4sskts.js +5 -2
  104. package/lib/abstract/service.d.ts +7 -3
  105. package/lib/bundle.js +165 -172
  106. package/package.json +2 -2
  107. package/example/src/chevre/publishTransactionNumber.ts +0 -30
  108. package/example/src/chevre/searchCreditCards.ts +0 -33
  109. package/example/src/searchScreeningRooms.ts +0 -32
  110. package/example/src/transaction/processOrderMembershipByCreditCard.ts +0 -220
  111. package/example/src/transaction/test/rateLimitTransactionTest.ts +0 -70
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "3.160.0",
3
+ "version": "3.161.0",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -97,7 +97,7 @@
97
97
  "watchify": "^3.11.1"
98
98
  },
99
99
  "dependencies": {
100
- "@chevre/factory": "4.315.0",
100
+ "@chevre/factory": "4.316.0-alpha.3",
101
101
  "debug": "^3.2.6",
102
102
  "http-status": "^1.4.2",
103
103
  "idtoken-verifier": "^2.0.3",
@@ -1,30 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
- import * as client from '../../../lib/';
3
-
4
- const project = { id: 'cinerino' };
5
-
6
- async function main() {
7
- const authClient = new client.auth.ClientCredentials({
8
- domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
9
- clientId: <string>process.env.CHEVRE_CLIENT_ID,
10
- clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
11
- scopes: [],
12
- state: ''
13
- });
14
- const transactionNumberService = new client.chevre.service.TransactionNumber({
15
- endpoint: <string>process.env.CHEVRE_ENDPOINT,
16
- auth: authClient,
17
- project
18
- });
19
-
20
- const result = await transactionNumberService.publish({
21
- project: { id: 'cinerino' }
22
- });
23
- console.log(result);
24
- }
25
-
26
- main()
27
- .then(() => {
28
- console.log('main processed.');
29
- })
30
- .catch(console.error);
@@ -1,33 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
- import * as client from '../../../lib/';
3
-
4
- const project = { id: String(process.env.PROJECT_ID) };
5
-
6
- async function main() {
7
- const authClient = new client.auth.ClientCredentials({
8
- domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
9
- clientId: <string>process.env.CHEVRE_CLIENT_ID,
10
- clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
11
- scopes: [],
12
- state: ''
13
- });
14
-
15
- const personOwnershipInfoService = new client.chevre.service.person.OwnershipInfo({
16
- endpoint: <string>process.env.CHEVRE_ENDPOINT,
17
- auth: authClient,
18
- project
19
- });
20
-
21
- const data = await personOwnershipInfoService.searchCreditCards({
22
- iss: '',
23
- id: '708b007c-79e2-4a3f-8f7a-4bcfc56f4583'
24
- });
25
- console.log(data);
26
- console.log(data.length);
27
- }
28
-
29
- main()
30
- .then(() => {
31
- console.log('main processed.');
32
- })
33
- .catch(console.error);
@@ -1,32 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import * as client from '../../lib/index';
3
-
4
- async function main() {
5
- const authClient = new client.auth.ClientCredentials({
6
- domain: <string>process.env.TEST_AUTHORIZE_SERVER_DOMAIN,
7
- clientId: <string>process.env.TEST_CLIENT_ID,
8
- clientSecret: <string>process.env.TEST_CLIENT_SECRET,
9
- scopes: [],
10
- state: ''
11
- });
12
-
13
- const placeService = new client.service.Place({
14
- endpoint: <string>process.env.API_ENDPOINT,
15
- auth: authClient,
16
- project: { id: 'cinerino' }
17
- });
18
-
19
- const { data } = await placeService.searchScreeningRooms({
20
- containedInPlace: {
21
- branchCode: { $eq: '001' }
22
- }
23
- });
24
- console.log(data);
25
- console.log(data.length, 'places returned');
26
- }
27
-
28
- main()
29
- .then(() => {
30
- console.log('success!');
31
- })
32
- .catch(console.error);
@@ -1,220 +0,0 @@
1
- // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
- import * as moment from 'moment';
3
- import * as client from '../../../lib/index';
4
- // import { auth } from '../auth/clientCredentials';
5
- import * as auth from '../auth/auth';
6
-
7
- const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- const profile = {
10
- email: <string>process.env.TEST_PROFILE_EMAIL,
11
- givenName: 'Taro',
12
- familyName: 'SDK',
13
- name: 'Taro ☆ SDK',
14
- telephone: '+819012345678'
15
- };
16
-
17
- // 取引に使用するクレジットカード
18
- const creditCard = {
19
- cardNo: '4111111111111111',
20
- expire: '2412',
21
- holderName: 'AA BB'
22
- };
23
-
24
- // ポイント特典付与口座
25
- const pointAwardToLocation = {
26
- accountNumber: '139458017738823',
27
- issuedThrough: { id: 'xxx' }
28
- };
29
-
30
- // tslint:disable-next-line:max-func-body-length
31
- async function main() {
32
- const authClient = await auth.login();
33
- await authClient.refreshAccessToken();
34
- const loginTicket = authClient.verifyIdToken({});
35
- console.log('username is', loginTicket.getUsername());
36
-
37
- const offerService = new client.service.Offer({
38
- endpoint: <string>process.env.API_ENDPOINT,
39
- auth: authClient,
40
- project
41
- });
42
- const sellerService = new client.service.Seller({
43
- endpoint: <string>process.env.API_ENDPOINT,
44
- auth: authClient,
45
- project
46
- });
47
- const placeOrderService = new client.service.txn.PlaceOrder({
48
- endpoint: <string>process.env.API_ENDPOINT,
49
- auth: authClient,
50
- project
51
- });
52
- const paymentService = new client.service.Payment({
53
- endpoint: <string>process.env.API_ENDPOINT,
54
- auth: authClient,
55
- project
56
- });
57
-
58
- const productService = new client.service.Product({
59
- endpoint: <string>process.env.API_ENDPOINT,
60
- auth: authClient,
61
- project
62
- });
63
-
64
- // const personService = new client.service.Person({
65
- // endpoint: <string>process.env.API_ENDPOINT,
66
- // auth: authClient,
67
- // project
68
- // });
69
-
70
- // console.log('finding profile...');
71
- // const profile = await personService.getProfile({});
72
- // console.log('profile found');
73
-
74
- // 販売者検索
75
- const searchSellersResult = await sellerService.search({});
76
- // tslint:disable-next-line:insecure-random
77
- const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
78
- if (seller === undefined) {
79
- throw new Error('No seller');
80
- }
81
- console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
82
-
83
- // メンバーシップ検索
84
- const { data } = await productService.search({
85
- typeOf: { $eq: client.factory.product.ProductType.MembershipService }
86
- });
87
- if (data.length === 0) {
88
- throw new Error('no membership products');
89
- }
90
- const product = <client.factory.product.IProduct>data.shift();
91
- console.log('ordering product...', (<client.factory.multilingualString>product.name).ja);
92
-
93
- // オファー検索
94
- const availableOffers = await productService.searchOffers({
95
- itemOffered: { id: String(product.id) },
96
- seller: { id: String(seller.id) }
97
- });
98
- console.log(availableOffers.length, 'offers available');
99
- if (availableOffers.length === 0) {
100
- throw new Error('no available offers');
101
- }
102
- const acceptedOffer = availableOffers[0];
103
- console.log(
104
- 'offer selected',
105
- (<client.factory.multilingualString>acceptedOffer.name).ja,
106
- acceptedOffer.priceSpecification.priceComponent[0].price
107
- );
108
-
109
- console.log('starting transaction...');
110
- const transaction = await placeOrderService.start({
111
- expires: moment()
112
- .add(30, 'seconds')
113
- .toDate(),
114
- seller: { typeOf: seller.typeOf, id: String(seller.id) },
115
- object: {
116
- // passport: { token: passportToken }
117
- }
118
- });
119
- console.log('transaction started', transaction.id);
120
-
121
- // 電話番号下4桁
122
- const accessCode = profile.telephone.slice(-4);
123
-
124
- const productOfferAuthorization = await offerService.authorizeProduct({
125
- object: [{
126
- // project: product.project,
127
- typeOf: client.factory.offerType.Offer,
128
- id: String(acceptedOffer.id),
129
- itemOffered: {
130
- // project: product.project,
131
- // typeOf: product.typeOf,
132
- id: product.id,
133
- serviceOutput: {
134
- project: product.project,
135
- typeOf: client.factory.permit.PermitType.Permit,
136
- accessCode
137
- // name: product.name.ja
138
- // additionalProperty: [{ name: 'sampleName', value: 'sampleValue' }]
139
- },
140
- // ポイント特典付与先を指定
141
- pointAward: {
142
- // typeOf: client.factory.actionType.MoneyTransfer,
143
- toLocation: { identifier: pointAwardToLocation.accountNumber, issuedThrough: pointAwardToLocation.issuedThrough },
144
- recipient: {
145
- id: transaction.agent.id,
146
- name: `${profile.givenName} ${profile.familyName}`,
147
- typeOf: transaction.agent.typeOf
148
- }
149
- }
150
- }
151
- // priceCurrency: client.factory.priceCurrency.JPY,
152
- // seller: { typeOf: seller.typeOf, id: seller.id, project: seller.project }
153
- }],
154
- purpose: { typeOf: transaction.typeOf, id: transaction.id }
155
- });
156
- console.log('product offer authorized. id:', productOfferAuthorization.id);
157
-
158
- // クレジットカード決済承認
159
- console.log('authorizing credit card payment...');
160
- const amount = acceptedOffer.priceSpecification.priceComponent[0].price;
161
- const creditCardPaymentAuth = await paymentService.authorizeCreditCard({
162
- object: {
163
- typeOf: client.factory.action.authorize.paymentMethod.any.ResultType.Payment,
164
- paymentMethod: 'CreditCard',
165
- amount,
166
- method: '1',
167
- creditCard: creditCard,
168
- issuedThrough: { id: 'xxx' }
169
- },
170
- purpose: { typeOf: transaction.typeOf, id: transaction.id }
171
- });
172
- console.log('credit card payment authorized', creditCardPaymentAuth.id);
173
-
174
- await wait(5000);
175
-
176
- console.log('setting customer profile...');
177
- await placeOrderService.setProfile({
178
- id: transaction.id,
179
- agent: profile
180
- });
181
- console.log('customer profile set');
182
-
183
- await wait(5000);
184
-
185
- console.log('confirming transaction...');
186
- const email = {
187
- sender: {
188
- name: `♥ ${(<client.factory.multilingualString>seller.name).ja} ♥`
189
- },
190
- about: `♥♥♥ ${profile.givenName}さんへメンバーシップ発行のお知らせ ♥♥♥`
191
- };
192
-
193
- const confirmResult = await placeOrderService.confirm({
194
- id: transaction.id,
195
- potentialActions: {
196
- order: {
197
- potentialActions: {
198
- sendOrder: {
199
- potentialActions: {
200
- sendEmailMessage: [
201
- { object: email }
202
- ]
203
- }
204
- }
205
- }
206
- }
207
- }
208
- });
209
- console.log('transaction confirmed', confirmResult.order.orderNumber);
210
- }
211
-
212
- async function wait(waitInMilliseconds: number) {
213
- return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
214
- }
215
-
216
- main()
217
- .then(() => {
218
- console.log('success!');
219
- })
220
- .catch(console.error);
@@ -1,70 +0,0 @@
1
- // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
- import * as moment from 'moment';
3
- import * as client from '../../../../lib/index';
4
- import { auth as authClient } from '../../auth/clientCredentials';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- const profile = {
9
- email: <string>process.env.TEST_PROFILE_EMAIL,
10
- givenName: 'Taro',
11
- familyName: 'SDK',
12
- name: 'Taro ☆ SDK',
13
- telephone: '+819012345678'
14
- };
15
-
16
- async function main() {
17
- const sellerService = new client.service.Seller({
18
- endpoint: <string>process.env.API_ENDPOINT,
19
- auth: authClient,
20
- project
21
- });
22
- const placeOrderService = new client.service.txn.PlaceOrder({
23
- endpoint: <string>process.env.API_ENDPOINT,
24
- auth: authClient,
25
- project
26
- });
27
-
28
- const searchSellersResult = await sellerService.search({});
29
- // tslint:disable-next-line:insecure-random
30
- const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
31
- if (seller === undefined) {
32
- throw new Error('No seller');
33
- }
34
- console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
35
-
36
- console.log('starting transaction...');
37
- const transaction = await placeOrderService.start({
38
- expires: moment()
39
- .add(1, 'minutes')
40
- .toDate(),
41
- seller: {
42
- typeOf: seller.typeOf,
43
- id: String(seller.id)
44
- },
45
- object: {}
46
- });
47
- console.log('transaction started', transaction.id);
48
-
49
- let i = 0;
50
- setInterval(
51
- async () => {
52
- i += 1;
53
- try {
54
- console.log('setting customer profile...');
55
- await placeOrderService.setProfile({ id: transaction.id, agent: profile });
56
- console.log('customer profile set', i);
57
- } catch (error) {
58
- console.error(error, i);
59
- }
60
- },
61
- // tslint:disable-next-line:no-magic-numbers
62
- 500
63
- );
64
- }
65
-
66
- main()
67
- .then(() => {
68
- console.log('success!');
69
- })
70
- .catch(console.error);