diff --git a/gen/openapi.json b/gen/openapi.json index 4abb5ed8..23fea9a9 100644 --- a/gen/openapi.json +++ b/gen/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "Commerce Layer API", - "version": "2.7.6", + "version": "2.8.0", "contact": { "name": "API Support", "url": "https://commercelayer.io", @@ -5122,6 +5122,33 @@ } } }, + "/external_payments/{externalPaymentId}/wallet": { + "get": { + "operationId": "GET/externalPaymentId/wallet", + "summary": "Retrieve the wallet associated to the external payment", + "description": "Retrieve the wallet associated to the external payment", + "tags": [ + "has_one", + "customer_payment_sources" + ], + "parameters": [ + { + "name": "externalPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The wallet associated to the external payment" + } + } + } + }, "/external_promotions": { "get": { "operationId": "GET/external_promotions", @@ -8319,6 +8346,372 @@ } } }, + "/klarna_gateways": { + "get": { + "operationId": "GET/klarna_gateways", + "summary": "List all klarna gateways", + "description": "List all klarna gateways", + "tags": [ + "klarna_gateways" + ], + "responses": { + "200": { + "description": "A list of klarna gateway objects" + } + } + }, + "post": { + "operationId": "POST/klarna_gateways", + "summary": "Create a klarna gateway", + "description": "Create a klarna gateway", + "tags": [ + "klarna_gateways" + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaGatewayCreate" + } + } + } + }, + "responses": { + "201": { + "description": "The created klarna gateway object" + } + } + } + }, + "/klarna_gateways/{klarnaGatewayId}": { + "get": { + "operationId": "GET/klarna_gateways/klarnaGatewayId", + "summary": "Retrieve a klarna gateway", + "description": "Retrieve a klarna gateway", + "tags": [ + "klarna_gateways" + ], + "parameters": [ + { + "name": "klarnaGatewayId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The klarna gateway object", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaGateway" + } + } + } + } + } + }, + "patch": { + "operationId": "PATCH/klarna_gateways/klarnaGatewayId", + "summary": "Update a klarna gateway", + "description": "Update a klarna gateway", + "tags": [ + "klarna_gateways" + ], + "parameters": [ + { + "name": "klarnaGatewayId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaGatewayUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "The updated klarna gateway object" + } + } + }, + "delete": { + "operationId": "DELETE/klarna_gateways/klarnaGatewayId", + "summary": "Delete a klarna gateway", + "description": "Delete a klarna gateway", + "tags": [ + "klarna_gateways" + ], + "parameters": [ + { + "name": "klarnaGatewayId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "204": { + "description": "No content" + } + } + } + }, + "/klarna_gateways/{klarnaGatewayId}/payment_methods": { + "get": { + "operationId": "GET/klarnaGatewayId/payment_methods", + "summary": "Retrieve the payment methods associated to the klarna gateway", + "description": "Retrieve the payment methods associated to the klarna gateway", + "tags": [ + "has_many", + "payment_methods" + ], + "parameters": [ + { + "name": "klarnaGatewayId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The payment_methods associated to the klarna gateway" + } + } + } + }, + "/klarna_gateways/{klarnaGatewayId}/klarna_payments": { + "get": { + "operationId": "GET/klarnaGatewayId/klarna_payments", + "summary": "Retrieve the klarna payments associated to the klarna gateway", + "description": "Retrieve the klarna payments associated to the klarna gateway", + "tags": [ + "has_many", + "klarna_payments" + ], + "parameters": [ + { + "name": "klarnaGatewayId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The klarna_payments associated to the klarna gateway" + } + } + } + }, + "/klarna_payments": { + "get": { + "operationId": "GET/klarna_payments", + "summary": "List all klarna payments", + "description": "List all klarna payments", + "tags": [ + "klarna_payments" + ], + "responses": { + "200": { + "description": "A list of klarna payment objects" + } + } + }, + "post": { + "operationId": "POST/klarna_payments", + "summary": "Create a klarna payment", + "description": "Create a klarna payment", + "tags": [ + "klarna_payments" + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaPaymentCreate" + } + } + } + }, + "responses": { + "201": { + "description": "The created klarna payment object" + } + } + } + }, + "/klarna_payments/{klarnaPaymentId}": { + "get": { + "operationId": "GET/klarna_payments/klarnaPaymentId", + "summary": "Retrieve a klarna payment", + "description": "Retrieve a klarna payment", + "tags": [ + "klarna_payments" + ], + "parameters": [ + { + "name": "klarnaPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The klarna payment object", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaPayment" + } + } + } + } + } + }, + "patch": { + "operationId": "PATCH/klarna_payments/klarnaPaymentId", + "summary": "Update a klarna payment", + "description": "Update a klarna payment", + "tags": [ + "klarna_payments" + ], + "parameters": [ + { + "name": "klarnaPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/klarnaPaymentUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "The updated klarna payment object" + } + } + }, + "delete": { + "operationId": "DELETE/klarna_payments/klarnaPaymentId", + "summary": "Delete a klarna payment", + "description": "Delete a klarna payment", + "tags": [ + "klarna_payments" + ], + "parameters": [ + { + "name": "klarnaPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "204": { + "description": "No content" + } + } + } + }, + "/klarna_payments/{klarnaPaymentId}/order": { + "get": { + "operationId": "GET/klarnaPaymentId/order", + "summary": "Retrieve the order associated to the klarna payment", + "description": "Retrieve the order associated to the klarna payment", + "tags": [ + "has_one", + "orders" + ], + "parameters": [ + { + "name": "klarnaPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The order associated to the klarna payment" + } + } + } + }, + "/klarna_payments/{klarnaPaymentId}/payment_gateway": { + "get": { + "operationId": "GET/klarnaPaymentId/payment_gateway", + "summary": "Retrieve the payment gateway associated to the klarna payment", + "description": "Retrieve the payment gateway associated to the klarna payment", + "tags": [ + "has_one", + "payment_gateways" + ], + "parameters": [ + { + "name": "klarnaPaymentId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The payment_gateway associated to the klarna payment" + } + } + } + }, "/line_item_options": { "get": { "operationId": "GET/line_item_options", @@ -25515,6 +25908,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -25539,6 +25933,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -25637,6 +26034,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -25661,6 +26059,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -25769,6 +26170,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -25793,6 +26195,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -26975,6 +27380,11 @@ "type": "string", "description": "The endpoint used by the external gateway to refund payments.", "example": "https://external_gateway.com/refund" + }, + "token_url": { + "type": "string", + "description": "The endpoint used by the external gateway to create a customer payment token.", + "example": "https://external_gateway.com/token" } } }, @@ -27090,6 +27500,11 @@ "type": "string", "description": "The endpoint used by the external gateway to refund payments.", "example": "https://external_gateway.com/refund" + }, + "token_url": { + "type": "string", + "description": "The endpoint used by the external gateway to create a customer payment token.", + "example": "https://external_gateway.com/token" } }, "required": [ @@ -27173,6 +27588,11 @@ "type": "string", "description": "The endpoint used by the external gateway to refund payments.", "example": "https://external_gateway.com/refund" + }, + "token_url": { + "type": "string", + "description": "The endpoint used by the external gateway to create a customer payment token.", + "example": "https://external_gateway.com/token" } } }, @@ -27294,6 +27714,26 @@ "example": "XGZwpOSrWL" } } + }, + "wallet": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "customer_payment_sources", + "default": "customer_payment_sources" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } } } } @@ -33075,7 +33515,538 @@ } } }, - "inventoryReturnLocationCreate": { + "inventoryReturnLocationCreate": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_return_locations", + "default": "inventory_return_locations" + }, + "attributes": { + "type": "object", + "properties": { + "priority": { + "type": "integer", + "description": "The inventory return location priority within the associated invetory model.", + "example": 1 + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + }, + "required": [ + "priority" + ] + }, + "relationships": { + "type": "object", + "properties": { + "stock_location": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "stock_locations", + "default": "stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + }, + "inventory_model": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_models", + "default": "inventory_models" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + }, + "required": [ + "stock_location", + "inventory_model" + ] + } + } + } + } + }, + "inventoryReturnLocationUpdate": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_return_locations", + "default": "inventory_return_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "attributes": { + "type": "object", + "properties": { + "priority": { + "type": "integer", + "description": "The inventory return location priority within the associated invetory model.", + "example": 1 + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + } + }, + "relationships": { + "type": "object", + "properties": { + "stock_location": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "stock_locations", + "default": "stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + }, + "inventory_model": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_models", + "default": "inventory_models" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + }, + "inventoryStockLocation": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_stock_locations", + "default": "inventory_stock_locations" + }, + "attributes": { + "type": "object", + "properties": { + "priority": { + "type": "integer", + "description": "The stock location priority within the associated invetory model.", + "example": 1 + }, + "on_hold": { + "type": "boolean", + "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", + "example": false + }, + "id": { + "type": "string", + "description": "Unique identifier for the resource (hash).", + "example": "XAyRWNUzyN" + }, + "created_at": { + "type": "string", + "description": "Time at which the resource was created.", + "example": "2018-01-01T12:00:00.000Z" + }, + "updated_at": { + "type": "string", + "description": "Time at which the resource was last updated.", + "example": "2018-01-01T12:00:00.000Z" + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + } + }, + "relationships": { + "type": "object", + "properties": { + "stock_location": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "stock_locations", + "default": "stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + }, + "inventory_model": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_models", + "default": "inventory_models" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + }, + "inventoryStockLocationCreate": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_stock_locations", + "default": "inventory_stock_locations" + }, + "attributes": { + "type": "object", + "properties": { + "priority": { + "type": "integer", + "description": "The stock location priority within the associated invetory model.", + "example": 1 + }, + "on_hold": { + "type": "boolean", + "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", + "example": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + }, + "required": [ + "priority" + ] + }, + "relationships": { + "type": "object", + "properties": { + "stock_location": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "stock_locations", + "default": "stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + }, + "inventory_model": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_models", + "default": "inventory_models" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + }, + "required": [ + "stock_location", + "inventory_model" + ] + } + } + } + } + }, + "inventoryStockLocationUpdate": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_stock_locations", + "default": "inventory_stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "attributes": { + "type": "object", + "properties": { + "priority": { + "type": "integer", + "description": "The stock location priority within the associated invetory model.", + "example": 1 + }, + "on_hold": { + "type": "boolean", + "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", + "example": false + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } + } + } + }, + "relationships": { + "type": "object", + "properties": { + "stock_location": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "stock_locations", + "default": "stock_locations" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + }, + "inventory_model": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "inventory_models", + "default": "inventory_models" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + } + } + } + } + }, + "klarnaGateway": { "type": "object", "required": [ "data" @@ -33091,16 +34062,31 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_return_locations", - "default": "inventory_return_locations" + "example": "klarna_gateways", + "default": "klarna_gateways" }, "attributes": { "type": "object", "properties": { - "priority": { - "type": "integer", - "description": "The inventory return location priority within the associated invetory model.", - "example": 1 + "name": { + "type": "string", + "description": "The payment gateway's internal name.", + "example": "US payment gateway" + }, + "id": { + "type": "string", + "description": "Unique identifier for the resource (hash).", + "example": "XAyRWNUzyN" + }, + "created_at": { + "type": "string", + "description": "Time at which the resource was created.", + "example": "2018-01-01T12:00:00.000Z" + }, + "updated_at": { + "type": "string", + "description": "Time at which the resource was last updated.", + "example": "2018-01-01T12:00:00.000Z" }, "reference": { "type": "string", @@ -33119,15 +34105,12 @@ "foo": "bar" } } - }, - "required": [ - "priority" - ] + } }, "relationships": { "type": "object", "properties": { - "stock_location": { + "payment_methods": { "type": "object", "required": [ "type", @@ -33137,8 +34120,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "stock_locations", - "default": "stock_locations" + "example": "payment_methods", + "default": "payment_methods" }, "id": { "type": "string", @@ -33147,7 +34130,7 @@ } } }, - "inventory_model": { + "klarna_payments": { "type": "object", "required": [ "type", @@ -33157,8 +34140,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_models", - "default": "inventory_models" + "example": "klarna_payments", + "default": "klarna_payments" }, "id": { "type": "string", @@ -33167,17 +34150,13 @@ } } } - }, - "required": [ - "stock_location", - "inventory_model" - ] + } } } } } }, - "inventoryReturnLocationUpdate": { + "klarnaGatewayCreate": { "type": "object", "required": [ "data" @@ -33187,28 +34166,22 @@ "type": "object", "required": [ "type", - "id", "attributes" ], "properties": { "type": { "type": "string", "description": "The resource's type", - "example": "inventory_return_locations", - "default": "inventory_return_locations" - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" + "example": "klarna_gateways", + "default": "klarna_gateways" }, "attributes": { "type": "object", "properties": { - "priority": { - "type": "integer", - "description": "The inventory return location priority within the associated invetory model.", - "example": 1 + "name": { + "type": "string", + "description": "The payment gateway's internal name.", + "example": "US payment gateway" }, "reference": { "type": "string", @@ -33226,13 +34199,34 @@ "example": { "foo": "bar" } + }, + "country_code": { + "type": "string", + "description": "The gateway country code one of EU, US, or OC.", + "example": "EU" + }, + "api_key": { + "type": "string", + "description": "The public key linked to your API credential.", + "example": "xxxx-yyyy-zzzz" + }, + "api_secret": { + "type": "string", + "description": "The gateway API key.", + "example": "xxxx-yyyy-zzzz" } - } + }, + "required": [ + "name", + "country_code", + "api_key", + "api_secret" + ] }, "relationships": { "type": "object", "properties": { - "stock_location": { + "klarna_payments": { "type": "object", "required": [ "type", @@ -33242,8 +34236,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "stock_locations", - "default": "stock_locations" + "example": "klarna_payments", + "default": "klarna_payments" }, "id": { "type": "string", @@ -33251,8 +34245,84 @@ "example": "XGZwpOSrWL" } } + } + } + } + } + } + } + }, + "klarnaGatewayUpdate": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "object", + "required": [ + "type", + "id", + "attributes" + ], + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "example": "klarna_gateways", + "default": "klarna_gateways" + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + }, + "attributes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The payment gateway's internal name.", + "example": "US payment gateway" + }, + "reference": { + "type": "string", + "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", + "example": "ANY-EXTERNAL-REFEFERNCE" + }, + "reference_origin": { + "type": "string", + "description": "Any identifier of the third party system that defines the reference code", + "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN" + }, + "metadata": { + "type": "object", + "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", + "example": { + "foo": "bar" + } }, - "inventory_model": { + "country_code": { + "type": "string", + "description": "The gateway country code one of EU, US, or OC.", + "example": "EU" + }, + "api_key": { + "type": "string", + "description": "The public key linked to your API credential.", + "example": "xxxx-yyyy-zzzz" + }, + "api_secret": { + "type": "string", + "description": "The gateway API key.", + "example": "xxxx-yyyy-zzzz" + } + } + }, + "relationships": { + "type": "object", + "properties": { + "klarna_payments": { "type": "object", "required": [ "type", @@ -33262,8 +34332,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_models", - "default": "inventory_models" + "example": "klarna_payments", + "default": "klarna_payments" }, "id": { "type": "string", @@ -33278,7 +34348,7 @@ } } }, - "inventoryStockLocation": { + "klarnaPayment": { "type": "object", "required": [ "data" @@ -33294,21 +34364,38 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_stock_locations", - "default": "inventory_stock_locations" + "example": "klarna_payments", + "default": "klarna_payments" }, "attributes": { "type": "object", "properties": { - "priority": { - "type": "integer", - "description": "The stock location priority within the associated invetory model.", - "example": 1 + "session_id": { + "type": "string", + "description": "The identifier of the payment session, useful to updated it.", + "example": "xxxx-yyyy-zzzz" }, - "on_hold": { - "type": "boolean", - "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", - "example": false + "client_token": { + "type": "string", + "description": "The public token linked to your API credential. Available upon session creation.", + "example": "xxxx-yyyy-zzzz" + }, + "payment_methods": { + "type": "array", + "description": "The merchant available payment methods for the assoiated order. Available upon session creation.", + "example": [ + { + "foo": "bar" + } + ], + "items": { + "type": "object" + } + }, + "auth_token": { + "type": "string", + "description": "The token returned by a successful client authorization, mandatory to place the order.", + "example": "xxxx-yyyy-zzzz" }, "id": { "type": "string", @@ -33347,7 +34434,7 @@ "relationships": { "type": "object", "properties": { - "stock_location": { + "order": { "type": "object", "required": [ "type", @@ -33357,8 +34444,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "stock_locations", - "default": "stock_locations" + "example": "orders", + "default": "orders" }, "id": { "type": "string", @@ -33367,7 +34454,7 @@ } } }, - "inventory_model": { + "payment_gateway": { "type": "object", "required": [ "type", @@ -33377,8 +34464,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_models", - "default": "inventory_models" + "example": "payment_gateways", + "default": "payment_gateways" }, "id": { "type": "string", @@ -33393,7 +34480,7 @@ } } }, - "inventoryStockLocationCreate": { + "klarnaPaymentCreate": { "type": "object", "required": [ "data" @@ -33409,22 +34496,12 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_stock_locations", - "default": "inventory_stock_locations" + "example": "klarna_payments", + "default": "klarna_payments" }, "attributes": { "type": "object", "properties": { - "priority": { - "type": "integer", - "description": "The stock location priority within the associated invetory model.", - "example": 1 - }, - "on_hold": { - "type": "boolean", - "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", - "example": false - }, "reference": { "type": "string", "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", @@ -33442,35 +34519,12 @@ "foo": "bar" } } - }, - "required": [ - "priority" - ] + } }, "relationships": { "type": "object", "properties": { - "stock_location": { - "type": "object", - "required": [ - "type", - "id" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "example": "stock_locations", - "default": "stock_locations" - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - }, - "inventory_model": { + "order": { "type": "object", "required": [ "type", @@ -33480,8 +34534,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_models", - "default": "inventory_models" + "example": "orders", + "default": "orders" }, "id": { "type": "string", @@ -33492,15 +34546,14 @@ } }, "required": [ - "stock_location", - "inventory_model" + "order" ] } } } } }, - "inventoryStockLocationUpdate": { + "klarnaPaymentUpdate": { "type": "object", "required": [ "data" @@ -33517,8 +34570,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_stock_locations", - "default": "inventory_stock_locations" + "example": "klarna_payments", + "default": "klarna_payments" }, "id": { "type": "string", @@ -33528,15 +34581,15 @@ "attributes": { "type": "object", "properties": { - "priority": { - "type": "integer", - "description": "The stock location priority within the associated invetory model.", - "example": 1 + "auth_token": { + "type": "string", + "description": "The token returned by a successful client authorization, mandatory to place the order.", + "example": "xxxx-yyyy-zzzz" }, - "on_hold": { + "_update": { "type": "boolean", - "description": "Indicates if the shipment should be put on hold if fulfilled from the associated stock location. This is useful to manage use cases like back-orders, pre-orders or personalized orders that need to be customized before being fulfilled.", - "example": false + "description": "Send this attribute if you want to update the payment session with fresh order data.", + "example": true }, "reference": { "type": "string", @@ -33560,27 +34613,7 @@ "relationships": { "type": "object", "properties": { - "stock_location": { - "type": "object", - "required": [ - "type", - "id" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "example": "stock_locations", - "default": "stock_locations" - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - }, - "inventory_model": { + "order": { "type": "object", "required": [ "type", @@ -33590,8 +34623,8 @@ "type": { "type": "string", "description": "The resource's type", - "example": "inventory_models", - "default": "inventory_models" + "example": "orders", + "default": "orders" }, "id": { "type": "string", @@ -37853,6 +38886,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -37877,6 +38911,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -38340,6 +39377,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -38364,6 +39402,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -38713,6 +39754,7 @@ "braintree_payments", "checkout_com_payments", "external_payments", + "klarna_payments", "paypal_payments", "stripe_payments", "wire_transfers" @@ -38737,6 +39779,9 @@ { "$ref": "#/components/schemas/externalPayment" }, + { + "$ref": "#/components/schemas/klarnaPayment" + }, { "$ref": "#/components/schemas/paypalPayment" }, @@ -51574,6 +52619,14 @@ "name": "inventory_stock_locations", "description": "resource type" }, + { + "name": "klarna_gateways", + "description": "resource type" + }, + { + "name": "klarna_payments", + "description": "resource type" + }, { "name": "line_item_options", "description": "resource type" diff --git a/specs/resources/addresses.spec.ts b/specs/resources/addresses.spec.ts index 931e302b..0fcdbb2b 100644 --- a/specs/resources/addresses.spec.ts +++ b/specs/resources/addresses.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('Addresses resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - line_1: 'epsilon_54', - city: 'epsilon_82', - state_code: 'beta_31', - country_code: 'delta_57', - phone: 'epsilon_71', + line_1: 'omega_83', + city: 'delta_73', + state_code: 'kappa_24', + country_code: 'omega_48', + phone: 'omega_93', geocoder: cl.geocoders.relationship(TestData.id), } diff --git a/specs/resources/adjustments.spec.ts b/specs/resources/adjustments.spec.ts index f4874f14..92b4f70a 100644 --- a/specs/resources/adjustments.spec.ts +++ b/specs/resources/adjustments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,9 +25,9 @@ describe('Adjustments resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'delta_29', - currency_code: 'alfa_4', - amount_cents: 0, + name: 'epsilon_58', + currency_code: 'delta_53', + amount_cents: 555, } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/adyen_gateways.spec.ts b/specs/resources/adyen_gateways.spec.ts index 4d4ecd1a..e787c7e1 100644 --- a/specs/resources/adyen_gateways.spec.ts +++ b/specs/resources/adyen_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('AdyenGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'epsilon_22', - merchant_account: 'alfa_92', - api_key: 'gamma_15', - live_url_prefix: 'epsilon_9', + name: 'gamma_34', + merchant_account: 'sigma_59', + api_key: 'kappa_11', + live_url_prefix: 'alfa_76', adyen_payments: [ cl.adyen_payments.relationship(TestData.id) ], } diff --git a/specs/resources/adyen_payments.spec.ts b/specs/resources/adyen_payments.spec.ts index 19e61235..e16c7810 100644 --- a/specs/resources/adyen_payments.spec.ts +++ b/specs/resources/adyen_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/application.spec.ts b/specs/resources/application.spec.ts index 10cb5a28..277de583 100644 --- a/specs/resources/application.spec.ts +++ b/specs/resources/application.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/attachments.spec.ts b/specs/resources/attachments.spec.ts index 9959684d..7f99d5b4 100644 --- a/specs/resources/attachments.spec.ts +++ b/specs/resources/attachments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('Attachments resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'sigma_86', + name: 'beta_39', attachable: cl.bundles.relationship(TestData.id), } diff --git a/specs/resources/authorizations.spec.ts b/specs/resources/authorizations.spec.ts index 04ddc9fa..48a073b5 100644 --- a/specs/resources/authorizations.spec.ts +++ b/specs/resources/authorizations.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/avalara_accounts.spec.ts b/specs/resources/avalara_accounts.spec.ts index b42513f3..23479f0c 100644 --- a/specs/resources/avalara_accounts.spec.ts +++ b/specs/resources/avalara_accounts.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('AvalaraAccounts resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'lambda_1', - username: 'epsilon_47', - password: 'sigma_0', - company_code: 'sigma_92', + name: 'omega_10', + username: 'alfa_0', + password: 'omega_73', + company_code: 'alfa_69', tax_categories: [ cl.tax_categories.relationship(TestData.id) ], } diff --git a/specs/resources/billing_info_validation_rules.spec.ts b/specs/resources/billing_info_validation_rules.spec.ts index e6f5e96e..9bfe47a9 100644 --- a/specs/resources/billing_info_validation_rules.spec.ts +++ b/specs/resources/billing_info_validation_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/bing_geocoders.spec.ts b/specs/resources/bing_geocoders.spec.ts index 0e16cdd5..e92b90cd 100644 --- a/specs/resources/bing_geocoders.spec.ts +++ b/specs/resources/bing_geocoders.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('BingGeocoders resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'kappa_49', - key: 'gamma_38', + name: 'epsilon_27', + key: 'alfa_25', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/braintree_gateways.spec.ts b/specs/resources/braintree_gateways.spec.ts index 2189e423..dbfe3df4 100644 --- a/specs/resources/braintree_gateways.spec.ts +++ b/specs/resources/braintree_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('BraintreeGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_38', - merchant_account_id: 'omega_1', - merchant_id: 'alfa_45', - public_key: 'alfa_96', - private_key: 'delta_74', + name: 'epsilon_21', + merchant_account_id: 'sigma_22', + merchant_id: 'sigma_10', + public_key: 'alfa_38', + private_key: 'alfa_39', braintree_payments: [ cl.braintree_payments.relationship(TestData.id) ], } diff --git a/specs/resources/braintree_payments.spec.ts b/specs/resources/braintree_payments.spec.ts index dc013615..2e6f1c7d 100644 --- a/specs/resources/braintree_payments.spec.ts +++ b/specs/resources/braintree_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/bundles.spec.ts b/specs/resources/bundles.spec.ts index 2ced7af1..1a5a9c74 100644 --- a/specs/resources/bundles.spec.ts +++ b/specs/resources/bundles.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('Bundles resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - code: 'lambda_14', - name: 'kappa_16', + code: 'omega_80', + name: 'gamma_59', price_amount_cents: 10000, - compare_at_amount_cents: 1000, + compare_at_amount_cents: 55, market: cl.markets.relationship(TestData.id), sku_list: cl.sku_lists.relationship(TestData.id), } diff --git a/specs/resources/captures.spec.ts b/specs/resources/captures.spec.ts index b09b7a89..410248b6 100644 --- a/specs/resources/captures.spec.ts +++ b/specs/resources/captures.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/carrier_accounts.spec.ts b/specs/resources/carrier_accounts.spec.ts index be0e405f..72acc9a5 100644 --- a/specs/resources/carrier_accounts.spec.ts +++ b/specs/resources/carrier_accounts.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/checkout_com_gateways.spec.ts b/specs/resources/checkout_com_gateways.spec.ts index fc4fa15c..2ce50c48 100644 --- a/specs/resources/checkout_com_gateways.spec.ts +++ b/specs/resources/checkout_com_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,9 +25,9 @@ describe('CheckoutComGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'beta_27', - secret_key: 'delta_40', - public_key: 'alfa_25', + name: 'delta_98', + secret_key: 'gamma_3', + public_key: 'delta_35', checkout_com_payments: [ cl.checkout_com_payments.relationship(TestData.id) ], } diff --git a/specs/resources/checkout_com_payments.spec.ts b/specs/resources/checkout_com_payments.spec.ts index c8c1ade6..820ddaaf 100644 --- a/specs/resources/checkout_com_payments.spec.ts +++ b/specs/resources/checkout_com_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('CheckoutComPayments resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - payment_type: 'omega_3', - token: 'lambda_31', + payment_type: 'delta_43', + token: 'epsilon_46', order: cl.orders.relationship(TestData.id), } diff --git a/specs/resources/coupon_codes_promotion_rules.spec.ts b/specs/resources/coupon_codes_promotion_rules.spec.ts index 7700f089..a045199c 100644 --- a/specs/resources/coupon_codes_promotion_rules.spec.ts +++ b/specs/resources/coupon_codes_promotion_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/coupon_recipients.spec.ts b/specs/resources/coupon_recipients.spec.ts index 39141b84..52660832 100644 --- a/specs/resources/coupon_recipients.spec.ts +++ b/specs/resources/coupon_recipients.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('CouponRecipients resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - email: 'alfa_75', + email: 'sigma_28', customer: cl.customers.relationship(TestData.id), } diff --git a/specs/resources/coupons.spec.ts b/specs/resources/coupons.spec.ts index bec66f8f..bc92ab0d 100644 --- a/specs/resources/coupons.spec.ts +++ b/specs/resources/coupons.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('Coupons resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - code: 'beta_86', - usage_limit: 55, + code: 'delta_71', + usage_limit: 100, promotion_rule: cl.coupon_codes_promotion_rules.relationship(TestData.id), } diff --git a/specs/resources/customer_addresses.spec.ts b/specs/resources/customer_addresses.spec.ts index 3c2b53bb..a381a16f 100644 --- a/specs/resources/customer_addresses.spec.ts +++ b/specs/resources/customer_addresses.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/customer_groups.spec.ts b/specs/resources/customer_groups.spec.ts index c9111c5e..2c35f6a7 100644 --- a/specs/resources/customer_groups.spec.ts +++ b/specs/resources/customer_groups.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('CustomerGroups resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'gamma_19', + name: 'delta_62', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/customer_password_resets.spec.ts b/specs/resources/customer_password_resets.spec.ts index 4965ea39..a806238e 100644 --- a/specs/resources/customer_password_resets.spec.ts +++ b/specs/resources/customer_password_resets.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('CustomerPasswordResets resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - customer_email: 'sigma_54', + customer_email: 'epsilon_90', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/customer_payment_sources.spec.ts b/specs/resources/customer_payment_sources.spec.ts index 1176e9bc..93e0afd9 100644 --- a/specs/resources/customer_payment_sources.spec.ts +++ b/specs/resources/customer_payment_sources.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/customer_subscriptions.spec.ts b/specs/resources/customer_subscriptions.spec.ts index e4c40009..3287d5a7 100644 --- a/specs/resources/customer_subscriptions.spec.ts +++ b/specs/resources/customer_subscriptions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('CustomerSubscriptions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - customer_email: 'gamma_10', + customer_email: 'delta_9', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/customers.spec.ts b/specs/resources/customers.spec.ts index 242eb298..95b372bc 100644 --- a/specs/resources/customers.spec.ts +++ b/specs/resources/customers.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('Customers resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - email: 'omega_33', + email: 'delta_28', customer_group: cl.customer_groups.relationship(TestData.id), } diff --git a/specs/resources/delivery_lead_times.spec.ts b/specs/resources/delivery_lead_times.spec.ts index 9f456190..b7bfd7d1 100644 --- a/specs/resources/delivery_lead_times.spec.ts +++ b/specs/resources/delivery_lead_times.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('DeliveryLeadTimes resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - min_hours: 12345, - max_hours: 1, + min_hours: 10, + max_hours: 5, stock_location: cl.stock_locations.relationship(TestData.id), shipping_method: cl.shipping_methods.relationship(TestData.id), } diff --git a/specs/resources/event_callbacks.spec.ts b/specs/resources/event_callbacks.spec.ts index 728e0af3..45dfd643 100644 --- a/specs/resources/event_callbacks.spec.ts +++ b/specs/resources/event_callbacks.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/external_gateways.spec.ts b/specs/resources/external_gateways.spec.ts index 22f96ef2..94afdddb 100644 --- a/specs/resources/external_gateways.spec.ts +++ b/specs/resources/external_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ExternalGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'alfa_49', + name: 'kappa_61', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/external_payments.spec.ts b/specs/resources/external_payments.spec.ts index ec256032..f8d729bf 100644 --- a/specs/resources/external_payments.spec.ts +++ b/specs/resources/external_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ExternalPayments resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - payment_source_token: 'epsilon_13', + payment_source_token: 'sigma_78', order: cl.orders.relationship(TestData.id), } diff --git a/specs/resources/external_promotions.spec.ts b/specs/resources/external_promotions.spec.ts index 1b065828..fef70539 100644 --- a/specs/resources/external_promotions.spec.ts +++ b/specs/resources/external_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('ExternalPromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'sigma_16', - starts_at: 'kappa_78', - expires_at: 'alfa_84', - total_usage_limit: 0, - promotion_url: 'epsilon_13', + name: 'omega_56', + starts_at: 'epsilon_33', + expires_at: 'sigma_9', + total_usage_limit: 10000, + promotion_url: 'delta_24', market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/external_tax_calculators.spec.ts b/specs/resources/external_tax_calculators.spec.ts index c636f426..633994a1 100644 --- a/specs/resources/external_tax_calculators.spec.ts +++ b/specs/resources/external_tax_calculators.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('ExternalTaxCalculators resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_91', - tax_calculator_url: 'lambda_4', + name: 'lambda_42', + tax_calculator_url: 'lambda_6', tax_categories: [ cl.tax_categories.relationship(TestData.id) ], } diff --git a/specs/resources/fixed_amount_promotions.spec.ts b/specs/resources/fixed_amount_promotions.spec.ts index 28ba0a43..82ac11e6 100644 --- a/specs/resources/fixed_amount_promotions.spec.ts +++ b/specs/resources/fixed_amount_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('FixedAmountPromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'alfa_22', - starts_at: 'sigma_37', - expires_at: 'lambda_23', + name: 'alfa_54', + starts_at: 'gamma_84', + expires_at: 'alfa_10', total_usage_limit: 12345, - fixed_amount_cents: 10000, + fixed_amount_cents: 10, market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/fixed_price_promotions.spec.ts b/specs/resources/fixed_price_promotions.spec.ts index 26c802ca..c82427e1 100644 --- a/specs/resources/fixed_price_promotions.spec.ts +++ b/specs/resources/fixed_price_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('FixedPricePromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_41', - starts_at: 'sigma_56', - expires_at: 'epsilon_92', + name: 'lambda_49', + starts_at: 'epsilon_44', + expires_at: 'delta_27', total_usage_limit: 5, - fixed_amount_cents: 100, + fixed_amount_cents: 12345, market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/free_gift_promotions.spec.ts b/specs/resources/free_gift_promotions.spec.ts index 149427e4..172d2457 100644 --- a/specs/resources/free_gift_promotions.spec.ts +++ b/specs/resources/free_gift_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('FreeGiftPromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'epsilon_1', - starts_at: 'lambda_86', - expires_at: 'omega_31', - total_usage_limit: 10000, + name: 'sigma_76', + starts_at: 'sigma_55', + expires_at: 'omega_54', + total_usage_limit: 12345, market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/free_shipping_promotions.spec.ts b/specs/resources/free_shipping_promotions.spec.ts index cbce66aa..802a19b9 100644 --- a/specs/resources/free_shipping_promotions.spec.ts +++ b/specs/resources/free_shipping_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('FreeShippingPromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_86', - starts_at: 'sigma_96', - expires_at: 'beta_43', - total_usage_limit: 10, + name: 'lambda_39', + starts_at: 'epsilon_11', + expires_at: 'epsilon_87', + total_usage_limit: 100, market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/geocoders.spec.ts b/specs/resources/geocoders.spec.ts index 868413b5..a8fac76f 100644 --- a/specs/resources/geocoders.spec.ts +++ b/specs/resources/geocoders.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/gift_card_recipients.spec.ts b/specs/resources/gift_card_recipients.spec.ts index ff64f5b6..c348a1c6 100644 --- a/specs/resources/gift_card_recipients.spec.ts +++ b/specs/resources/gift_card_recipients.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('GiftCardRecipients resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - email: 'lambda_80', + email: 'delta_28', customer: cl.customers.relationship(TestData.id), } diff --git a/specs/resources/gift_cards.spec.ts b/specs/resources/gift_cards.spec.ts index 586bbec8..ac20ef42 100644 --- a/specs/resources/gift_cards.spec.ts +++ b/specs/resources/gift_cards.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('GiftCards resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - currency_code: 'gamma_25', - balance_cents: 55, + currency_code: 'alfa_82', + balance_cents: 10000, market: cl.markets.relationship(TestData.id), gift_card_recipient: cl.gift_card_recipients.relationship(TestData.id), } diff --git a/specs/resources/google_geocoders.spec.ts b/specs/resources/google_geocoders.spec.ts index b9cc420f..22272b1d 100644 --- a/specs/resources/google_geocoders.spec.ts +++ b/specs/resources/google_geocoders.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('GoogleGeocoders resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'delta_21', - api_key: 'gamma_34', + name: 'sigma_23', + api_key: 'lambda_14', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/imports.spec.ts b/specs/resources/imports.spec.ts index de5bea38..418d7c72 100644 --- a/specs/resources/imports.spec.ts +++ b/specs/resources/imports.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('Imports resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - resource_type: 'epsilon_62', - inputs: [ { key21: 'val21' } ], + resource_type: 'beta_67', + inputs: [ { key31: 'val31' } ], } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/in_stock_subscriptions.spec.ts b/specs/resources/in_stock_subscriptions.spec.ts index e608e586..af0747d2 100644 --- a/specs/resources/in_stock_subscriptions.spec.ts +++ b/specs/resources/in_stock_subscriptions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/inventory_models.spec.ts b/specs/resources/inventory_models.spec.ts index ed4410e2..df32a8e2 100644 --- a/specs/resources/inventory_models.spec.ts +++ b/specs/resources/inventory_models.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('InventoryModels resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'gamma_70', - strategy: 'kappa_23', + name: 'beta_70', + strategy: 'epsilon_18', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/inventory_return_locations.spec.ts b/specs/resources/inventory_return_locations.spec.ts index 0a06bfdf..50e65e7e 100644 --- a/specs/resources/inventory_return_locations.spec.ts +++ b/specs/resources/inventory_return_locations.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/inventory_stock_locations.spec.ts b/specs/resources/inventory_stock_locations.spec.ts index 54d8950c..4835b5d7 100644 --- a/specs/resources/inventory_stock_locations.spec.ts +++ b/specs/resources/inventory_stock_locations.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('InventoryStockLocations resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - priority: 10, + priority: 555, stock_location: cl.stock_locations.relationship(TestData.id), inventory_model: cl.inventory_models.relationship(TestData.id), } diff --git a/specs/resources/klarna_gateways.spec.ts b/specs/resources/klarna_gateways.spec.ts new file mode 100644 index 00000000..fe44a1db --- /dev/null +++ b/specs/resources/klarna_gateways.spec.ts @@ -0,0 +1,155 @@ +/** + * ©2022 Commerce Layer Inc. + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 + **/ + +import { CommerceLayerClient } from '../../src' +import { isEqual } from 'lodash' +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { getClient, TestData, CommonData, handleError, interceptRequest, checkCommon, checkCommonData, checkCommonParamsList, checkCommonParams, currentAccessToken } from '../../test/common' + + + +let cl: CommerceLayerClient + + +beforeAll(async () => { cl = await getClient() }) + + +describe('KlarnaGateways resource', () => { + + const resourceType = 'klarna_gateways' + + + /* spec.create.start */ + it(resourceType + '.create', async () => { + + const createAttributes = { + name: 'sigma_3', + country_code: 'gamma_73', + api_key: 'sigma_68', + api_secret: 'beta_92', + klarna_payments: [ cl.klarna_payments.relationship(TestData.id) ], + } + + const attributes = { ...createAttributes, reference: TestData.reference } + const params = { fields: { klarna_gateways: CommonData.paramsFields } } + const resData = attributes + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('post') + checkCommon(config, resourceType) + checkCommonData(config, resourceType, attributes) + expect(cl[resourceType].isKlarnaGateway(config.data.data)).toBeTruthy() + return interceptRequest() + }) + + await cl[resourceType].create(resData, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.create.stop */ + + + /* spec.retrieve.start */ + it(resourceType + '.retrieve', async () => { + + const id = TestData.id + const params = { fields: { klarna_gateways: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('get') + checkCommon(config, resourceType, id, currentAccessToken) + checkCommonParams(config, params) + return interceptRequest() + }) + + await cl[resourceType].retrieve(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.retrieve.stop */ + + + /* spec.update.start */ + it(resourceType + '.update', async () => { + + const attributes = { reference_origin: TestData.reference_origin, metadata: TestData.metadata } + const params = { fields: { klarna_gateways: CommonData.paramsFields } } + const resData = { id: TestData.id, ...attributes} + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('patch') + checkCommon(config, resourceType, resData.id, currentAccessToken) + checkCommonData(config, resourceType, attributes, resData.id) + return interceptRequest() + }) + + await cl[resourceType].update(resData, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.update.stop */ + + + /* spec.delete.start */ + it(resourceType + '.delete', async () => { + + const id = TestData.id + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('delete') + checkCommon(config, resourceType, id, currentAccessToken) + return interceptRequest() + }) + + await cl[resourceType].delete(id, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.delete.stop */ + + + /* spec.list.start */ + it(resourceType + '.list', async () => { + + const params = CommonData.paramsList + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('get') + checkCommon(config, resourceType) + checkCommonParamsList(config, params) + return interceptRequest() + }) + + await cl[resourceType].list(params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.list.stop */ + + + /* spec.type.start */ + it(resourceType + '.type', async () => { + + const resource = { id: TestData.id, type: resourceType } + expect(cl[resourceType].isKlarnaGateway(resource)).toBeTruthy() + + const relId = cl[resourceType].relationship(TestData.id) + expect(isEqual(relId, { id: TestData.id, type: resourceType})) + + const relResId = cl[resourceType].relationship({ id: TestData.id, type: resourceType }) + expect(isEqual(relResId, { id: TestData.id, type: resourceType})) + + const type = cl[resourceType].type() + expect(type).toBe(resourceType) + + }) + /* spec.type.stop */ + +}) diff --git a/specs/resources/klarna_payments.spec.ts b/specs/resources/klarna_payments.spec.ts new file mode 100644 index 00000000..f2ce96ff --- /dev/null +++ b/specs/resources/klarna_payments.spec.ts @@ -0,0 +1,151 @@ +/** + * ©2022 Commerce Layer Inc. + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 + **/ + +import { CommerceLayerClient } from '../../src' +import { isEqual } from 'lodash' +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { getClient, TestData, CommonData, handleError, interceptRequest, checkCommon, checkCommonData, checkCommonParamsList, checkCommonParams, currentAccessToken } from '../../test/common' + + + +let cl: CommerceLayerClient + + +beforeAll(async () => { cl = await getClient() }) + + +describe('KlarnaPayments resource', () => { + + const resourceType = 'klarna_payments' + + + /* spec.create.start */ + it(resourceType + '.create', async () => { + + const createAttributes = { + order: cl.orders.relationship(TestData.id), + } + + const attributes = { ...createAttributes, reference: TestData.reference } + const params = { fields: { klarna_payments: CommonData.paramsFields } } + const resData = attributes + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('post') + checkCommon(config, resourceType) + checkCommonData(config, resourceType, attributes) + expect(cl[resourceType].isKlarnaPayment(config.data.data)).toBeTruthy() + return interceptRequest() + }) + + await cl[resourceType].create(resData, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.create.stop */ + + + /* spec.retrieve.start */ + it(resourceType + '.retrieve', async () => { + + const id = TestData.id + const params = { fields: { klarna_payments: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('get') + checkCommon(config, resourceType, id, currentAccessToken) + checkCommonParams(config, params) + return interceptRequest() + }) + + await cl[resourceType].retrieve(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.retrieve.stop */ + + + /* spec.update.start */ + it(resourceType + '.update', async () => { + + const attributes = { reference_origin: TestData.reference_origin, metadata: TestData.metadata } + const params = { fields: { klarna_payments: CommonData.paramsFields } } + const resData = { id: TestData.id, ...attributes} + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('patch') + checkCommon(config, resourceType, resData.id, currentAccessToken) + checkCommonData(config, resourceType, attributes, resData.id) + return interceptRequest() + }) + + await cl[resourceType].update(resData, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.update.stop */ + + + /* spec.delete.start */ + it(resourceType + '.delete', async () => { + + const id = TestData.id + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('delete') + checkCommon(config, resourceType, id, currentAccessToken) + return interceptRequest() + }) + + await cl[resourceType].delete(id, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.delete.stop */ + + + /* spec.list.start */ + it(resourceType + '.list', async () => { + + const params = CommonData.paramsList + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('get') + checkCommon(config, resourceType) + checkCommonParamsList(config, params) + return interceptRequest() + }) + + await cl[resourceType].list(params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* spec.list.stop */ + + + /* spec.type.start */ + it(resourceType + '.type', async () => { + + const resource = { id: TestData.id, type: resourceType } + expect(cl[resourceType].isKlarnaPayment(resource)).toBeTruthy() + + const relId = cl[resourceType].relationship(TestData.id) + expect(isEqual(relId, { id: TestData.id, type: resourceType})) + + const relResId = cl[resourceType].relationship({ id: TestData.id, type: resourceType }) + expect(isEqual(relResId, { id: TestData.id, type: resourceType})) + + const type = cl[resourceType].type() + expect(type).toBe(resourceType) + + }) + /* spec.type.stop */ + +}) diff --git a/specs/resources/line_item_options.spec.ts b/specs/resources/line_item_options.spec.ts index fc282901..f2af4fbd 100644 --- a/specs/resources/line_item_options.spec.ts +++ b/specs/resources/line_item_options.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('LineItemOptions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 10, + quantity: 0, options: { key31: 'val31' }, line_item: cl.line_items.relationship(TestData.id), sku_option: cl.sku_options.relationship(TestData.id), diff --git a/specs/resources/line_items.spec.ts b/specs/resources/line_items.spec.ts index d53340b1..130d7718 100644 --- a/specs/resources/line_items.spec.ts +++ b/specs/resources/line_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('LineItems resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 55, + quantity: 10000, order: cl.orders.relationship(TestData.id), item: cl.adjustments.relationship(TestData.id), } diff --git a/specs/resources/manual_gateways.spec.ts b/specs/resources/manual_gateways.spec.ts index 80f14885..76c4b2eb 100644 --- a/specs/resources/manual_gateways.spec.ts +++ b/specs/resources/manual_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ManualGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'epsilon_76', + name: 'delta_56', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/manual_tax_calculators.spec.ts b/specs/resources/manual_tax_calculators.spec.ts index 924622b6..80f72da1 100644 --- a/specs/resources/manual_tax_calculators.spec.ts +++ b/specs/resources/manual_tax_calculators.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ManualTaxCalculators resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'gamma_5', + name: 'beta_71', tax_categories: [ cl.tax_categories.relationship(TestData.id) ], tax_rules: [ cl.tax_rules.relationship(TestData.id) ], } diff --git a/specs/resources/markets.spec.ts b/specs/resources/markets.spec.ts index 5260ad30..867adbc9 100644 --- a/specs/resources/markets.spec.ts +++ b/specs/resources/markets.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('Markets resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_57', + name: 'sigma_96', merchant: cl.merchants.relationship(TestData.id), price_list: cl.price_lists.relationship(TestData.id), inventory_model: cl.inventory_models.relationship(TestData.id), diff --git a/specs/resources/merchants.spec.ts b/specs/resources/merchants.spec.ts index c8d14e63..98d4a3e1 100644 --- a/specs/resources/merchants.spec.ts +++ b/specs/resources/merchants.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('Merchants resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'delta_46', + name: 'sigma_0', address: cl.addresses.relationship(TestData.id), } diff --git a/specs/resources/order_amount_promotion_rules.spec.ts b/specs/resources/order_amount_promotion_rules.spec.ts index 547f0cfd..4ce85cc4 100644 --- a/specs/resources/order_amount_promotion_rules.spec.ts +++ b/specs/resources/order_amount_promotion_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/order_copies.spec.ts b/specs/resources/order_copies.spec.ts index abd6b8d3..156a1017 100644 --- a/specs/resources/order_copies.spec.ts +++ b/specs/resources/order_copies.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/order_subscriptions.spec.ts b/specs/resources/order_subscriptions.spec.ts index a91bef52..664b33e3 100644 --- a/specs/resources/order_subscriptions.spec.ts +++ b/specs/resources/order_subscriptions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('OrderSubscriptions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - frequency: 'delta_94', + frequency: 'gamma_44', market: cl.markets.relationship(TestData.id), source_order: cl.orders.relationship(TestData.id), } diff --git a/specs/resources/order_validation_rules.spec.ts b/specs/resources/order_validation_rules.spec.ts index 1316faf3..e634bc4a 100644 --- a/specs/resources/order_validation_rules.spec.ts +++ b/specs/resources/order_validation_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/orders.spec.ts b/specs/resources/orders.spec.ts index 526e5bb5..78a931c8 100644 --- a/specs/resources/orders.spec.ts +++ b/specs/resources/orders.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/organization.spec.ts b/specs/resources/organization.spec.ts index c21f7288..32a9dd83 100644 --- a/specs/resources/organization.spec.ts +++ b/specs/resources/organization.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/packages.spec.ts b/specs/resources/packages.spec.ts index 00720429..2c0826d8 100644 --- a/specs/resources/packages.spec.ts +++ b/specs/resources/packages.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('Packages resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'kappa_82', - length: 5, - width: 1000, - height: 55, - unit_of_length: 'lambda_18', + name: 'sigma_83', + length: 1, + width: 55, + height: 5, + unit_of_length: 'lambda_90', stock_location: cl.stock_locations.relationship(TestData.id), } diff --git a/specs/resources/parcel_line_items.spec.ts b/specs/resources/parcel_line_items.spec.ts index 9a8f24da..5a24f575 100644 --- a/specs/resources/parcel_line_items.spec.ts +++ b/specs/resources/parcel_line_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ParcelLineItems resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 555, + quantity: 12345, parcel: cl.parcels.relationship(TestData.id), stock_line_item: cl.stock_line_items.relationship(TestData.id), } diff --git a/specs/resources/parcels.spec.ts b/specs/resources/parcels.spec.ts index 0a2b0755..c923d20f 100644 --- a/specs/resources/parcels.spec.ts +++ b/specs/resources/parcels.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/payment_gateways.spec.ts b/specs/resources/payment_gateways.spec.ts index 5d563c80..763e6645 100644 --- a/specs/resources/payment_gateways.spec.ts +++ b/specs/resources/payment_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/payment_methods.spec.ts b/specs/resources/payment_methods.spec.ts index 13316a67..77e814a4 100644 --- a/specs/resources/payment_methods.spec.ts +++ b/specs/resources/payment_methods.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('PaymentMethods resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - payment_source_type: 'alfa_51', - price_amount_cents: 12345, + payment_source_type: 'omega_94', + price_amount_cents: 5, market: cl.markets.relationship(TestData.id), payment_gateway: cl.payment_gateways.relationship(TestData.id), } diff --git a/specs/resources/paypal_gateways.spec.ts b/specs/resources/paypal_gateways.spec.ts index 4c20fad7..7bbe89ee 100644 --- a/specs/resources/paypal_gateways.spec.ts +++ b/specs/resources/paypal_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,10 +25,10 @@ describe('PaypalGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'beta_63', - client_id: 'omega_93', - client_secret: 'alfa_53', - mode: 'beta_72', + name: 'alfa_6', + client_id: 'omega_19', + client_secret: 'beta_27', + mode: 'kappa_57', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/paypal_payments.spec.ts b/specs/resources/paypal_payments.spec.ts index 8ee723e6..5ec7b0b6 100644 --- a/specs/resources/paypal_payments.spec.ts +++ b/specs/resources/paypal_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('PaypalPayments resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - return_url: 'sigma_9', - cancel_url: 'gamma_35', + return_url: 'lambda_70', + cancel_url: 'delta_45', order: cl.orders.relationship(TestData.id), } diff --git a/specs/resources/percentage_discount_promotions.spec.ts b/specs/resources/percentage_discount_promotions.spec.ts index d55fa5ca..478a60da 100644 --- a/specs/resources/percentage_discount_promotions.spec.ts +++ b/specs/resources/percentage_discount_promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,11 +25,11 @@ describe('PercentageDiscountPromotions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'lambda_93', - starts_at: 'kappa_9', - expires_at: 'gamma_75', - total_usage_limit: 5, - percentage: 55, + name: 'sigma_53', + starts_at: 'beta_63', + expires_at: 'kappa_82', + total_usage_limit: 1000, + percentage: 5, market: cl.markets.relationship(TestData.id), promotion_rules: [ cl.promotion_rules.relationship(TestData.id) ], order_amount_promotion_rule: cl.order_amount_promotion_rules.relationship(TestData.id), diff --git a/specs/resources/price_lists.spec.ts b/specs/resources/price_lists.spec.ts index 8119c401..cf61b2cb 100644 --- a/specs/resources/price_lists.spec.ts +++ b/specs/resources/price_lists.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('PriceLists resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'sigma_57', - currency_code: 'epsilon_87', + name: 'omega_49', + currency_code: 'delta_45', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/prices.spec.ts b/specs/resources/prices.spec.ts index 99da6fc9..a8dd3cce 100644 --- a/specs/resources/prices.spec.ts +++ b/specs/resources/prices.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('Prices resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - amount_cents: 1, - compare_at_amount_cents: 555, + amount_cents: 100, + compare_at_amount_cents: 1, price_list: cl.price_lists.relationship(TestData.id), sku: cl.skus.relationship(TestData.id), } diff --git a/specs/resources/promotion_rules.spec.ts b/specs/resources/promotion_rules.spec.ts index 86bd9269..8632221f 100644 --- a/specs/resources/promotion_rules.spec.ts +++ b/specs/resources/promotion_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/promotions.spec.ts b/specs/resources/promotions.spec.ts index 4610ec9a..b56523c8 100644 --- a/specs/resources/promotions.spec.ts +++ b/specs/resources/promotions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/refunds.spec.ts b/specs/resources/refunds.spec.ts index 7348b4fa..1cc5cbdf 100644 --- a/specs/resources/refunds.spec.ts +++ b/specs/resources/refunds.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/return_line_items.spec.ts b/specs/resources/return_line_items.spec.ts index 7da8677f..1968bbae 100644 --- a/specs/resources/return_line_items.spec.ts +++ b/specs/resources/return_line_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ReturnLineItems resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 5, + quantity: 0, return: cl.returns.relationship(TestData.id), line_item: cl.line_items.relationship(TestData.id), } diff --git a/specs/resources/returns.spec.ts b/specs/resources/returns.spec.ts index 922dcd92..28413c34 100644 --- a/specs/resources/returns.spec.ts +++ b/specs/resources/returns.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/shipments.spec.ts b/specs/resources/shipments.spec.ts index 2b822ac7..a4f3387a 100644 --- a/specs/resources/shipments.spec.ts +++ b/specs/resources/shipments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/shipping_categories.spec.ts b/specs/resources/shipping_categories.spec.ts index 85a2a303..230cfd97 100644 --- a/specs/resources/shipping_categories.spec.ts +++ b/specs/resources/shipping_categories.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ShippingCategories resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_5', + name: 'gamma_35', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/shipping_methods.spec.ts b/specs/resources/shipping_methods.spec.ts index 99d7a93a..86faf41a 100644 --- a/specs/resources/shipping_methods.spec.ts +++ b/specs/resources/shipping_methods.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('ShippingMethods resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'gamma_32', - price_amount_cents: 12345, + name: 'alfa_82', + price_amount_cents: 55, market: cl.markets.relationship(TestData.id), shipping_zone: cl.shipping_zones.relationship(TestData.id), shipping_category: cl.shipping_categories.relationship(TestData.id), diff --git a/specs/resources/shipping_zones.spec.ts b/specs/resources/shipping_zones.spec.ts index 678e5eeb..16aff82d 100644 --- a/specs/resources/shipping_zones.spec.ts +++ b/specs/resources/shipping_zones.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('ShippingZones resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'kappa_72', + name: 'delta_16', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/sku_list_items.spec.ts b/specs/resources/sku_list_items.spec.ts index 515a72af..05b4747e 100644 --- a/specs/resources/sku_list_items.spec.ts +++ b/specs/resources/sku_list_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/sku_list_promotion_rules.spec.ts b/specs/resources/sku_list_promotion_rules.spec.ts index 0206bb41..7b0ac585 100644 --- a/specs/resources/sku_list_promotion_rules.spec.ts +++ b/specs/resources/sku_list_promotion_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/sku_lists.spec.ts b/specs/resources/sku_lists.spec.ts index 837f7cf4..da0ab0fc 100644 --- a/specs/resources/sku_lists.spec.ts +++ b/specs/resources/sku_lists.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('SkuLists resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_74', + name: 'alfa_89', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/sku_options.spec.ts b/specs/resources/sku_options.spec.ts index 75b8fe57..02e13d4d 100644 --- a/specs/resources/sku_options.spec.ts +++ b/specs/resources/sku_options.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('SkuOptions resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'lambda_61', + name: 'kappa_47', market: cl.markets.relationship(TestData.id), } diff --git a/specs/resources/skus.spec.ts b/specs/resources/skus.spec.ts index d51131ef..ba51e15a 100644 --- a/specs/resources/skus.spec.ts +++ b/specs/resources/skus.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('Skus resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - code: 'omega_93', - name: 'kappa_99', + code: 'beta_87', + name: 'gamma_47', shipping_category: cl.shipping_categories.relationship(TestData.id), } diff --git a/specs/resources/stock_items.spec.ts b/specs/resources/stock_items.spec.ts index 85772d77..92b98844 100644 --- a/specs/resources/stock_items.spec.ts +++ b/specs/resources/stock_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('StockItems resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 0, + quantity: 100, stock_location: cl.stock_locations.relationship(TestData.id), sku: cl.skus.relationship(TestData.id), } diff --git a/specs/resources/stock_line_items.spec.ts b/specs/resources/stock_line_items.spec.ts index 7d95927b..cc1e7355 100644 --- a/specs/resources/stock_line_items.spec.ts +++ b/specs/resources/stock_line_items.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/stock_locations.spec.ts b/specs/resources/stock_locations.spec.ts index 584dce84..4b341367 100644 --- a/specs/resources/stock_locations.spec.ts +++ b/specs/resources/stock_locations.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('StockLocations resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'kappa_47', + name: 'gamma_73', address: cl.addresses.relationship(TestData.id), } diff --git a/specs/resources/stock_transfers.spec.ts b/specs/resources/stock_transfers.spec.ts index e09c4a35..8335c077 100644 --- a/specs/resources/stock_transfers.spec.ts +++ b/specs/resources/stock_transfers.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('StockTransfers resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - quantity: 10, + quantity: 5, sku: cl.skus.relationship(TestData.id), origin_stock_location: cl.stock_locations.relationship(TestData.id), destination_stock_location: cl.stock_locations.relationship(TestData.id), diff --git a/specs/resources/stripe_gateways.spec.ts b/specs/resources/stripe_gateways.spec.ts index 36b2d549..37da9f4e 100644 --- a/specs/resources/stripe_gateways.spec.ts +++ b/specs/resources/stripe_gateways.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('StripeGateways resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'delta_37', - login: 'kappa_66', + name: 'kappa_55', + login: 'delta_0', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/stripe_payments.spec.ts b/specs/resources/stripe_payments.spec.ts index b5c9f588..9aa254af 100644 --- a/specs/resources/stripe_payments.spec.ts +++ b/specs/resources/stripe_payments.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/tax_calculators.spec.ts b/specs/resources/tax_calculators.spec.ts index 17798c67..2f8b4a2b 100644 --- a/specs/resources/tax_calculators.spec.ts +++ b/specs/resources/tax_calculators.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/tax_categories.spec.ts b/specs/resources/tax_categories.spec.ts index 4f28c92a..8b61f327 100644 --- a/specs/resources/tax_categories.spec.ts +++ b/specs/resources/tax_categories.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('TaxCategories resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - code: 'omega_2', + code: 'alfa_73', sku: cl.skus.relationship(TestData.id), tax_calculator: cl.avalara_accounts.relationship(TestData.id), } diff --git a/specs/resources/tax_rules.spec.ts b/specs/resources/tax_rules.spec.ts index 44f7287b..0e0bc168 100644 --- a/specs/resources/tax_rules.spec.ts +++ b/specs/resources/tax_rules.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,7 +25,7 @@ describe('TaxRules resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'lambda_6', + name: 'kappa_76', manual_tax_calculator: cl.manual_tax_calculators.relationship(TestData.id), } diff --git a/specs/resources/taxjar_accounts.spec.ts b/specs/resources/taxjar_accounts.spec.ts index b8a7ee32..87c54aeb 100644 --- a/specs/resources/taxjar_accounts.spec.ts +++ b/specs/resources/taxjar_accounts.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('TaxjarAccounts resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - name: 'omega_13', - api_key: 'epsilon_42', + name: 'kappa_5', + api_key: 'sigma_87', tax_categories: [ cl.tax_categories.relationship(TestData.id) ], } diff --git a/specs/resources/transactions.spec.ts b/specs/resources/transactions.spec.ts index 602adf10..8f7bd48b 100644 --- a/specs/resources/transactions.spec.ts +++ b/specs/resources/transactions.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/voids.spec.ts b/specs/resources/voids.spec.ts index a3250549..15aeb71f 100644 --- a/specs/resources/voids.spec.ts +++ b/specs/resources/voids.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/specs/resources/webhooks.spec.ts b/specs/resources/webhooks.spec.ts index ded5e873..32364da2 100644 --- a/specs/resources/webhooks.spec.ts +++ b/specs/resources/webhooks.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' @@ -25,8 +25,8 @@ describe('Webhooks resource', () => { it(resourceType + '.create', async () => { const createAttributes = { - topic: 'sigma_77', - callback_url: 'sigma_90', + topic: 'alfa_27', + callback_url: 'beta_58', } const attributes = { ...createAttributes, reference: TestData.reference } diff --git a/specs/resources/wire_transfers.spec.ts b/specs/resources/wire_transfers.spec.ts index 435c3419..ff45dda3 100644 --- a/specs/resources/wire_transfers.spec.ts +++ b/specs/resources/wire_transfers.spec.ts @@ -1,6 +1,6 @@ /** * ©2022 Commerce Layer Inc. - * Source code generated automatically by SDK codegen from OpenAPI schema 2.7.6 + * Source code generated automatically by SDK codegen from OpenAPI schema 2.8.0 **/ import { CommerceLayerClient } from '../../src' diff --git a/src/api.ts b/src/api.ts index 8f76e6f6..c12ad2b7 100644 --- a/src/api.ts +++ b/src/api.ts @@ -3,7 +3,7 @@ // ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##' /** * ©2022 Commerce Layer Inc. - * OpenAPI schema, version 2.7.6 + * OpenAPI schema, version 2.8.0 **/ export { default as Addresses } from './resources/addresses' export { default as Adjustments } from './resources/adjustments' @@ -50,6 +50,8 @@ export { default as InStockSubscriptions } from './resources/in_stock_subscripti export { default as InventoryModels } from './resources/inventory_models' export { default as InventoryReturnLocations } from './resources/inventory_return_locations' export { default as InventoryStockLocations } from './resources/inventory_stock_locations' +export { default as KlarnaGateways } from './resources/klarna_gateways' +export { default as KlarnaPayments } from './resources/klarna_payments' export { default as LineItemOptions } from './resources/line_item_options' export { default as LineItems } from './resources/line_items' export { default as ManualGateways } from './resources/manual_gateways' @@ -150,6 +152,8 @@ export type ResourceTypeLock = | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' +| 'klarna_gateways' +| 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' @@ -250,6 +254,8 @@ export const resourceList = [ 'inventory_models', 'inventory_return_locations', 'inventory_stock_locations', + 'klarna_gateways', + 'klarna_payments', 'line_item_options', 'line_items', 'manual_gateways', diff --git a/src/commercelayer.ts b/src/commercelayer.ts index 7430a600..7759eebf 100644 --- a/src/commercelayer.ts +++ b/src/commercelayer.ts @@ -9,7 +9,7 @@ import Debug from './debug' const debug = Debug() -const OPEN_API_SCHEMA_VERSION = '2.7.6' +const OPEN_API_SCHEMA_VERSION = '2.8.0' type SdkConfig = {} @@ -73,6 +73,8 @@ class CommerceLayerClient { inventory_models: api.InventoryModels inventory_return_locations: api.InventoryReturnLocations inventory_stock_locations: api.InventoryStockLocations + klarna_gateways: api.KlarnaGateways + klarna_payments: api.KlarnaPayments line_item_options: api.LineItemOptions line_items: api.LineItems manual_gateways: api.ManualGateways @@ -180,6 +182,8 @@ class CommerceLayerClient { this.inventory_models = new api.InventoryModels(this.#adapter) this.inventory_return_locations = new api.InventoryReturnLocations(this.#adapter) this.inventory_stock_locations = new api.InventoryStockLocations(this.#adapter) + this.klarna_gateways = new api.KlarnaGateways(this.#adapter) + this.klarna_payments = new api.KlarnaPayments(this.#adapter) this.line_item_options = new api.LineItemOptions(this.#adapter) this.line_items = new api.LineItems(this.#adapter) this.manual_gateways = new api.ManualGateways(this.#adapter) diff --git a/src/model.ts b/src/model.ts index ef1e9d83..fce3e654 100644 --- a/src/model.ts +++ b/src/model.ts @@ -3,7 +3,7 @@ // ##__MODEL_TYPES_TEMPLATE:: export type { ##__RESOURCE_MODELS__## } from './resources/##__RESOURCE_TYPE__##' /** * ©2022 Commerce Layer Inc. - * OpenAPI schema, version 2.7.6 + * OpenAPI schema, version 2.8.0 **/ export type { Address, AddressCreate, AddressUpdate } from './resources/addresses' export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments' @@ -50,6 +50,8 @@ export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptio export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models' export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations' export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations' +export type { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } from './resources/klarna_gateways' +export type { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } from './resources/klarna_payments' export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options' export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items' export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways' diff --git a/src/resources/customer_payment_sources.ts b/src/resources/customer_payment_sources.ts index 320c50fe..8da63bf9 100644 --- a/src/resources/customer_payment_sources.ts +++ b/src/resources/customer_payment_sources.ts @@ -6,6 +6,7 @@ import { AdyenPayment } from './adyen_payments' import { BraintreePayment } from './braintree_payments' import { CheckoutComPayment } from './checkout_com_payments' import { ExternalPayment } from './external_payments' +import { KlarnaPayment } from './klarna_payments' import { PaypalPayment } from './paypal_payments' import { StripePayment } from './stripe_payments' import { WireTransfer } from './wire_transfers' @@ -17,6 +18,7 @@ type AdyenPaymentRel = ResourceId & { type: 'adyen_payments' } type BraintreePaymentRel = ResourceId & { type: 'braintree_payments' } type CheckoutComPaymentRel = ResourceId & { type: 'checkout_com_payments' } type ExternalPaymentRel = ResourceId & { type: 'external_payments' } +type KlarnaPaymentRel = ResourceId & { type: 'klarna_payments' } type PaypalPaymentRel = ResourceId & { type: 'paypal_payments' } type StripePaymentRel = ResourceId & { type: 'stripe_payments' } type WireTransferRel = ResourceId & { type: 'wire_transfers' } @@ -29,7 +31,7 @@ interface CustomerPaymentSource extends Resource { payment_source_token?: string customer?: Customer - payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | PaypalPayment | StripePayment | WireTransfer } @@ -37,7 +39,7 @@ interface CustomerPaymentSource extends Resource { interface CustomerPaymentSourceCreate extends ResourceCreate { customer: CustomerRel - payment_source: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel + payment_source: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel } @@ -45,7 +47,7 @@ interface CustomerPaymentSourceCreate extends ResourceCreate { interface CustomerPaymentSourceUpdate extends ResourceUpdate { customer?: CustomerRel - payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel } diff --git a/src/resources/external_gateways.ts b/src/resources/external_gateways.ts index 09422605..6caa57e9 100644 --- a/src/resources/external_gateways.ts +++ b/src/resources/external_gateways.ts @@ -16,6 +16,7 @@ interface ExternalGateway extends Resource { capture_url?: string void_url?: string refund_url?: string + token_url?: string payment_methods?: PaymentMethod[] external_payments?: ExternalPayment[] @@ -30,6 +31,7 @@ interface ExternalGatewayCreate extends ResourceCreate { capture_url?: string void_url?: string refund_url?: string + token_url?: string } @@ -41,6 +43,7 @@ interface ExternalGatewayUpdate extends ResourceUpdate { capture_url?: string void_url?: string refund_url?: string + token_url?: string } diff --git a/src/resources/external_payments.ts b/src/resources/external_payments.ts index 371ad7e3..4a66a49a 100644 --- a/src/resources/external_payments.ts +++ b/src/resources/external_payments.ts @@ -3,6 +3,7 @@ import { /* QueryBuilderRetrieve, QueryBuilderList, */QueryParamsList, QueryPara import { Order } from './orders' import { PaymentGateway } from './payment_gateways' +import { CustomerPaymentSource } from './customer_payment_sources' type ExternalPaymentRel = ResourceId & { type: typeof ExternalPayments.TYPE } @@ -16,6 +17,7 @@ interface ExternalPayment extends Resource { order?: Order payment_gateway?: PaymentGateway + wallet?: CustomerPaymentSource } diff --git a/src/resources/klarna_gateways.ts b/src/resources/klarna_gateways.ts new file mode 100644 index 00000000..28bc7dce --- /dev/null +++ b/src/resources/klarna_gateways.ts @@ -0,0 +1,93 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource' +import { /* QueryBuilderRetrieve, QueryBuilderList, */QueryParamsList, QueryParamsRetrieve } from '../query' + +import { PaymentMethod } from './payment_methods' +import { KlarnaPayment } from './klarna_payments' + + +type KlarnaGatewayRel = ResourceId & { type: typeof KlarnaGateways.TYPE } +type KlarnaPaymentRel = ResourceId & { type: 'klarna_payments' } + + +interface KlarnaGateway extends Resource { + + name?: string + + payment_methods?: PaymentMethod[] + klarna_payments?: KlarnaPayment[] + +} + + +interface KlarnaGatewayCreate extends ResourceCreate { + + name: string + country_code: string + api_key: string + api_secret: string + + klarna_payments?: KlarnaPaymentRel[] + +} + + +interface KlarnaGatewayUpdate extends ResourceUpdate { + + name?: string + country_code?: string + api_key?: string + api_secret?: string + + klarna_payments?: KlarnaPaymentRel[] + +} + + +class KlarnaGateways extends ApiResource { + + static readonly TYPE: 'klarna_gateways' = 'klarna_gateways' + // static readonly PATH = 'klarna_gateways' + + async list(params?: QueryParamsList, options?: ResourcesConfig): Promise> { + return this.resources.list({ type: KlarnaGateways.TYPE }, params, options) + } + + async create(resource: KlarnaGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.create({ ...resource, type: KlarnaGateways.TYPE }, params, options) + } + + async retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.retrieve({ type: KlarnaGateways.TYPE, id }, params, options) + } + + async update(resource: KlarnaGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.update({ ...resource, type: KlarnaGateways.TYPE }, params, options) + } + + async delete(id: string, options?: ResourcesConfig): Promise { + await this.resources.delete({ type: KlarnaGateways.TYPE, id }, options) + } + + + + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + isKlarnaGateway(resource: any): resource is KlarnaGateway { + return resource.type && (resource.type === KlarnaGateways.TYPE) + } + + + relationship(id: string | ResourceId): KlarnaGatewayRel { + return (typeof id === 'string') ? { id, type: KlarnaGateways.TYPE } : { id: id.id, type: KlarnaGateways.TYPE } + } + + + type(): string { + return KlarnaGateways.TYPE + } + +} + + +export default KlarnaGateways + +export { KlarnaGateway, KlarnaGatewayCreate, KlarnaGatewayUpdate } diff --git a/src/resources/klarna_payments.ts b/src/resources/klarna_payments.ts new file mode 100644 index 00000000..606c15ec --- /dev/null +++ b/src/resources/klarna_payments.ts @@ -0,0 +1,89 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource' +import { /* QueryBuilderRetrieve, QueryBuilderList, */QueryParamsList, QueryParamsRetrieve } from '../query' + +import { Order } from './orders' +import { PaymentGateway } from './payment_gateways' + + +type KlarnaPaymentRel = ResourceId & { type: typeof KlarnaPayments.TYPE } +type OrderRel = ResourceId & { type: 'orders' } + + +interface KlarnaPayment extends Resource { + + session_id?: string + client_token?: string + payment_methods?: object[] + auth_token?: string + + order?: Order + payment_gateway?: PaymentGateway + +} + + +interface KlarnaPaymentCreate extends ResourceCreate { + + order: OrderRel + +} + + +interface KlarnaPaymentUpdate extends ResourceUpdate { + + auth_token?: string + _update?: boolean + + order?: OrderRel + +} + + +class KlarnaPayments extends ApiResource { + + static readonly TYPE: 'klarna_payments' = 'klarna_payments' + // static readonly PATH = 'klarna_payments' + + async list(params?: QueryParamsList, options?: ResourcesConfig): Promise> { + return this.resources.list({ type: KlarnaPayments.TYPE }, params, options) + } + + async create(resource: KlarnaPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.create({ ...resource, type: KlarnaPayments.TYPE }, params, options) + } + + async retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.retrieve({ type: KlarnaPayments.TYPE, id }, params, options) + } + + async update(resource: KlarnaPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { + return this.resources.update({ ...resource, type: KlarnaPayments.TYPE }, params, options) + } + + async delete(id: string, options?: ResourcesConfig): Promise { + await this.resources.delete({ type: KlarnaPayments.TYPE, id }, options) + } + + + + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + isKlarnaPayment(resource: any): resource is KlarnaPayment { + return resource.type && (resource.type === KlarnaPayments.TYPE) + } + + + relationship(id: string | ResourceId): KlarnaPaymentRel { + return (typeof id === 'string') ? { id, type: KlarnaPayments.TYPE } : { id: id.id, type: KlarnaPayments.TYPE } + } + + + type(): string { + return KlarnaPayments.TYPE + } + +} + + +export default KlarnaPayments + +export { KlarnaPayment, KlarnaPaymentCreate, KlarnaPaymentUpdate } diff --git a/src/resources/orders.ts b/src/resources/orders.ts index 714b89c3..3d9b52ef 100644 --- a/src/resources/orders.ts +++ b/src/resources/orders.ts @@ -10,6 +10,7 @@ import { AdyenPayment } from './adyen_payments' import { BraintreePayment } from './braintree_payments' import { CheckoutComPayment } from './checkout_com_payments' import { ExternalPayment } from './external_payments' +import { KlarnaPayment } from './klarna_payments' import { PaypalPayment } from './paypal_payments' import { StripePayment } from './stripe_payments' import { WireTransfer } from './wire_transfers' @@ -33,6 +34,7 @@ type AdyenPaymentRel = ResourceId & { type: 'adyen_payments' } type BraintreePaymentRel = ResourceId & { type: 'braintree_payments' } type CheckoutComPaymentRel = ResourceId & { type: 'checkout_com_payments' } type ExternalPaymentRel = ResourceId & { type: 'external_payments' } +type KlarnaPaymentRel = ResourceId & { type: 'klarna_payments' } type PaypalPaymentRel = ResourceId & { type: 'paypal_payments' } type StripePaymentRel = ResourceId & { type: 'stripe_payments' } type WireTransferRel = ResourceId & { type: 'wire_transfers' } @@ -145,7 +147,7 @@ interface Order extends Resource { available_payment_methods?: PaymentMethod[] available_customer_payment_sources?: CustomerPaymentSource[] payment_method?: PaymentMethod - payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | PaypalPayment | StripePayment | WireTransfer line_items?: LineItem[] shipments?: Shipment[] transactions?: (Authorization | Void | Capture | Refund)[] @@ -181,7 +183,7 @@ interface OrderCreate extends ResourceCreate { shipping_address?: AddressRel billing_address?: AddressRel payment_method?: PaymentMethodRel - payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel } @@ -227,7 +229,7 @@ interface OrderUpdate extends ResourceUpdate { shipping_address?: AddressRel billing_address?: AddressRel payment_method?: PaymentMethodRel - payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel }