Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Used 3.2.0 sdk locally to update resources. (#84)
Browse files Browse the repository at this point in the history
* Used 3.2.0 sdk locally to update resources.

* Updated from v0.0.2 to v0.0.3 for go-commercelayer-sdk

* updated terraform resources for adyen gateway + payment method
  • Loading branch information
incentrotolgaakyazi authored Feb 1, 2023
1 parent 579fc55 commit 09901ee
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 73 deletions.
4 changes: 2 additions & 2 deletions commercelayer/resource_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func resourceAddressCreateFunc(ctx context.Context, d *schema.ResourceData, i in

geocoderId := stringRef(relationships["geocoder_id"])
if geocoderId != nil {
addressCreate.Data.Relationships.Geocoder = &commercelayer.AddressDataRelationshipsGeocoder{
addressCreate.Data.Relationships.Geocoder = &commercelayer.AddressCreateDataRelationshipsGeocoder{
Data: commercelayer.AddressDataRelationshipsGeocoderData{
Type: stringRef(geocoderType),
Id: stringRef(geocoderId),
Expand Down Expand Up @@ -286,7 +286,7 @@ func resourceAddressUpdateFunc(ctx context.Context, d *schema.ResourceData, i in

geocoderId := stringRef(relationships["geocoder_id"])
if geocoderId != nil {
addressUpdate.Data.Relationships.Geocoder = &commercelayer.AddressDataRelationshipsGeocoder{
addressUpdate.Data.Relationships.Geocoder = &commercelayer.AddressCreateDataRelationshipsGeocoder{
Data: commercelayer.AddressDataRelationshipsGeocoderData{
Type: stringRef(geocoderType),
Id: geocoderId,
Expand Down
22 changes: 12 additions & 10 deletions commercelayer/resource_delivery_lead_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ func resourceDeliveryLeadTimesCreateFunc(ctx context.Context, d *schema.Resource
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.DeliveryLeadTimeCreateDataRelationships{
StockLocation: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
StockLocation: commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
}},
ShippingMethod: commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethod{Data: commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethodData{
Type: stringRef(shippingMethodType),
Id: stringRef(relationships["shipping_method_id"]),
}},
ShippingMethod: commercelayer.DeliveryLeadTimeCreateDataRelationshipsShippingMethod{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethodData{
Type: stringRef(shippingMethodType),
Id: stringRef(relationships["shipping_method_id"]),
}},
},
},
}
Expand Down Expand Up @@ -185,15 +186,16 @@ func resourceDeliveryLeadTimesUpdateFunc(ctx context.Context, d *schema.Resource
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.DeliveryLeadTimeUpdateDataRelationships{
StockLocation: &commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
StockLocation: &commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
}},
ShippingMethod: &commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethod{Data: commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethodData{
Type: stringRef(shippingMethodType),
Id: stringRef(relationships["shipping_method_id"]),
}},
ShippingMethod: &commercelayer.DeliveryLeadTimeCreateDataRelationshipsShippingMethod{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsShippingMethodData{
Type: stringRef(shippingMethodType),
Id: stringRef(relationships["shipping_method_id"]),
}},
},
},
}
Expand Down
10 changes: 5 additions & 5 deletions commercelayer/resource_inventory_return_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ func resourceInventoryReturnLocationCreateFunc(ctx context.Context, d *schema.Re
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.InventoryReturnLocationCreateDataRelationships{
StockLocation: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
StockLocation: commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
},
},
InventoryModel: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand Down Expand Up @@ -180,14 +180,14 @@ func resourceInventoryReturnLocationUpdateFunc(ctx context.Context, d *schema.Re
ReferenceOrigin: stringRef(attributes["reference_origin"]),
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.InventoryReturnLocationDataRelationships{
StockLocation: &commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
Relationships: &commercelayer.InventoryReturnLocationUpdateDataRelationships{
StockLocation: &commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
},
},
InventoryModel: &commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: &commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand Down
10 changes: 5 additions & 5 deletions commercelayer/resource_inventory_stock_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ func resourceInventoryStockLocationCreateFunc(ctx context.Context, d *schema.Res
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.InventoryReturnLocationCreateDataRelationships{
StockLocation: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
StockLocation: commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
},
},
InventoryModel: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand Down Expand Up @@ -190,14 +190,14 @@ func resourceInventoryStockLocationUpdateFunc(ctx context.Context, d *schema.Res
ReferenceOrigin: stringRef(attributes["reference_origin"]),
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.InventoryReturnLocationDataRelationships{
StockLocation: &commercelayer.DeliveryLeadTimeDataRelationshipsStockLocation{
Relationships: &commercelayer.InventoryReturnLocationUpdateDataRelationships{
StockLocation: &commercelayer.DeliveryLeadTimeCreateDataRelationshipsStockLocation{
Data: commercelayer.DeliveryLeadTimeDataRelationshipsStockLocationData{
Type: stringRef(stockLocationType),
Id: stringRef(relationships["stock_location_id"]),
},
},
InventoryModel: &commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: &commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand Down
20 changes: 10 additions & 10 deletions commercelayer/resource_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ func resourceMarketCreateFunc(ctx context.Context, d *schema.ResourceData, i int
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.MarketCreateDataRelationships{
Merchant: commercelayer.MarketDataRelationshipsMerchant{
Merchant: commercelayer.MarketCreateDataRelationshipsMerchant{
Data: commercelayer.MarketDataRelationshipsMerchantData{
Type: stringRef(merchantType),
Id: stringRef(relationships["merchant_id"]),
},
},
PriceList: commercelayer.MarketDataRelationshipsPriceList{
PriceList: commercelayer.MarketCreateDataRelationshipsPriceList{
Data: commercelayer.MarketDataRelationshipsPriceListData{
Type: stringRef(priceListType),
Id: stringRef(relationships["price_list_id"]),
},
},
InventoryModel: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand All @@ -183,7 +183,7 @@ func resourceMarketCreateFunc(ctx context.Context, d *schema.ResourceData, i int

taxCalculatorId := stringRef(relationships["tax_calculator_id"])
if taxCalculatorId != nil {
marketCreate.Data.Relationships.TaxCalculator = &commercelayer.MarketDataRelationshipsTaxCalculator{
marketCreate.Data.Relationships.TaxCalculator = &commercelayer.MarketCreateDataRelationshipsTaxCalculator{
Data: commercelayer.MarketDataRelationshipsTaxCalculatorData{
Type: stringRef(taxCalculatorType),
Id: taxCalculatorId,
Expand All @@ -192,7 +192,7 @@ func resourceMarketCreateFunc(ctx context.Context, d *schema.ResourceData, i int

customerGroupId := stringRef(relationships["customer_group_id"])
if customerGroupId != nil {
marketCreate.Data.Relationships.CustomerGroup = &commercelayer.CustomerDataRelationshipsCustomerGroup{
marketCreate.Data.Relationships.CustomerGroup = &commercelayer.CustomerCreateDataRelationshipsCustomerGroup{
Data: commercelayer.CustomerDataRelationshipsCustomerGroupData{
Type: stringRef(customerGroupType),
Id: customerGroupId,
Expand Down Expand Up @@ -240,19 +240,19 @@ func resourceMarketUpdateFunc(ctx context.Context, d *schema.ResourceData, i int
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.MarketUpdateDataRelationships{
Merchant: &commercelayer.MarketDataRelationshipsMerchant{
Merchant: &commercelayer.MarketCreateDataRelationshipsMerchant{
Data: commercelayer.MarketDataRelationshipsMerchantData{
Type: stringRef(merchantType),
Id: stringRef(relationships["merchant_id"]),
},
},
PriceList: &commercelayer.MarketDataRelationshipsPriceList{
PriceList: &commercelayer.MarketCreateDataRelationshipsPriceList{
Data: commercelayer.MarketDataRelationshipsPriceListData{
Type: stringRef(priceListType),
Id: stringRef(relationships["price_list_id"]),
},
},
InventoryModel: &commercelayer.InventoryReturnLocationDataRelationshipsInventoryModel{
InventoryModel: &commercelayer.InventoryReturnLocationCreateDataRelationshipsInventoryModel{
Data: commercelayer.InventoryReturnLocationDataRelationshipsInventoryModelData{
Type: stringRef(inventoryModelType),
Id: stringRef(relationships["inventory_model_id"]),
Expand All @@ -264,7 +264,7 @@ func resourceMarketUpdateFunc(ctx context.Context, d *schema.ResourceData, i int

taxCalculatorId := stringRef(relationships["tax_calculator_id"])
if taxCalculatorId != nil {
marketUpdate.Data.Relationships.TaxCalculator = &commercelayer.MarketDataRelationshipsTaxCalculator{
marketUpdate.Data.Relationships.TaxCalculator = &commercelayer.MarketCreateDataRelationshipsTaxCalculator{
Data: commercelayer.MarketDataRelationshipsTaxCalculatorData{
Type: stringRef(taxCalculatorType),
Id: stringRef(taxCalculatorId),
Expand All @@ -273,7 +273,7 @@ func resourceMarketUpdateFunc(ctx context.Context, d *schema.ResourceData, i int

customerGroupId := stringRef(relationships["customer_group_id"])
if customerGroupId != nil {
marketUpdate.Data.Relationships.CustomerGroup = &commercelayer.CustomerDataRelationshipsCustomerGroup{
marketUpdate.Data.Relationships.CustomerGroup = &commercelayer.CustomerCreateDataRelationshipsCustomerGroup{
Data: commercelayer.CustomerDataRelationshipsCustomerGroupData{
Type: stringRef(customerGroupType),
Id: stringRef(customerGroupId),
Expand Down
4 changes: 2 additions & 2 deletions commercelayer/resource_merchant.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func resourceMerchantCreateFunc(ctx context.Context, d *schema.ResourceData, i i
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.MerchantCreateDataRelationships{
Address: commercelayer.BingGeocoderDataRelationshipsAddresses{
Address: commercelayer.CustomerAddressCreateDataRelationshipsAddress{
Data: commercelayer.BingGeocoderDataRelationshipsAddressesData{
Type: stringRef(addressType),
Id: stringRef(relationships["address_id"]),
Expand Down Expand Up @@ -169,7 +169,7 @@ func resourceMerchantUpdateFunc(ctx context.Context, d *schema.ResourceData, i i
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.MerchantUpdateDataRelationships{
Address: &commercelayer.BingGeocoderDataRelationshipsAddresses{
Address: &commercelayer.CustomerAddressCreateDataRelationshipsAddress{
Data: commercelayer.BingGeocoderDataRelationshipsAddressesData{
Type: stringRef(addressType),
Id: stringRef(relationships["address_id"]),
Expand Down
12 changes: 6 additions & 6 deletions commercelayer/resource_payment_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func resourcePaymentMethodCreateFunc(ctx context.Context, d *schema.ResourceData
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.PaymentMethodCreateDataRelationships{
PaymentGateway: commercelayer.AdyenPaymentDataRelationshipsPaymentGateway{
PaymentGateway: commercelayer.PaymentMethodCreateDataRelationshipsPaymentGateway{
Data: commercelayer.AdyenPaymentDataRelationshipsPaymentGatewayData{
Type: stringRef(adyenGatewaysType),
Id: stringRef(relationships["payment_gateway_id"]),
Expand All @@ -162,7 +162,7 @@ func resourcePaymentMethodCreateFunc(ctx context.Context, d *schema.ResourceData

marketId := stringRef(relationships["market_id"])
if marketId != nil {
paymentMethodCreate.Data.Relationships.Market = &commercelayer.AvalaraAccountDataRelationshipsMarkets{
paymentMethodCreate.Data.Relationships.Market = &commercelayer.BillingInfoValidationRuleCreateDataRelationshipsMarket{
Data: commercelayer.AvalaraAccountDataRelationshipsMarketsData{
Type: stringRef(marketType),
Id: marketId,
Expand All @@ -171,7 +171,7 @@ func resourcePaymentMethodCreateFunc(ctx context.Context, d *schema.ResourceData

paymentGatewayId := stringRef(relationships["payment_gateway_id"])
if paymentGatewayId != nil {
paymentMethodCreate.Data.Relationships.PaymentGateway = commercelayer.AdyenPaymentDataRelationshipsPaymentGateway{
paymentMethodCreate.Data.Relationships.PaymentGateway = commercelayer.PaymentMethodCreateDataRelationshipsPaymentGateway{
Data: commercelayer.AdyenPaymentDataRelationshipsPaymentGatewayData{
Type: stringRef(paymentGatewayType),
Id: paymentGatewayId,
Expand Down Expand Up @@ -220,7 +220,7 @@ func resourcePaymentMethodUpdateFunc(ctx context.Context, d *schema.ResourceData
Metadata: keyValueRef(attributes["metadata"]),
},
Relationships: &commercelayer.PaymentMethodUpdateDataRelationships{
PaymentGateway: &commercelayer.AdyenPaymentDataRelationshipsPaymentGateway{
PaymentGateway: &commercelayer.PaymentMethodCreateDataRelationshipsPaymentGateway{
Data: commercelayer.AdyenPaymentDataRelationshipsPaymentGatewayData{
Type: stringRef(adyenGatewaysType),
Id: stringRef(relationships["payment_gateway_id"]),
Expand All @@ -232,7 +232,7 @@ func resourcePaymentMethodUpdateFunc(ctx context.Context, d *schema.ResourceData

marketId := stringRef(relationships["market_id"])
if marketId != nil {
paymentMethodUpdate.Data.Relationships.Market = &commercelayer.AvalaraAccountDataRelationshipsMarkets{
paymentMethodUpdate.Data.Relationships.Market = &commercelayer.BillingInfoValidationRuleCreateDataRelationshipsMarket{
Data: commercelayer.AvalaraAccountDataRelationshipsMarketsData{
Type: stringRef(marketType),
Id: marketId,
Expand All @@ -242,7 +242,7 @@ func resourcePaymentMethodUpdateFunc(ctx context.Context, d *schema.ResourceData
paymentGatewayId := stringRef(relationships["payment_gateway_id"])
if paymentGatewayId != nil {
paymentMethodUpdate.Data.Relationships.PaymentGateway =
&commercelayer.AdyenPaymentDataRelationshipsPaymentGateway{
&commercelayer.PaymentMethodCreateDataRelationshipsPaymentGateway{
Data: commercelayer.AdyenPaymentDataRelationshipsPaymentGatewayData{
Type: stringRef(paymentGatewayType),
Id: paymentGatewayId,
Expand Down
Loading

0 comments on commit 09901ee

Please sign in to comment.