github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/payments/CreatePaymentDisputeExample.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/dispute" 11 ) 12 13 func createPaymentDisputeExample() { 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 functions newInt64 and newString to overcome this issue. 22 // http://stackoverflow.com/a/30716481 lists a few more alternatives. 23 // The code for these helper functions can be found in file Helper.go 24 25 var amountOfMoney definitions.AmountOfMoney 26 amountOfMoney.Amount = newInt64(1234) 27 amountOfMoney.CurrencyCode = newString("USD") 28 29 var body dispute.CreateRequest 30 body.AmountOfMoney = &amountOfMoney 31 body.ContactPerson = newString("Wile Coyote") 32 body.EmailAddress = newString("wile.e.coyote@acmelabs.com") 33 body.ReplyTo = newString("r.runner@acmelabs.com") 34 body.RequestMessage = newString("This is the message from the merchant to GlobalCollect. It is a a freeform text field.") 35 36 response, err := client.Merchant("merchantId").Payments().Dispute("paymentId", body, nil) 37 38 fmt.Println(response, err) 39 }