github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/disputes/UploadDisputeFileExample.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  	"os"
     9  
    10  	"github.com/Ingenico-ePayments/connect-sdk-go/communicator/communication"
    11  	"github.com/Ingenico-ePayments/connect-sdk-go/merchant/disputes"
    12  )
    13  
    14  func uploadDisputeFileExample() {
    15  	client, clientErr := getClient()
    16  	if clientErr != nil {
    17  		panic(clientErr)
    18  	}
    19  	defer client.Close()
    20  
    21  	var body disputes.UploadFileRequest
    22  	fileContent, _ := os.Open("file.pdf")
    23  	defer fileContent.Close()
    24  	body.File, _ = communication.NewUploadableFile("file.pdf", fileContent, "application/pdf")
    25  
    26  	response, err := client.Merchant("merchantId").Disputes().UploadFile("disputeId", body, nil)
    27  
    28  	fmt.Println(response, err)
    29  }