github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/examples/merchant/installments/GetInstallmentsInfoExample.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/installments"
    11  )
    12  
    13  func getInstallmentsInfoExample() {
    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 newInt32, 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(123)
    27  	amountOfMoney.CurrencyCode = newString("EUR")
    28  
    29  	var body installments.GetInstallmentRequest
    30  	body.AmountOfMoney = &amountOfMoney
    31  	body.Bin = newString("123455")
    32  	body.CountryCode = newString("NL")
    33  	body.PaymentProductID = newInt32(123)
    34  
    35  	response, err := client.Merchant("merchantId").Installments().GetInstallmentsInfo(body, nil)
    36  
    37  	fmt.Println(response, err)
    38  }