Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retrieving shared secret from external_*_url #10

Closed
robbertstevens opened this issue Nov 22, 2024 · 10 comments
Closed

retrieving shared secret from external_*_url #10

robbertstevens opened this issue Nov 22, 2024 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@robbertstevens
Copy link

Describe the bug

I might be overlooking it, but when I add an external_order_validation_url I do not have a way to retrieve the shared secret.

resource "commercelayer_market" "market" {
  attributes {
    name = "Example"
    external_order_validation_url = "https://example.com/url"
  }
}

Any idea how to do this? Or is this a bug?

@robbertstevens robbertstevens added bug Something isn't working triage Needs triage labels Nov 22, 2024
@demeyerthom
Copy link
Member

Hi @robbertstevens I will take a look!

@demeyerthom demeyerthom removed the triage Needs triage label Nov 26, 2024
@demeyerthom demeyerthom self-assigned this Nov 26, 2024
@robbertstevens
Copy link
Author

Awesome thanks 🙏

@demeyerthom demeyerthom added enhancement New feature or request and removed bug Something isn't working labels Nov 26, 2024
@demeyerthom
Copy link
Member

Hi @robbertstevens Looks like we never added shared_secret as a field. It is only returned from the GET endpoint, not the POST, so I think this was an oversight. Its not a bug, just a missing feature.

If you want you can try picking it up (it should involve adding the field as computed to resource_market.go, and set the attribute during the read).

If I have some time I can also take a look, but that might be at a later stage

@robbertstevens
Copy link
Author

@demeyerthom I can have a go (pun intented) at it tomorrow. No promises though!

@robbertstevens
Copy link
Author

@demeyerthom we did some digging and the open api spec that is used for the commercelayer sdk doesn't have the shared secret. Because of that it doesn't come back in the types of the c.MarketsApi.POSTMarkets(ctx).MarketCreate(marketCreate).Execute()

I couldn't get it to be put in the attributes or in the main schema (like how it's done with the webhooks).

We notified the folk at commercelayer that the api spec is missing the secret. So I think first that has to be updated, then the sdk has to be updated and then the secret value can be added to the terraform provider.

@demeyerthom
Copy link
Member

@robbertstevens Once they have, we can update the sdk no problem. An alternative would be to do a GET on the resource immediately after creation, as I think it is part of the GET response body

@robbertstevens
Copy link
Author

@demeyerthom I've updated the commercelayer sdk

@demeyerthom
Copy link
Member

@robbertstevens merged it back to main. I will wait with a release for your fix

@Bart-Kuipers
Copy link

Hi @demeyerthom I've used your suggestion to do a GET on the market after creation since the CL OpenApi spec has been updated but it still doesn't include the shared_secret as part of the POST/markets response: #15

@demeyerthom
Copy link
Member

Check, I will review it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants