Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Release 2.43.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
IngenicoEPayments committed Oct 16, 2023
1 parent 3bc2216 commit af4dd34
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 1 deletion.
2 changes: 1 addition & 1 deletion communicator/MetaDataProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getPlatformIdentifier() string {
}

const sdkIdentifier = "GoServerSDK/v" + sdkVersion
const sdkVersion = "2.42.0"
const sdkVersion = "2.43.0"
const serverMetaInfoHeader = "X-GCS-ServerMetaInfo"

// NewMetaDataProviderWithBuilder creates a MetaDataProvider with the given MetaDataProviderBuilder
Expand Down
15 changes: 15 additions & 0 deletions domain/hostedcheckout/Frequency.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package hostedcheckout

// Frequency represents class Frequency
type Frequency struct {
Interval *string `json:"interval,omitempty"`
IntervalFrequency *int32 `json:"intervalFrequency,omitempty"`
}

// NewFrequency constructs a new Frequency
func NewFrequency() *Frequency {
return &Frequency{}
}
15 changes: 15 additions & 0 deletions domain/hostedcheckout/RecurringPaymentsData.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package hostedcheckout

// RecurringPaymentsData represents class RecurringPaymentsData
type RecurringPaymentsData struct {
RecurringInterval *Frequency `json:"recurringInterval,omitempty"`
TrialInformation *TrialInformation `json:"trialInformation,omitempty"`
}

// NewRecurringPaymentsData constructs a new RecurringPaymentsData
func NewRecurringPaymentsData() *RecurringPaymentsData {
return &RecurringPaymentsData{}
}
1 change: 1 addition & 0 deletions domain/hostedcheckout/SpecificInput.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type SpecificInput struct {
IsRecurring *bool `json:"isRecurring,omitempty"`
Locale *string `json:"locale,omitempty"`
PaymentProductFilters *PaymentProductFiltersHostedCheckout `json:"paymentProductFilters,omitempty"`
RecurringPaymentsData *RecurringPaymentsData `json:"recurringPaymentsData,omitempty"`
ReturnCancelState *bool `json:"returnCancelState,omitempty"`
ReturnURL *string `json:"returnUrl,omitempty"`
ShowResultPage *bool `json:"showResultPage,omitempty"`
Expand Down
20 changes: 20 additions & 0 deletions domain/hostedcheckout/TrialInformation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package hostedcheckout

import "github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions"

// TrialInformation represents class TrialInformation
type TrialInformation struct {
AmountOfMoneyAfterTrial *definitions.AmountOfMoney `json:"amountOfMoneyAfterTrial,omitempty"`
EndDate *string `json:"endDate,omitempty"`
IsRecurring *bool `json:"isRecurring,omitempty"`
TrialPeriod *TrialPeriod `json:"trialPeriod,omitempty"`
TrialPeriodRecurring *Frequency `json:"trialPeriodRecurring,omitempty"`
}

// NewTrialInformation constructs a new TrialInformation
func NewTrialInformation() *TrialInformation {
return &TrialInformation{}
}
15 changes: 15 additions & 0 deletions domain/hostedcheckout/TrialPeriod.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package hostedcheckout

// TrialPeriod represents class TrialPeriod
type TrialPeriod struct {
Duration *int32 `json:"duration,omitempty"`
Interval *string `json:"interval,omitempty"`
}

// NewTrialPeriod constructs a new TrialPeriod
func NewTrialPeriod() *TrialPeriod {
return &TrialPeriod{}
}
19 changes: 19 additions & 0 deletions domain/installments/GetInstallmentRequest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package installments

import "github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions"

// GetInstallmentRequest represents class GetInstallmentRequest
type GetInstallmentRequest struct {
AmountOfMoney *definitions.AmountOfMoney `json:"amountOfMoney,omitempty"`
Bin *string `json:"bin,omitempty"`
CountryCode *string `json:"countryCode,omitempty"`
PaymentProductID *int32 `json:"paymentProductId,omitempty"`
}

// NewGetInstallmentRequest constructs a new GetInstallmentRequest
func NewGetInstallmentRequest() *GetInstallmentRequest {
return &GetInstallmentRequest{}
}
16 changes: 16 additions & 0 deletions domain/installments/InstallmentDisplayHints.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package installments

// InstallmentDisplayHints represents class InstallmentDisplayHints
type InstallmentDisplayHints struct {
DisplayOrder *int32 `json:"displayOrder,omitempty"`
Label *string `json:"label,omitempty"`
Logo *string `json:"logo,omitempty"`
}

// NewInstallmentDisplayHints constructs a new InstallmentDisplayHints
func NewInstallmentDisplayHints() *InstallmentDisplayHints {
return &InstallmentDisplayHints{}
}
18 changes: 18 additions & 0 deletions domain/installments/InstallmentOptions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package installments

import "github.com/Ingenico-ePayments/connect-sdk-go/domain/payment"

// InstallmentOptions represents class InstallmentOptions
type InstallmentOptions struct {
DisplayHints *InstallmentDisplayHints `json:"displayHints,omitempty"`
ID *string `json:"id,omitempty"`
InstallmentPlans *[]payment.Installments `json:"installmentPlans,omitempty"`
}

// NewInstallmentOptions constructs a new InstallmentOptions
func NewInstallmentOptions() *InstallmentOptions {
return &InstallmentOptions{}
}
14 changes: 14 additions & 0 deletions domain/installments/InstallmentOptionsResponse.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package installments

// InstallmentOptionsResponse represents class InstallmentOptionsResponse
type InstallmentOptionsResponse struct {
InstallmentOptions *[]InstallmentOptions `json:"installmentOptions,omitempty"`
}

// NewInstallmentOptionsResponse constructs a new InstallmentOptionsResponse
func NewInstallmentOptionsResponse() *InstallmentOptionsResponse {
return &InstallmentOptionsResponse{}
}
1 change: 1 addition & 0 deletions domain/payment/Installments.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions"
// Installments represents class Installments
type Installments struct {
AmountOfMoneyPerInstallment *definitions.AmountOfMoney `json:"amountOfMoneyPerInstallment,omitempty"`
AmountOfMoneyTotal *definitions.AmountOfMoney `json:"amountOfMoneyTotal,omitempty"`
FrequencyOfInstallments *string `json:"frequencyOfInstallments,omitempty"`
InstallmentPlanCode *int32 `json:"installmentPlanCode,omitempty"`
InterestRate *string `json:"interestRate,omitempty"`
Expand Down
38 changes: 38 additions & 0 deletions examples/merchant/installments/GetInstallmentsInfoExample.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This file was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package examples

import (
"fmt"

"github.com/Ingenico-ePayments/connect-sdk-go/domain/definitions"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/installments"
)

func getInstallmentsInfoExample() {
client, clientErr := getClient()
if clientErr != nil {
panic(clientErr)
}
defer client.Close()

// Assigning literals to pointer variables directly is not supported.
// The below code uses helper functions newInt32, newInt64 and newString to overcome this issue.
// http://stackoverflow.com/a/30716481 lists a few more alternatives.
// The code for these helper functions can be found in file Helper.go

var amountOfMoney definitions.AmountOfMoney
amountOfMoney.Amount = newInt64(123)
amountOfMoney.CurrencyCode = newString("EUR")

var body installments.GetInstallmentRequest
body.AmountOfMoney = &amountOfMoney
body.Bin = newString("123455")
body.CountryCode = newString("NL")
body.PaymentProductID = newInt32(123)

response, err := client.Merchant("merchantId").Installments().GetInstallmentsInfo(body, nil)

fmt.Println(response, err)
}
51 changes: 51 additions & 0 deletions examples/merchant/installments/Helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package examples

import (
"github.com/Ingenico-ePayments/connect-sdk-go"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/errors"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/payment"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/payout"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/refund"
)

func getClient() (*connectsdk.Client, error) {
apiKeyID := "someKey"
secretAPIKey := "someSecret"

return connectsdk.CreateClient(apiKeyID, secretAPIKey, "Ingenico")
}

func newBool(value bool) *bool {
return &value
}

func newInt32(value int32) *int32 {
return &value
}

func newInt64(value int64) *int64 {
return &value
}

func newString(value string) *string {
return &value
}

func handleDeclinedPayment(paymentResult *payment.CreateResult) {
// handle the result here
}

func handleDeclinedPayout(payoutResult *payout.Result) {
// handle the result here
}

func handleDeclinedRefund(refundResult *refund.Result) {
// handle the result here
}

func handleAPIErrors(errors []errors.APIError) {
// handle the errors here
}
6 changes: 6 additions & 0 deletions merchant/Client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/files"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/hostedcheckouts"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/hostedmandatemanagements"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/installments"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/mandates"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/payments"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/payouts"
Expand Down Expand Up @@ -97,6 +98,11 @@ func (c *Client) Sessions() *sessions.Client {
return sessions.NewClient(c.apiResource, nil)
}

// Installments represents the resource /{merchantId}/installments
func (c *Client) Installments() *installments.Client {
return installments.NewClient(c.apiResource, nil)
}

// Files represents the resource /{merchantId}/files
func (c *Client) Files() *files.Client {
return files.NewClient(c.apiResource, nil)
Expand Down
75 changes: 75 additions & 0 deletions merchant/installments/Client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package installments

import (
"github.com/Ingenico-ePayments/connect-sdk-go/communicator/communication"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/errors"
"github.com/Ingenico-ePayments/connect-sdk-go/domain/installments"
sdkErrors "github.com/Ingenico-ePayments/connect-sdk-go/errors"
"github.com/Ingenico-ePayments/connect-sdk-go/internal/apiresource"
)

// Client represents a installments client. Thread-safe.
type Client struct {
apiResource *apiresource.APIResource
}

// GetInstallmentsInfo represents the resource /{merchantId}/installments/getInstallmentsInfo - Get Installment Info
// Documentation can be found at https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/go/installments/getInstallmentsInfo.html
//
// Can return any of the following errors:
// * ValidationError if the request was not correct and couldn't be processed (HTTP status code 400)
// * AuthorizationError if the request was not allowed (HTTP status code 403)
// * IdempotenceError if an idempotent request caused a conflict (HTTP status code 409)
// * ReferenceError if an object was attempted to be referenced that doesn't exist or has been removed,
// or there was a conflict (HTTP status code 404, 409 or 410)
// * GlobalCollectError if something went wrong at the Ingenico ePayments platform,
// the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
// or the service that you're trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)
// * APIError if the Ingenico ePayments platform returned any other error
func (c *Client) GetInstallmentsInfo(body installments.GetInstallmentRequest, context communication.CallContext) (installments.InstallmentOptionsResponse, error) {
var resultObject installments.InstallmentOptionsResponse

uri, err := c.apiResource.InstantiateURIWithContext("/v1/{merchantId}/installments/getInstallmentsInfo", nil)
if err != nil {
return resultObject, err
}

clientHeaders := c.apiResource.ClientHeaders()

postErr := c.apiResource.Communicator().Post(uri, clientHeaders, nil, body, context, &resultObject)
if postErr != nil {
responseError, isResponseError := postErr.(*sdkErrors.ResponseError)
if isResponseError {
var errorObject interface{}

errorObject = &errors.ErrorResponse{}
err = c.apiResource.Communicator().Marshaller().Unmarshal(responseError.Body(), errorObject)
if err != nil {
return resultObject, err
}

err, createErr := sdkErrors.CreateAPIError(responseError.StatusCode(), responseError.Body(), errorObject, context)
if createErr != nil {
return resultObject, createErr
}

return resultObject, err
}

return resultObject, postErr
}

return resultObject, nil
}

// NewClient constructs a Installments Client
//
// parent is the *apiresource.APIResource on top of which we want to build the new Installments Client
func NewClient(parent *apiresource.APIResource, pathContext map[string]string) *Client {
apiResource := apiresource.NewAPIResourceWithParent(parent, pathContext)

return &Client{apiResource}
}

0 comments on commit af4dd34

Please sign in to comment.