github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/products/GetCustomerDetailsExample.go (about)

     1  // This file was auto-generated from the API references found at
     2  // https://epayments-api.developer-ingenico.com/
     3  
     4  package examples
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions"
    10  	"github.com/Ingenico-ePayments/connect-sdk-go/domain/product"
    11  )
    12  
    13  func getCustomerDetailsExample() {
    14  	client, clientErr := getClient()
    15  	if clientErr != nil {
    16  		panic(clientErr)
    17  	}
    18  	defer client.Close()
    19  
    20  	// Assigning literals to pointer variables directly is not supported.
    21  	// The below code uses helper function newString to overcome this issue.
    22  	// http://stackoverflow.com/a/30716481 lists a few more alternatives.
    23  	// The code for this helper function can be found in file Helper.go
    24  
    25  	var values []definitions.KeyValuePair
    26  
    27  	var value1 definitions.KeyValuePair
    28  	value1.Key = newString("fiscalNumber")
    29  	value1.Value = newString("01234567890")
    30  
    31  	values = append(values, value1)
    32  
    33  	var body product.GetCustomerDetailsRequest
    34  	body.CountryCode = newString("SE")
    35  	body.Values = &values
    36  
    37  	response, err := client.Merchant("merchantId").Products().CustomerDetails(9000, body, nil)
    38  
    39  	fmt.Println(response, err)
    40  }