github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/hostedmandatemanagements/CreateHostedMandateManagementExample.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/hostedmandatemanagement" 10 ) 11 12 func createHostedMandateManagementExample() { 13 client, clientErr := getClient() 14 if clientErr != nil { 15 panic(clientErr) 16 } 17 defer client.Close() 18 19 // Assigning literals to pointer variables directly is not supported. 20 // The below code uses helper function newString to overcome this issue. 21 // http://stackoverflow.com/a/30716481 lists a few more alternatives. 22 // The code for this helper function can be found in file Helper.go 23 24 var createMandateInfo hostedmandatemanagement.HostedMandateInfo 25 createMandateInfo.CustomerReference = newString("idonthaveareference") 26 createMandateInfo.RecurrenceType = newString("RECURRING") 27 createMandateInfo.SignatureType = newString("UNSIGNED") 28 29 var hostedMandateManagementSpecificInput hostedmandatemanagement.SpecificInput 30 hostedMandateManagementSpecificInput.Locale = newString("fr_FR") 31 hostedMandateManagementSpecificInput.ReturnURL = newString("http://www.example.com") 32 hostedMandateManagementSpecificInput.Variant = newString("101") 33 34 var body hostedmandatemanagement.CreateRequest 35 body.CreateMandateInfo = &createMandateInfo 36 body.HostedMandateManagementSpecificInput = &hostedMandateManagementSpecificInput 37 38 response, err := client.Merchant("merchantId").Hostedmandatemanagements().Create(body, nil) 39 40 fmt.Println(response, err) 41 }