@cinerino/sdk 16.3.0-alpha.7 → 16.3.0-alpha.9

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.
@@ -1,15 +1,20 @@
1
1
  import { factory } from '../factory';
2
- import { ISearchResult, IUnset, Service } from '../service';
3
- export type IEmailMessage = Omit<factory.creativeWork.message.email.ICreativeWork, 'toRecipient'>;
2
+ import { IUnset, Service } from '../service';
3
+ export type IEmailMessage = Pick<factory.creativeWork.message.email.ICreativeWork, 'about' | 'identifier' | 'name' | 'project' | 'sender' | 'text' | 'typeOf'> & {
4
+ id: string;
5
+ };
4
6
  export interface ISearchConditions {
5
7
  limit?: number;
6
8
  page?: number;
9
+ id?: {
10
+ $eq?: string;
11
+ };
7
12
  identifier?: {
8
13
  $eq?: string;
9
14
  };
10
15
  about?: {
11
16
  identifier?: {
12
- $eq?: factory.creativeWork.message.email.AboutIdentifier;
17
+ $eq?: factory.creativeWork.message.email.AboutIdentifier.OnEventStatusChanged;
13
18
  };
14
19
  };
15
20
  }
@@ -20,25 +25,19 @@ export declare class EmailMessageService extends Service {
20
25
  /**
21
26
  * 作成
22
27
  */
23
- create(params: IEmailMessage): Promise<{
28
+ create(params: Omit<IEmailMessage, 'id' | 'project'>): Promise<{
24
29
  id: string;
25
30
  }>;
26
- /**
27
- * 取得
28
- */
29
- findById(params: {
30
- id: string;
31
- }): Promise<IEmailMessage>;
32
31
  /**
33
32
  * 検索
34
33
  */
35
- search(params: ISearchConditions): Promise<ISearchResult<IEmailMessage[]>>;
34
+ findEmailMessages(params: ISearchConditions): Promise<IEmailMessage[]>;
36
35
  /**
37
36
  * 編集
38
37
  */
39
38
  update(params: {
40
39
  id: string;
41
- attributes: IEmailMessage & IUnset;
40
+ attributes: Omit<IEmailMessage, 'id' | 'project'> & IUnset;
42
41
  }): Promise<void>;
43
42
  /**
44
43
  * 削除
@@ -19,33 +19,17 @@ class EmailMessageService extends service_1.Service {
19
19
  })
20
20
  .then(async (response) => response.json());
21
21
  }
22
- /**
23
- * 取得
24
- */
25
- async findById(params) {
26
- return this.fetch({
27
- uri: `/emailMessages/${params.id}`,
28
- method: 'GET',
29
- // qs: params,
30
- expectedStatusCodes: [http_status_1.status.OK]
31
- })
32
- .then(async (response) => response.json());
33
- }
34
22
  /**
35
23
  * 検索
36
24
  */
37
- async search(params) {
25
+ async findEmailMessages(params) {
38
26
  return this.fetch({
39
27
  uri: '/emailMessages',
40
28
  method: 'GET',
41
29
  qs: params,
42
30
  expectedStatusCodes: [http_status_1.status.OK]
43
31
  })
44
- .then(async (response) => {
45
- return {
46
- data: await response.json()
47
- };
48
- });
32
+ .then(async (response) => response.json());
49
33
  }
50
34
  /**
51
35
  * 編集
@@ -70,8 +70,16 @@ export type IEmailCustomization = Pick<factory.creativeWork.message.email.ICusto
70
70
  about?: string;
71
71
  /**
72
72
  * 本文テンプレート
73
- * 本文をカスタマイズしたい場合、PUGテンプレートを指定
74
- * {@link https://pugjs.org/api/getting-started.html}
73
+ * メール本文をカスタマイズしたい場合、PUGテンプレートを指定
74
+ * 挿入変数として以下を使用できます
75
+ * - order.customer.familyName
76
+ * - order.customer.givenName
77
+ * - order.confirmationNumber
78
+ * - order.orderNumber
79
+ * - order.price
80
+ * - order.seller.name
81
+ *
82
+ * 参考 -> https://pugjs.org/api/getting-started.html
75
83
  */
76
84
  template?: string;
77
85
  /**
@@ -34,10 +34,7 @@ export declare class PlaceOrderTransactionService extends Service {
34
34
  */
35
35
  sendEmailMessage?: boolean;
36
36
  /**
37
- * 注文配送メールカスタマイズ
38
- * メール本文をカスタマイズしたい場合、PUGテンプレートを指定
39
- * 挿入変数として`order`を使用できます
40
- * 参考 -> https://pugjs.org/api/getting-started.html
37
+ * 注文配送メール指定
41
38
  */
42
39
  email?: IEmailCustomization;
43
40
  /**
@@ -14,3 +14,89 @@ export interface IStartParams {
14
14
  reason?: factory.transaction.returnOrder.Reason;
15
15
  };
16
16
  }
17
+ /**
18
+ * 返品取引確定時のEメール指定
19
+ */
20
+ export type IEmailCustomization = Pick<factory.creativeWork.message.email.ICustomization, 'text'> & {
21
+ /**
22
+ * 件名
23
+ */
24
+ about?: string;
25
+ /**
26
+ * 本文テンプレート
27
+ * メール本文をカスタマイズしたい場合、PUGテンプレートを指定
28
+ * 挿入変数として以下を使用できます
29
+ * - order.customer.familyName
30
+ * - order.customer.givenName
31
+ * - order.confirmationNumber
32
+ * - order.orderNumber
33
+ * - order.price
34
+ * - order.seller.name
35
+ *
36
+ * 参考 -> https://pugjs.org/api/getting-started.html
37
+ */
38
+ template?: string;
39
+ /**
40
+ * 受信者
41
+ */
42
+ toRecipient?: factory.creativeWork.message.email.ICustomizedParticipant;
43
+ /**
44
+ * 送信者
45
+ */
46
+ sender?: Pick<factory.creativeWork.message.email.ICustomizedParticipant, 'name'>;
47
+ };
48
+ /**
49
+ * Eメール送信パラメータ
50
+ */
51
+ export interface ISendEmailMessageParams {
52
+ /**
53
+ * Eメールカスタマイズ
54
+ * メール本文をカスタマイズしたい場合、PUGテンプレートを指定
55
+ * 挿入変数として`order`を使用できます
56
+ * {@link https://pugjs.org/api/getting-started.html}
57
+ */
58
+ object?: IEmailCustomization;
59
+ }
60
+ export interface IRefundParams {
61
+ object: {
62
+ object: {
63
+ paymentMethod: {
64
+ /**
65
+ * 返金対象決済方法ID
66
+ */
67
+ paymentMethodId: string;
68
+ };
69
+ }[];
70
+ };
71
+ potentialActions?: {
72
+ /**
73
+ * 返金メールカスタマイズ
74
+ */
75
+ sendEmailMessage?: ISendEmailMessageParams;
76
+ };
77
+ }
78
+ export interface IPotentialActionsParams {
79
+ /**
80
+ * 注文返品アクション
81
+ */
82
+ returnOrder?: {
83
+ /**
84
+ * 注文返品後アクション
85
+ */
86
+ potentialActions?: {
87
+ /**
88
+ * 返金アクションについてカスタマイズする場合に指定
89
+ * 属性名称がrefundCreditCardであるが、全ての決済方法に適用可能
90
+ */
91
+ refundCreditCard?: IRefundParams[];
92
+ /**
93
+ * 返品時Eメール送信アクション
94
+ * 最大1つ指定
95
+ */
96
+ sendEmailMessage?: [ISendEmailMessageParams];
97
+ };
98
+ };
99
+ }
100
+ export type IConfirmParams = Pick<factory.transaction.returnOrder.IConfirmParams, 'id'> & {
101
+ potentialActions?: IPotentialActionsParams;
102
+ };
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
@@ -1,7 +1,7 @@
1
1
  import { factory } from '../../factory';
2
2
  import { Service } from '../../service';
3
3
  import { ISetProfileParams } from '../transaction';
4
- import { IStartParams } from '../transaction/returnOrder/factory';
4
+ import { IStartParams, IConfirmParams } from '../transaction/returnOrder/factory';
5
5
  /**
6
6
  * 返品取引サービス
7
7
  */
@@ -22,5 +22,5 @@ export declare class ReturnOrderTransactionService extends Service {
22
22
  /**
23
23
  * 取引確定
24
24
  */
25
- confirm(params: factory.transaction.returnOrder.IConfirmParams): Promise<void>;
25
+ confirm(params: IConfirmParams): Promise<void>;
26
26
  }
@@ -1,13 +1,10 @@
1
- import type { IStartParams } from '../../../chevreTxn/transaction/returnOrder/factory';
1
+ import type { IStartParams, IConfirmParams } from '../../../chevreTxn/transaction/returnOrder/factory';
2
2
  import { factory } from '../../../factory';
3
3
  import { Service } from '../../../service';
4
4
  /**
5
5
  * 返品取引サービス
6
6
  */
7
7
  export declare class ReturnOrderTransactionService extends Service {
8
- /**
9
- * 取引を開始する
10
- */
11
8
  start(params: IStartParams): Promise<Pick<factory.transaction.ITransaction<factory.transactionType.ReturnOrder>, 'expires' | 'id' | 'project' | 'startDate' | 'status' | 'typeOf'>>;
12
9
  /**
13
10
  * 返品取引を開始可能かどうか検証する
@@ -16,5 +13,5 @@ export declare class ReturnOrderTransactionService extends Service {
16
13
  /**
17
14
  * 取引確定
18
15
  */
19
- confirm(params: factory.transaction.returnOrder.IConfirmParams): Promise<void>;
16
+ confirm(params: IConfirmParams): Promise<void>;
20
17
  }
@@ -1,22 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReturnOrderTransactionService = void 0;
4
- // import { IAdditionalOptions, IOptions, Service } from '../../../service';
5
4
  const index_1 = require("../../../index");
6
5
  const service_1 = require("../../../service");
7
6
  /**
8
7
  * 返品取引サービス
9
8
  */
10
9
  class ReturnOrderTransactionService extends service_1.Service {
11
- // constructor(options: Pick<
12
- // IOptions,
13
- // 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath' | 'retryableStatusCodes'
14
- // > & IAdditionalOptions) {
15
- // super(options);
16
- // }
17
- /**
18
- * 取引を開始する
19
- */
20
10
  async start(params) {
21
11
  const { agent, object } = params;
22
12
  const { auth, endpoint, project, seller, retryableStatusCodes } = this.options;
@@ -29,13 +19,6 @@ class ReturnOrderTransactionService extends service_1.Service {
29
19
  ]
30
20
  });
31
21
  return returnOrderService.start({ agent, object });
32
- // return this.fetch({
33
- // uri: `/transactions/${this.typeOf}/start`,
34
- // method: 'POST',
35
- // body: params,
36
- // expectedStatusCodes: [status.OK]
37
- // })
38
- // .then(async (response) => response.json());
39
22
  }
40
23
  /**
41
24
  * 返品取引を開始可能かどうか検証する
@@ -52,13 +35,6 @@ class ReturnOrderTransactionService extends service_1.Service {
52
35
  ]
53
36
  });
54
37
  await returnOrderService.verifyReturnPolicy({ object });
55
- // await this.fetch({
56
- // uri: `/transactions/${this.typeOf}/start`,
57
- // method: 'POST',
58
- // body: params,
59
- // qs: { justVerify: true },
60
- // expectedStatusCodes: [NO_CONTENT, OK]
61
- // });
62
38
  }
63
39
  /**
64
40
  * 取引確定
@@ -75,12 +51,6 @@ class ReturnOrderTransactionService extends service_1.Service {
75
51
  ]
76
52
  });
77
53
  await returnOrderService.confirm({ id, potentialActions });
78
- // await this.fetch({
79
- // uri: `/transactions/${this.typeOf}/${params.id}/confirm`,
80
- // method: 'PUT',
81
- // body: params,
82
- // expectedStatusCodes: [status.NO_CONTENT]
83
- // });
84
54
  }
85
55
  }
86
56
  exports.ReturnOrderTransactionService = ReturnOrderTransactionService;