Skip to content

Conversation

@younGihan
Copy link
Contributor

added terraform provider endpoint for payment methods including resource creation, deletion and data reads

@younGihan younGihan requested a review from Copilot November 19, 2025 11:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive Terraform provider support for payment method resources, enabling users to manage payment methods through infrastructure-as-code. The implementation follows the established pattern used for other resources in the provider.

Key Changes:

  • Added payment method resource with full CRUD operations (Create, Read, Update, Delete)
  • Implemented payment method data source for querying existing payment methods
  • Integrated payment method endpoints into the provider client

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/provider/provider.go Registered payment method resource and data source with the provider
internal/provider/payment_method_resource.go Complete payment method resource implementation with CRUD operations and import support
internal/provider/payment_method_data_source.go Data source implementation for reading payment methods
client/payment_method.go HTTP client methods for payment method API operations
client/client.go Added payment methods endpoint to the API client configuration
examples/resources/meshstack_payment_method/resource.tf Example Terraform configuration for creating payment methods
examples/resources/meshstack_payment_method/import.sh Example import command demonstrating import syntax
examples/data-sources/meshstack_payment_method/data-source.tf Example Terraform configuration for data source usage
docs/resources/payment_method.md Generated documentation for the payment method resource
docs/data-sources/payment_method.md Generated documentation for the payment method data source

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@younGihan younGihan requested review from j0g3sc and nroi November 19, 2025 11:38
@nroi nroi removed the request for review from j0g3sc November 19, 2025 14:15
Copy link
Contributor

@nroi nroi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a few comments and also found a bug unfortunately, but perhaps it's a valid approach to merge it now and fix the API at a later point? we can also discuss this via slack.


spec = {
display_name = "My Payment Method"
expiration_date = "2025-12-31T23:59:59Z"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f: I tried it locally with this expiration date, and it didn't work. looks like you need specify the date only:

Suggested change
expiration_date = "2025-12-31T23:59:59Z"
expiration_date = "2025-12-31"
Image

Comment on lines 18 to 19
Country = ["US"]
Type = ["production"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d: the tags seem to be set a bit arbitrarily. What's a "production" payment method? 😄 perhaps there are other tags that reflect more closely how customers use meshStack in production (maybe a costCenter tag?)


spec = {
display_name = "My Payment Method"
expiration_date = "2025-12-31T23:59:59Z"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f: see my other comment about the expiration date, afaik this will be automatically fixed when you fix it in the examples directory. Just double check that this markdown file is then also fixed.


type MeshPaymentMethodSpec struct {
DisplayName string `json:"displayName" tfsdk:"display_name"`
ExpirationDate *string `json:"expirationDate,omitempty" tfsdk:"expiration_date"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d: one issue I've noticed is the following:
when you use the terraform provider to first create a payment method with an expiration date, and then remove it, you run into an error (see screenshot). But the problem imho is not the terraform provider, it's the API design. The expiration date is nullable in our meshPaymentMethod model, and if the expiration date is null in an update request, we just ignore it completely (instead of setting the expiration date to null).

imho this has to be fixed by introducing a new meshPaymentMethod version with proper null handling, meaning, nullable properties like tags, amount and expirationDate are explicitly set to null if they're null in the request.

Image Image Image

@younGihan younGihan merged commit 7c30e82 into main Nov 24, 2025
16 checks passed
@younGihan younGihan deleted the feature/adding-payment-method branch November 24, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants