Skip to content

Commit

Permalink
Remove Credit Card
Browse files Browse the repository at this point in the history
  • Loading branch information
MNThomson committed Aug 24, 2022
1 parent 0e2dedb commit 184f5cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 56 deletions.
9 changes: 1 addition & 8 deletions examples/example.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
dominos = {
source = "MNThomson/dominos"
source = "MNThomson/dominos"
}
}
}
Expand All @@ -11,13 +11,6 @@ provider "dominos" {
last_name = "Name"
email_address = "my@name.com"
phone_number = "15555555555"

credit_card = {
number = 123456789101112
cvv = 1314
date = "15/16"
postal_code = "18192"
}
}

data "dominos_address" "addr" {
Expand Down
52 changes: 4 additions & 48 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,10 @@ type dominosProvider struct {
}

type providerData struct {
FirstName types.String `tfsdk:"first_name"`
LastName types.String `tfsdk:"last_name"`
EmailAddr types.String `tfsdk:"email_address"`
PhoneNumber types.String `tfsdk:"phone_number"`
CreditCard *creditCardData `tfsdk:"credit_card"`
}

type creditCardData struct {
CreditCardNumber types.Int64 `tfsdk:"number"`
Cvv types.Int64 `tfsdk:"cvv"`
ExprDate types.String `tfsdk:"date"`
PostalCode types.String `tfsdk:"postal_code"`
CardType types.String `tfsdk:"card_type"`
FirstName types.String `tfsdk:"first_name"`
LastName types.String `tfsdk:"last_name"`
EmailAddr types.String `tfsdk:"email_address"`
PhoneNumber types.String `tfsdk:"phone_number"`
}

func (p *dominosProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
Expand All @@ -61,8 +52,6 @@ func (p *dominosProvider) Configure(ctx context.Context, req provider.ConfigureR
return
}

data.CreditCard.CardType = types.String{Value: string("VISA")}

p.providerdata = data
p.configured = true
}
Expand All @@ -86,7 +75,6 @@ func (p *dominosProvider) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Dia
return tfsdk.Schema{
Description: `
The Dominos provider is used to interact with resources supported by Dominos Pizza.
The provider needs to be configured with a credit card for ordering.
Use the navigation to the right to read about the available resources.
`,
Expand All @@ -111,38 +99,6 @@ Use the navigation to the right to read about the available resources.
Required: true,
Type: types.StringType,
},
"credit_card": {
Description: "Your actual credit card THAT WILL GET CHARGED.",
Optional: true,
Sensitive: true,
Attributes: tfsdk.SingleNestedAttributes(map[string]tfsdk.Attribute{
"number": {
Description: "The credit card number.",
Type: types.Int64Type,
Required: true,
},
"cvv": {
Description: "The credit card CVV.",
Type: types.Int64Type,
Required: true,
},
"date": {
Description: "The credit card expiration date.",
Type: types.StringType,
Required: true,
},
"postal_code": {
Description: "The postal code attached to the credit card.",
Type: types.StringType,
Required: true,
},
"card_type": {
Description: "The credit card type. Default: 'VISA'.",
Type: types.StringType,
Optional: true,
},
}),
},
},
}, nil
}
Expand Down

0 comments on commit 184f5cb

Please sign in to comment.