diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6e4ec75..82de0c684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ | SumGrandTotalWithGiftCards() | GrandTotalWithGiftCards | | - | GrandTotalNetWithGiftCards | +**checkout** +* Add possibility to have additional data in `PaymentFlowActionTriggerClientSDK` ## v3.5.0 **general** diff --git a/checkout/application/placeorder/validate_payment.go b/checkout/application/placeorder/validate_payment.go index cda9c8bf5..70f3ab8df 100644 --- a/checkout/application/placeorder/validate_payment.go +++ b/checkout/application/placeorder/validate_payment.go @@ -86,7 +86,7 @@ func PaymentValidator(ctx context.Context, p *process.Process, paymentService *a Failed: process.PaymentErrorOccurredReason{Error: ValidatePaymentErrorNoActionURL}, } } - p.UpdateState(states.TriggerClientSDK{}.Name(), states.NewTriggerClientSDKStateData(flowStatus.ActionData.URL)) + p.UpdateState(states.TriggerClientSDK{}.Name(), states.NewTriggerClientSDKStateData(flowStatus.ActionData.URL, flowStatus.ActionData.DisplayData)) default: return process.RunResult{ Failed: process.PaymentErrorOccurredReason{Error: fmt.Sprintf("Payment action not supported: %q", flowStatus.Action)}, diff --git a/checkout/application/placeorder/validate_payment_test.go b/checkout/application/placeorder/validate_payment_test.go index 08976b304..2125ba1ad 100644 --- a/checkout/application/placeorder/validate_payment_test.go +++ b/checkout/application/placeorder/validate_payment_test.go @@ -184,14 +184,18 @@ func TestPaymentValidator(t *testing.T) { Status: domain.PaymentFlowStatusUnapproved, Action: domain.PaymentFlowActionTriggerClientSDK, ActionData: domain.FlowActionData{ - URL: &url.URL{Scheme: "https", Host: "redirect-url.com"}, + URL: &url.URL{Scheme: "https", Host: "redirect-url.com"}, + DisplayData: `{"foo": "bar"}`, }, }, }, want: want{ runResult: process.RunResult{Failed: nil}, state: states.TriggerClientSDK{}.Name(), - stateData: process.StateData(&url.URL{Scheme: "https", Host: "redirect-url.com"}), + stateData: process.StateData(states.TriggerClientSDKData{ + URL: &url.URL{Scheme: "https", Host: "redirect-url.com"}, + Data: `{"foo": "bar"}`, + }), }, }, { diff --git a/checkout/domain/placeorder/states/trigger_client_sdk.go b/checkout/domain/placeorder/states/trigger_client_sdk.go index 2c70ad919..a82e0f652 100644 --- a/checkout/domain/placeorder/states/trigger_client_sdk.go +++ b/checkout/domain/placeorder/states/trigger_client_sdk.go @@ -16,17 +16,26 @@ type ( paymentService *application.PaymentService validator process.PaymentValidatorFunc } + + // TriggerClientSDKData holds the data which must be sent to the client via SDK + TriggerClientSDKData struct { + URL *url.URL + Data string + } ) var _ process.State = TriggerClientSDK{} func init() { - gob.Register(&url.URL{}) + gob.Register(TriggerClientSDKData{}) } // NewTriggerClientSDKStateData creates data required for this state -func NewTriggerClientSDKStateData(url *url.URL) process.StateData { - return process.StateData(url) +func NewTriggerClientSDKStateData(url *url.URL, data string) process.StateData { + return process.StateData(TriggerClientSDKData{ + URL: url, + Data: data, + }) } // Inject dependencies @@ -54,7 +63,7 @@ func (r TriggerClientSDK) Run(ctx context.Context, p *process.Process) process.R } // Rollback the state operations -func (r TriggerClientSDK) Rollback(ctx context.Context, _ process.RollbackData) error { +func (r TriggerClientSDK) Rollback(_ context.Context, _ process.RollbackData) error { return nil } diff --git a/checkout/domain/placeorder/states/trigger_client_sdk_test.go b/checkout/domain/placeorder/states/trigger_client_sdk_test.go index 4cb9f97bf..fe5039602 100644 --- a/checkout/domain/placeorder/states/trigger_client_sdk_test.go +++ b/checkout/domain/placeorder/states/trigger_client_sdk_test.go @@ -40,5 +40,7 @@ func TestTriggerClientSDK_Run(t *testing.T) { } func TestNewTriggerClientSDKStateData(t *testing.T) { - assert.Equal(t, process.StateData(&url.URL{Host: "test.com"}), states.NewTriggerClientSDKStateData(&url.URL{Host: "test.com"})) + assert.Equal(t, + process.StateData(states.TriggerClientSDKData{URL: &url.URL{Host: "test.com"}, Data: "data"}), + states.NewTriggerClientSDKStateData(&url.URL{Host: "test.com"}, "data")) } diff --git a/checkout/interfaces/graphql/dto/states.go b/checkout/interfaces/graphql/dto/states.go index 5a776afef..7e318a072 100644 --- a/checkout/interfaces/graphql/dto/states.go +++ b/checkout/interfaces/graphql/dto/states.go @@ -77,6 +77,7 @@ type ( TriggerClientSDK struct { Name string URL string + Data string } // PaymentRequestAPI holds all data needed to create a PaymentRequest @@ -192,8 +193,9 @@ func (s *PostRedirect) MapFrom(pctx process.Context) { // MapFrom the internal process state to the graphQL state fields func (t *TriggerClientSDK) MapFrom(pctx process.Context) { t.Name = pctx.CurrentStateName - if stateData, ok := pctx.CurrentStateData.(*url.URL); ok { - t.URL = stateData.String() + if stateData, ok := pctx.CurrentStateData.(states.TriggerClientSDKData); ok { + t.URL = stateData.URL.String() + t.Data = stateData.Data } } diff --git a/checkout/interfaces/graphql/schema.graphql b/checkout/interfaces/graphql/schema.graphql index 07c7e3c4f..fd2c2beb8 100644 --- a/checkout/interfaces/graphql/schema.graphql +++ b/checkout/interfaces/graphql/schema.graphql @@ -69,6 +69,7 @@ type Commerce_Checkout_PlaceOrderState_State_Redirect implements Commerce_Checko type Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK implements Commerce_Checkout_PlaceOrderState_State { name: String! URL: String! + Data: String! } type Commerce_Checkout_PlaceOrderState_State_ShowWalletPayment implements Commerce_Checkout_PlaceOrderState_State { diff --git a/docs/openapi/docs.go b/docs/openapi/docs.go index fcd3253a8..8b0d5c651 100644 --- a/docs/openapi/docs.go +++ b/docs/openapi/docs.go @@ -1030,7 +1030,7 @@ var doc = `{ "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/paymentResultError" + "$ref": "#/definitions/cartResultError" } } } @@ -1090,47 +1090,34 @@ var doc = `{ } }, "definitions": { - "CategoryAttribute": { + "ProductAttribute": { "type": "object", "properties": { "Code": { + "description": "Code is the internal attribute identifier", + "type": "string" + }, + "CodeLabel": { + "description": "CodeLabel is the human readable (perhaps localized) attribute name", "type": "string" }, "Label": { + "description": "Label is the human readable (perhaps localized) attribute value", "type": "string" }, - "Values": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.AttributeValue" - } + "RawValue": { + "description": "RawValue is the untouched original value of the attribute" + }, + "UnitCode": { + "description": "UnitCode is the internal code of the attribute values measuring unit", + "type": "string" } } }, - "CategoryAttributes": { + "ProductAttributes": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/CategoryAttribute" - } - }, - "ProductMedia": { - "type": "object", - "properties": { - "MimeType": { - "type": "string" - }, - "Reference": { - "type": "string" - }, - "Title": { - "type": "string" - }, - "Type": { - "type": "string" - }, - "Usage": { - "type": "string" - } + "$ref": "#/definitions/ProductAttribute" } }, "application.PlaceOrderPaymentInfo": { @@ -1339,6 +1326,14 @@ var doc = `{ "description": "GrandTotal is the final amount that need to be paid by the customer (gross)", "$ref": "#/definitions/domain.Price" }, + "GrandTotalNet": { + "description": "GrandTotalNet is the corresponding net value to GrandTotal", + "$ref": "#/definitions/domain.Price" + }, + "GrandTotalNetWithGiftCards": { + "description": "GrandTotalNetWithGiftCards is the corresponding net value to GrandTotalWithGiftCards", + "$ref": "#/definitions/domain.Price" + }, "GrandTotalWithGiftCards": { "description": "GrandTotalWithGiftCards is the final amount with the applied gift cards subtracted.", "$ref": "#/definitions/domain.Price" @@ -1356,8 +1351,7 @@ var doc = `{ "$ref": "#/definitions/domain.Price" }, "PaymentSelection": { - "description": "PaymentSelection is used to store information on \"how\" the customer wants to pay", - "$ref": "#/definitions/cart.PaymentSelection" + "description": "PaymentSelection is used to store information on \"how\" the customer wants to pay" }, "Purchaser": { "description": "Purchaser hold additional infos for the legal contact person in this order", @@ -1642,9 +1636,6 @@ var doc = `{ } } }, - "cart.PaymentSelection": { - "type": "object" - }, "cart.Person": { "type": "object", "properties": { @@ -1754,6 +1745,17 @@ var doc = `{ } } }, + "cartResultError": { + "type": "object", + "properties": { + "Code": { + "type": "string" + }, + "Message": { + "type": "string" + } + } + }, "checkoutError": { "type": "object", "properties": { @@ -1769,11 +1771,9 @@ var doc = `{ "type": "object", "properties": { "Error": { - "$ref": "#/definitions/paymentResultError" - }, - "Product": { - "$ref": "#/definitions/domain.BasicProduct" + "$ref": "#/definitions/cartResultError" }, + "Product": {}, "Success": { "type": "boolean" } @@ -1788,15 +1788,13 @@ var doc = `{ "CartValidationResult": { "$ref": "#/definitions/validation.Result" }, - "Data": { - "type": "object" - }, + "Data": {}, "DataValidationInfo": { "type": "object" }, "Error": { "description": "Contains details if success is false", - "$ref": "#/definitions/paymentResultError" + "$ref": "#/definitions/cartResultError" }, "Success": { "type": "boolean" @@ -1832,9 +1830,7 @@ var doc = `{ "State": { "type": "string" }, - "StateData": { - "$ref": "#/definitions/process.StateData" - }, + "StateData": {}, "UUID": { "type": "string" } @@ -1891,9 +1887,7 @@ var doc = `{ "Item": { "$ref": "#/definitions/cart.Item" }, - "Product": { - "$ref": "#/definitions/domain.BasicProduct" - } + "Product": {} } }, "decorator.DecoratedDelivery": { @@ -1910,17 +1904,6 @@ var doc = `{ } } }, - "domain.AttributeValue": { - "type": "object", - "properties": { - "Label": { - "type": "string" - }, - "RawValue": { - "type": "object" - } - } - }, "domain.Badge": { "type": "object", "properties": { @@ -1932,9 +1915,6 @@ var doc = `{ } } }, - "domain.BasicProduct": { - "type": "object" - }, "domain.CategoryTeaser": { "type": "object", "properties": { @@ -1996,8 +1976,7 @@ var doc = `{ "$ref": "#/definitions/domain.FlowActionData" }, "Data": { - "description": "Data contains additional information related to the action / flow", - "type": "object" + "description": "Data contains additional information related to the action / flow" }, "Error": { "description": "Error contains additional information in case of an error (e.g. payment failed)", @@ -2061,6 +2040,26 @@ var doc = `{ } } }, + "domain.Media": { + "type": "object", + "properties": { + "MimeType": { + "type": "string" + }, + "Reference": { + "type": "string" + }, + "Title": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Usage": { + "type": "string" + } + } + }, "domain.PaymentRequestAPI": { "type": "object", "properties": { @@ -2149,7 +2148,7 @@ var doc = `{ "$ref": "#/definitions/domain.PriceInfo" }, "Attributes": { - "$ref": "#/definitions/CategoryAttributes" + "$ref": "#/definitions/ProductAttributes" }, "AvailablePrices": { "type": "array", @@ -2219,7 +2218,7 @@ var doc = `{ "Media": { "type": "array", "items": { - "$ref": "#/definitions/ProductMedia" + "$ref": "#/definitions/domain.Media" } }, "RetailerCode": { @@ -2278,7 +2277,7 @@ var doc = `{ "description": "Media", "type": "array", "items": { - "$ref": "#/definitions/ProductMedia" + "$ref": "#/definitions/domain.Media" } }, "PreSelectedVariantSku": { @@ -2329,17 +2328,6 @@ var doc = `{ } } }, - "paymentResultError": { - "type": "object", - "properties": { - "Code": { - "type": "string" - }, - "Message": { - "type": "string" - } - } - }, "placeorder.CreditCardInfo": { "type": "object", "properties": { @@ -2368,9 +2356,6 @@ var doc = `{ } } }, - "process.StateData": { - "type": "object" - }, "validation.ItemValidationError": { "type": "object", "properties": { diff --git a/docs/openapi/swagger.json b/docs/openapi/swagger.json index 0daa4baf5..5bc314cc1 100644 --- a/docs/openapi/swagger.json +++ b/docs/openapi/swagger.json @@ -1014,7 +1014,7 @@ "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/paymentResultError" + "$ref": "#/definitions/cartResultError" } } } @@ -1074,47 +1074,34 @@ } }, "definitions": { - "CategoryAttribute": { + "ProductAttribute": { "type": "object", "properties": { "Code": { + "description": "Code is the internal attribute identifier", + "type": "string" + }, + "CodeLabel": { + "description": "CodeLabel is the human readable (perhaps localized) attribute name", "type": "string" }, "Label": { + "description": "Label is the human readable (perhaps localized) attribute value", "type": "string" }, - "Values": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.AttributeValue" - } + "RawValue": { + "description": "RawValue is the untouched original value of the attribute" + }, + "UnitCode": { + "description": "UnitCode is the internal code of the attribute values measuring unit", + "type": "string" } } }, - "CategoryAttributes": { + "ProductAttributes": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/CategoryAttribute" - } - }, - "ProductMedia": { - "type": "object", - "properties": { - "MimeType": { - "type": "string" - }, - "Reference": { - "type": "string" - }, - "Title": { - "type": "string" - }, - "Type": { - "type": "string" - }, - "Usage": { - "type": "string" - } + "$ref": "#/definitions/ProductAttribute" } }, "application.PlaceOrderPaymentInfo": { @@ -1323,6 +1310,14 @@ "description": "GrandTotal is the final amount that need to be paid by the customer (gross)", "$ref": "#/definitions/domain.Price" }, + "GrandTotalNet": { + "description": "GrandTotalNet is the corresponding net value to GrandTotal", + "$ref": "#/definitions/domain.Price" + }, + "GrandTotalNetWithGiftCards": { + "description": "GrandTotalNetWithGiftCards is the corresponding net value to GrandTotalWithGiftCards", + "$ref": "#/definitions/domain.Price" + }, "GrandTotalWithGiftCards": { "description": "GrandTotalWithGiftCards is the final amount with the applied gift cards subtracted.", "$ref": "#/definitions/domain.Price" @@ -1340,8 +1335,7 @@ "$ref": "#/definitions/domain.Price" }, "PaymentSelection": { - "description": "PaymentSelection is used to store information on \"how\" the customer wants to pay", - "$ref": "#/definitions/cart.PaymentSelection" + "description": "PaymentSelection is used to store information on \"how\" the customer wants to pay" }, "Purchaser": { "description": "Purchaser hold additional infos for the legal contact person in this order", @@ -1626,9 +1620,6 @@ } } }, - "cart.PaymentSelection": { - "type": "object" - }, "cart.Person": { "type": "object", "properties": { @@ -1738,6 +1729,17 @@ } } }, + "cartResultError": { + "type": "object", + "properties": { + "Code": { + "type": "string" + }, + "Message": { + "type": "string" + } + } + }, "checkoutError": { "type": "object", "properties": { @@ -1753,11 +1755,9 @@ "type": "object", "properties": { "Error": { - "$ref": "#/definitions/paymentResultError" - }, - "Product": { - "$ref": "#/definitions/domain.BasicProduct" + "$ref": "#/definitions/cartResultError" }, + "Product": {}, "Success": { "type": "boolean" } @@ -1772,15 +1772,13 @@ "CartValidationResult": { "$ref": "#/definitions/validation.Result" }, - "Data": { - "type": "object" - }, + "Data": {}, "DataValidationInfo": { "type": "object" }, "Error": { "description": "Contains details if success is false", - "$ref": "#/definitions/paymentResultError" + "$ref": "#/definitions/cartResultError" }, "Success": { "type": "boolean" @@ -1816,9 +1814,7 @@ "State": { "type": "string" }, - "StateData": { - "$ref": "#/definitions/process.StateData" - }, + "StateData": {}, "UUID": { "type": "string" } @@ -1875,9 +1871,7 @@ "Item": { "$ref": "#/definitions/cart.Item" }, - "Product": { - "$ref": "#/definitions/domain.BasicProduct" - } + "Product": {} } }, "decorator.DecoratedDelivery": { @@ -1894,17 +1888,6 @@ } } }, - "domain.AttributeValue": { - "type": "object", - "properties": { - "Label": { - "type": "string" - }, - "RawValue": { - "type": "object" - } - } - }, "domain.Badge": { "type": "object", "properties": { @@ -1916,9 +1899,6 @@ } } }, - "domain.BasicProduct": { - "type": "object" - }, "domain.CategoryTeaser": { "type": "object", "properties": { @@ -1980,8 +1960,7 @@ "$ref": "#/definitions/domain.FlowActionData" }, "Data": { - "description": "Data contains additional information related to the action / flow", - "type": "object" + "description": "Data contains additional information related to the action / flow" }, "Error": { "description": "Error contains additional information in case of an error (e.g. payment failed)", @@ -2045,6 +2024,26 @@ } } }, + "domain.Media": { + "type": "object", + "properties": { + "MimeType": { + "type": "string" + }, + "Reference": { + "type": "string" + }, + "Title": { + "type": "string" + }, + "Type": { + "type": "string" + }, + "Usage": { + "type": "string" + } + } + }, "domain.PaymentRequestAPI": { "type": "object", "properties": { @@ -2133,7 +2132,7 @@ "$ref": "#/definitions/domain.PriceInfo" }, "Attributes": { - "$ref": "#/definitions/CategoryAttributes" + "$ref": "#/definitions/ProductAttributes" }, "AvailablePrices": { "type": "array", @@ -2203,7 +2202,7 @@ "Media": { "type": "array", "items": { - "$ref": "#/definitions/ProductMedia" + "$ref": "#/definitions/domain.Media" } }, "RetailerCode": { @@ -2262,7 +2261,7 @@ "description": "Media", "type": "array", "items": { - "$ref": "#/definitions/ProductMedia" + "$ref": "#/definitions/domain.Media" } }, "PreSelectedVariantSku": { @@ -2313,17 +2312,6 @@ } } }, - "paymentResultError": { - "type": "object", - "properties": { - "Code": { - "type": "string" - }, - "Message": { - "type": "string" - } - } - }, "placeorder.CreditCardInfo": { "type": "object", "properties": { @@ -2352,9 +2340,6 @@ } } }, - "process.StateData": { - "type": "object" - }, "validation.ItemValidationError": { "type": "object", "properties": { diff --git a/docs/openapi/swagger.yaml b/docs/openapi/swagger.yaml index 5b9becaa4..159b0f444 100644 --- a/docs/openapi/swagger.yaml +++ b/docs/openapi/swagger.yaml @@ -1,31 +1,26 @@ definitions: - CategoryAttribute: + ProductAttribute: properties: Code: + description: Code is the internal attribute identifier + type: string + CodeLabel: + description: CodeLabel is the human readable (perhaps localized) attribute + name type: string Label: + description: Label is the human readable (perhaps localized) attribute value + type: string + RawValue: + description: RawValue is the untouched original value of the attribute + UnitCode: + description: UnitCode is the internal code of the attribute values measuring + unit type: string - Values: - items: - $ref: '#/definitions/domain.AttributeValue' - type: array type: object - CategoryAttributes: + ProductAttributes: additionalProperties: - $ref: '#/definitions/CategoryAttribute' - type: object - ProductMedia: - properties: - MimeType: - type: string - Reference: - type: string - Title: - type: string - Type: - type: string - Usage: - type: string + $ref: '#/definitions/ProductAttribute' type: object application.PlaceOrderPaymentInfo: properties: @@ -178,6 +173,13 @@ definitions: $ref: '#/definitions/domain.Price' description: GrandTotal is the final amount that need to be paid by the customer (gross) + GrandTotalNet: + $ref: '#/definitions/domain.Price' + description: GrandTotalNet is the corresponding net value to GrandTotal + GrandTotalNetWithGiftCards: + $ref: '#/definitions/domain.Price' + description: GrandTotalNetWithGiftCards is the corresponding net value to + GrandTotalWithGiftCards GrandTotalWithGiftCards: $ref: '#/definitions/domain.Price' description: GrandTotalWithGiftCards is the final amount with the applied @@ -194,7 +196,6 @@ definitions: description: NonItemRelatedDiscountAmount is the sum of discounts that are not related to the item (including shipping discounts) PaymentSelection: - $ref: '#/definitions/cart.PaymentSelection' description: PaymentSelection is used to store information on "how" the customer wants to pay Purchaser: @@ -443,8 +444,6 @@ definitions: description: VariantMarketPlaceCode is used for Configurable products type: string type: object - cart.PaymentSelection: - type: object cart.Person: properties: Address: @@ -517,6 +516,13 @@ definitions: Type: type: string type: object + cartResultError: + properties: + Code: + type: string + Message: + type: string + type: object checkoutError: properties: Code: @@ -527,9 +533,8 @@ definitions: controller.APIResult: properties: Error: - $ref: '#/definitions/paymentResultError' - Product: - $ref: '#/definitions/domain.BasicProduct' + $ref: '#/definitions/cartResultError' + Product: {} Success: type: boolean type: object @@ -539,12 +544,11 @@ definitions: $ref: '#/definitions/cart.Teaser' CartValidationResult: $ref: '#/definitions/validation.Result' - Data: - type: object + Data: {} DataValidationInfo: type: object Error: - $ref: '#/definitions/paymentResultError' + $ref: '#/definitions/cartResultError' description: Contains details if success is false Success: type: boolean @@ -568,8 +572,7 @@ definitions: $ref: '#/definitions/controller.placedOrderInfos' State: type: string - StateData: - $ref: '#/definitions/process.StateData' + StateData: {} UUID: type: string type: object @@ -606,8 +609,7 @@ definitions: properties: Item: $ref: '#/definitions/cart.Item' - Product: - $ref: '#/definitions/domain.BasicProduct' + Product: {} type: object decorator.DecoratedDelivery: properties: @@ -618,13 +620,6 @@ definitions: Delivery: $ref: '#/definitions/cart.Delivery' type: object - domain.AttributeValue: - properties: - Label: - type: string - RawValue: - type: object - type: object domain.Badge: properties: Code: @@ -632,8 +627,6 @@ definitions: Label: type: string type: object - domain.BasicProduct: - type: object domain.CategoryTeaser: properties: Code: @@ -682,7 +675,6 @@ definitions: Data: description: Data contains additional information related to the action / flow - type: object Error: $ref: '#/definitions/domain.Error' description: Error contains additional information in case of an error (e.g. @@ -726,6 +718,19 @@ definitions: description: Type or Name of the Loyalty program type: string type: object + domain.Media: + properties: + MimeType: + type: string + Reference: + type: string + Title: + type: string + Type: + type: string + Usage: + type: string + type: object domain.PaymentRequestAPI: properties: CompleteURL: @@ -784,7 +789,7 @@ definitions: ActivePrice: $ref: '#/definitions/domain.PriceInfo' Attributes: - $ref: '#/definitions/CategoryAttributes' + $ref: '#/definitions/ProductAttributes' AvailablePrices: items: $ref: '#/definitions/domain.PriceInfo' @@ -833,7 +838,7 @@ definitions: type: string Media: items: - $ref: '#/definitions/ProductMedia' + $ref: '#/definitions/domain.Media' type: array RetailerCode: type: string @@ -873,7 +878,7 @@ definitions: Media: description: Media items: - $ref: '#/definitions/ProductMedia' + $ref: '#/definitions/domain.Media' type: array PreSelectedVariantSku: description: PreSelectedVariantSku might be set for configurables to give @@ -914,13 +919,6 @@ definitions: UsedPaymentMethod: type: string type: object - paymentResultError: - properties: - Code: - type: string - Message: - type: string - type: object placeorder.CreditCardInfo: properties: AnonymizedCardNumber: @@ -939,8 +937,6 @@ definitions: OrderNumber: type: string type: object - process.StateData: - type: object validation.ItemValidationError: properties: ErrorMessageKey: @@ -1635,7 +1631,7 @@ paths: "500": description: Internal Server Error schema: - $ref: '#/definitions/paymentResultError' + $ref: '#/definitions/cartResultError' summary: Get the payment status of current cart (or last placed cart) tags: - Payment diff --git a/test/integrationtest/projecttest/graphql/generated.go b/test/integrationtest/projecttest/graphql/generated.go index b3533806a..0007b7431 100644 --- a/test/integrationtest/projecttest/graphql/generated.go +++ b/test/integrationtest/projecttest/graphql/generated.go @@ -573,6 +573,7 @@ type ComplexityRoot struct { } CommerceCheckoutPlaceOrderStateStateTriggerClientSdk struct { + Data func(childComplexity int) int Name func(childComplexity int) int URL func(childComplexity int) int } @@ -3220,6 +3221,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.CommerceCheckoutPlaceOrderStateStateSuccess.Name(childComplexity), true + case "Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK.Data": + if e.complexity.CommerceCheckoutPlaceOrderStateStateTriggerClientSdk.Data == nil { + break + } + + return e.complexity.CommerceCheckoutPlaceOrderStateStateTriggerClientSdk.Data(childComplexity), true + case "Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK.name": if e.complexity.CommerceCheckoutPlaceOrderStateStateTriggerClientSdk.Name == nil { break @@ -6256,6 +6264,7 @@ type Commerce_Checkout_PlaceOrderState_State_Redirect implements Commerce_Checko type Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK implements Commerce_Checkout_PlaceOrderState_State { name: String! URL: String! + Data: String! } type Commerce_Checkout_PlaceOrderState_State_ShowWalletPayment implements Commerce_Checkout_PlaceOrderState_State { @@ -16788,6 +16797,38 @@ func (ec *executionContext) _Commerce_Checkout_PlaceOrderState_State_TriggerClie return ec.marshalNString2string(ctx, field.Selections, res) } +func (ec *executionContext) _Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK_Data(ctx context.Context, field graphql.CollectedField, obj *dto1.TriggerClientSDK) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Data, nil + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + func (ec *executionContext) _Commerce_Checkout_PlaceOrderState_State_Wait_name(ctx context.Context, field graphql.CollectedField, obj *dto1.Wait) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -29441,6 +29482,11 @@ func (ec *executionContext) _Commerce_Checkout_PlaceOrderState_State_TriggerClie if out.Values[i] == graphql.Null { invalids++ } + case "Data": + out.Values[i] = ec._Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK_Data(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } diff --git a/test/integrationtest/projecttest/graphql/schema/flamingo.me_flamingo-commerce_v3_checkout_interfaces_graphql-Service.graphql b/test/integrationtest/projecttest/graphql/schema/flamingo.me_flamingo-commerce_v3_checkout_interfaces_graphql-Service.graphql index 07c7e3c4f..fd2c2beb8 100644 --- a/test/integrationtest/projecttest/graphql/schema/flamingo.me_flamingo-commerce_v3_checkout_interfaces_graphql-Service.graphql +++ b/test/integrationtest/projecttest/graphql/schema/flamingo.me_flamingo-commerce_v3_checkout_interfaces_graphql-Service.graphql @@ -69,6 +69,7 @@ type Commerce_Checkout_PlaceOrderState_State_Redirect implements Commerce_Checko type Commerce_Checkout_PlaceOrderState_State_TriggerClientSDK implements Commerce_Checkout_PlaceOrderState_State { name: String! URL: String! + Data: String! } type Commerce_Checkout_PlaceOrderState_State_ShowWalletPayment implements Commerce_Checkout_PlaceOrderState_State {