

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon Connect Customer Profiles 中，標準訂單的物件類型映射
<a name="object-type-mapping-standard-order"></a>

本節中的主題提供標準訂單定義，以及從外部應用程式到標準訂單的物件類型對應。

**Topics**
+ [Amazon AppIntegrations 存取要求](standard-order-appintegrations-requirements.md)
+ [Amazon EventBridge 存取要求](standard-order-eventbridge-requirements.md)
+ [標準訂單定義](standard-order-definition.md)
+ [對應 Shopify 物件](mapping-shopify-objects-standard-order.html.md)

# Amazon AppIntegrations 存取要求
<a name="standard-order-appintegrations-requirements"></a>

使用以下 Amazon AppIntegrations 存取要求，來建立和刪除 Shopify 與 Amazon Connect Customer Profiles 的整合：
+ app-integrations:GetEventIntegration
+ app-integrations:ListEventIntegrationAssociations
+ app-integrations:CreateEventIntegrationAssociation
+ app-integrations:DeleteEventIntegrationAssociation

# Amazon EventBridge 存取要求
<a name="standard-order-eventbridge-requirements"></a>

使用以下 Amazon EventBridge 存取要求，來建立和刪除 Shopify 與 Amazon Connect Customer Profiles 的整合：
+ `events:ListTargetsByRule`
+ `events:PutRule`
+ `events:PutTargets`
+ `events:DeleteRule`
+ `events:RemoveTargets`

# Customer Profiles 標準訂單物件欄位
<a name="standard-order-definition"></a>

下表列出 Customer Profiles 標準訂單物件中的所有欄位。


| 標準訂單欄位 | 資料類型 | Description | 
| --- | --- | --- | 
| OrderId | String | 標準訂單的唯一識別符。 | 
| CustomerEmail | String | 客戶的電子郵件地址。 | 
| CustomerPhone | String | 客戶的電話號碼。 | 
| CreatedDate | String | 訂單建立日期。 | 
| UpdatedDate | String | 訂單更新日期。 | 
| ProcessedDate | String | 訂單處理日期。 | 
| ClosedDate | String | 訂單關閉日期。 | 
| CancelledDate | String | 訂單取消日期。 | 
| CancelReason | String | 訂單取消原因。 | 
| Name | String | 訂單名稱。 | 
| AdditionalInformation | String | 與訂單有關的任何其他資訊。 | 
| 閘道 | String | 訂單的付款方式。 | 
| 狀態 | String | 訂單狀態。 | 
| StatusCode | String | 訂單的狀態代碼。有效值：DRAFT \$1 ACTIVATED | 
| StatusUrl | String | 訂單的狀態 URL。 | 
| CreditCardNumber | String | 客戶的信用卡末四碼。 | 
| CreditCardCompany | String | 客戶的信用卡公司。 | 
| FulfillmentStatus | String | 訂單履行狀態。 | 
| TotalPrice | String | 訂單總額。 | 
| TotalTax | String | 訂單總稅額。 | 
| TotalDiscounts | String | 訂單總折扣。 | 
| TotalItemsPrice | String | 訂單總項目額。 | 
| TotalShippingPrice | String | 訂單總運費。 | 
| TotalTipReceived | String | 訂單收到的小費總額。 | 
| Currency | String | 訂單所用貨幣。 | 
| TotalWeight | String | 訂單總重量。 | 
| BillingAddress | OrderAddress | 客戶的帳單地址。 | 
| ShippingAddress | OrderAddress | 客戶的運送地址。 | 
| OrderItems | OrderItem 清單 | 訂單項目。 | 
| 屬性 | 字串對字串對應 | 標準訂單屬性的鍵值對。 | 

標準訂單物件會依據下表的索引鍵編製索引。


| 標準索引名稱 | 標準訂單欄位 | 
| --- | --- | 
| \$1orderId | OrderId | 

例如，您可以使用 `_orderId` 作為索引鍵名稱，搭配 [SearchProfiles API](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html) 來尋找具有與搜尋值相符訂單 ID 之訂單的設定檔。您可以使用 [ListProfileObjects API](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html)，並將 `ProfileId` 和 `ObjectTypeName` 設定為 `_order`，以尋找與特定設定檔關聯的標準訂單物件。

## OrderAddress 資料類型
<a name="orderaddress-data-type"></a>


| 標準訂單欄位 | 資料類型 | Description | 
| --- | --- | --- | 
| Name | String | 與訂單地址相關聯的名稱。 | 
| Address1 | String | 訂單地址的第一行。 | 
| Address2 | String | 訂單地址的第二行。 | 
| Address3 | String | 訂單地址的第三行。 | 
| Address4 | String | 訂單地址的第四行。 | 
| City | String | 訂單地址的城市。 | 
| County | String | 訂單地址的郡/縣。 | 
| State | String | 訂單地址的州別。 | 
| Province | String | 訂單地址的省份。 | 
| Country | String | 訂單地址的國家。 | 
| PostalCode | String | 訂單地址的郵遞區號。 | 

## OrderItem 資料類型
<a name="orderitem-data-type"></a>


| 標準訂單欄位 | 資料類型 | Description | 
| --- | --- | --- | 
| Title | String | 訂單項目的標題。 | 
| Price | String | 訂單項目的價格。 | 
| 數量 | String | 訂單項目的數量。 | 

# 在 Amazon Connect Customer Profiles 中，將 Shopify 物件映射至標準訂單
<a name="mapping-shopify-objects-standard-order.html"></a>

本主題列出 Shopify 物件中的哪些欄位會對應到客戶設定檔中標準訂單物件中的欄位。

## Shopify-DraftOrder 物件
<a name="shopify-draftorder-object.html"></a>

如需 Shopify-DraftOrder 物件中所有欄位的清單，請參閱 Shopify 文件中的 [DraftOrder 物件](https://shopify.dev/api/admin-rest/2021-10/resources/draftorder#resource_object)。

## 將 Shopify-DraftOrder 物件對應到標準訂單
<a name="shopify-draftorder-object-standardorder.html"></a>

Shopify-DraftOrder 物件中欄位的子集會對應到客戶設定檔中的標準訂單物件。

下表列出了哪些欄位可以從 Shopify-DraftOrder 物件對應到標準訂單。

 如果來源中存在 `order_status_url`，則 `StatusCode` 為 `ACTIVATED`。否則 `StatusCode` 為 `DRAFT`。


|  Shopify-DraftOrder 來源欄位  |  標準訂單目標欄位  | 
| --- | --- | 
| id | Attributes.ShopifyOrderId | 
| customer.id | Attributes.ShopifyCustomerId | 
| note | AdditionalInformation | 
| email | CustomerEmail | 
| currency | Currency | 
| created\$1at | CreatedDate | 
| updated\$1at | UpdatedDate | 
| name | Name | 
| status | 狀態 | 
| order\$1status\$1url | StatusCode | 
| billing\$1address.address1 | BillingAddress.Address1 | 
| billing\$1address.address2 | BillingAddress.Address2 | 
| billing\$1address.city | BillingAddress.City | 
| billing\$1address.zip | BillingAddress.PostalCode | 
| billing\$1address.province | BillingAddress.Province | 
| billing\$1address.country | BillingAddress.Country | 
| billing\$1address.name | BillingAddress.Name | 
| shipping\$1address.address1 | ShippingAddress.Address1 | 
| shipping\$1address.address2 | ShippingAddress.Address2 | 
| shipping\$1address.city | ShippingAddress.City | 
| shipping\$1address.zip | ShippingAddress.PostalCode | 
| shipping\$1address.province | ShippingAddress.Province | 
| shipping\$1address.country | ShippingAddress.Country | 
| shipping\$1address.name | ShippingAddress.Name | 
| invoice\$1url | StatusUrl | 
| total\$1price | TotalPrice | 
| total\$1tax | TotalTax | 
| line\$1items[].title | OrderItems[].Title | 
| line\$1items[].price | OrderItems[].Price | 
| line\$1items[].quantity | OrderItems[].Quantity | 

### 範例
<a name="example-shopify-draftorder-object-standardorder.html"></a>

下列範例顯示如何將原始欄位對應到目標欄位。

```
"shopifyOrderId": {
    "Source": "_source.detail.event.detail.payload.id",
    "Target": "_order.Attributes.ShopifyOrderId"
}
```

來自 Shopify 物件的 Shopify-DraftOrder 客戶資料會使用下列索引與 Amazon Connect 標準訂單關聯。


| 標準索引名稱  | Shopify-DraftOrder 來源欄位  | 
| --- | --- | 
| \$1shopifyOrderId | id | 

例如，您可以使用 `_shopifyOrderId` 作為 `ObjectFilter.KeyName`，搭配 [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API 來尋找標準訂單。您可以使用 [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API，並將 `ProfileId` 和 `ObjectTypeName` 設定為 `Shopify-DraftOrder`，以尋找與特定設定檔關聯的 Shopify-DraftOrder 物件。

## Shopify-Order 物件
<a name="shopify-order-object.html"></a>

如需 Shopify-Order 物件中所有欄位的清單，請參閱 Shopify 文件中的[訂單物件](https://shopify.dev/api/admin-rest/2021-10/resources/order#resource_object)。

## 將 Shopify-Order 物件對應到標準訂單
<a name="mapping-shopify-order-object-standarorder.html"></a>

Shopify-Order 物件中的欄位的子集會對應到客戶設定檔中的標準訂單物件。

下表列出了哪些欄位可以從 Shopify-Order 物對應到標準訂單。

如果來源中存在 `order_status_url`，則 `StatusCode` 為 `ACTIVATED`。否則 `StatusCode` 為 `DRAFT`。


| Shopify-Order 來源欄位 | 標準訂單目標欄位 | 
| --- | --- | 
| id | Attributes.ShopifyOrderId | 
| customer.id | Attributes.ShopifyCustomerId | 
| cancelled\$1at | CancelledDate | 
| cancel\$1reason | CancelReason | 
| closed\$1at | ClosedDate | 
| created\$1at | CreatedDate | 
| currency | Currency | 
| email | CustomerEmail | 
| financial\$1status | 狀態 | 
| order\$1status\$1url | StatusCode | 
| fulfillment\$1status | FulfillmentStatus | 
| 閘道 | 閘道 | 
| name | 名稱 | 
| note | AdditionalInformation | 
| order\$1status\$1url | StatusUrl | 
| phone | CustomerPhone | 
| processed\$1at | ProcessedDate | 
| total\$1discounts | TotalDiscounts | 
| total\$1line\$1items\$1price | TotalItemsPrice | 
| total\$1price | TotalPrice | 
| total\$1shipping\$1price\$1set.shop\$1money.amount | TotalShippingPrice | 
| total\$1tax | TotalTax | 
| total\$1tip\$1received | TotalTipReceived | 
| total\$1weight | TotalWeight | 
| updated\$1at | UpdatedDate | 
| billing\$1address.address1 | BillingAddress.Address1 | 
| billing\$1address.address2 | BillingAddress.Address2 | 
| billing\$1address.city | BillingAddress.City | 
| billing\$1address.zip | BillingAddress.PostalCode | 
| billing\$1address.province | BillingAddress.Province | 
| billing\$1address.country | BillingAddress.Country | 
| billing\$1address.name | BillingAddress.Name | 
| payment\$1details.credit\$1card\$1number | CreditCardNumber | 
| payment\$1details.credit\$1card\$1company | CreditCardCompany | 
| shipping\$1address.address1 | ShippingAddress.Address1 | 
| shipping\$1address.address2 | ShippingAddress.Address2 | 
| shipping\$1address.city | ShippingAddress.City | 
| shipping\$1address.zip | ShippingAddress.PostalCode | 
| shipping\$1address.province | ShippingAddress.Province | 
| shipping\$1address.country | ShippingAddress.Country | 
| shipping\$1address.name | ShippingAddress.Name | 
| line\$1items[].title | OrderItems[].Title | 
| line\$1items[].price | OrderItems[].Price | 
| line\$1items[].quantity | OrderItems[].Quantity | 

### 範例
<a name="example-shopify-draftorder-object-standardorder.html"></a>

下列範例顯示如何將原始欄位對應到目標欄位。

```
"shopifyOrderId": {
    "Source": "_source.detail.event.detail.payload.id",
    "Target": "_order.Attributes.ShopifyOrderId"
}
```

來自 Shopify 物件的 Shopify-Order 客戶資料會使用下列索引與 Amazon Connect 標準訂單關聯。


| 標準索引名稱 | Shopify-Order 來源欄位 | 
| --- | --- | 
| \$1shopifyOrderId | id | 

例如，您可以使用 `_shopifyOrderId` 作為 `ObjectFilter.KeyName`，搭配 [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API 來尋找標準訂單。您可以使用 [ListProfileObjects](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_ListProfileObjects.html) API，並將 `ProfileId` 和 `ObjectTypeName` 設定為 `Shopify-Order`，以尋找與特定設定檔關聯的 Shopify-Order 物件。