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

Commit

Permalink
Release 1.21.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingenico ePayments committed Jul 12, 2018
1 parent 910fb89 commit 234c9e4
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 2 deletions.
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 = "1.20.0"
const sdkVersion = "1.21.0"
const serverMetaInfoHeader = "X-GCS-ServerMetaInfo"

// NewMetaDataProviderWithBuilder creates a MetaDataProvider with the given MetaDataProviderBuilder
Expand Down
15 changes: 15 additions & 0 deletions domain/hostedmandatemanagement/CreateRequest.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 hostedmandatemanagement

// CreateRequest represents class CreateHostedMandateManagementRequest
type CreateRequest struct {
CreateMandateInfo *HostedMandateInfo `json:"createMandateInfo,omitempty"`
HostedMandateManagementSpecificInput *SpecificInput `json:"hostedMandateManagementSpecificInput,omitempty"`
}

// NewCreateRequest constructs a new CreateRequest
func NewCreateRequest() *CreateRequest {
return &CreateRequest{}
}
16 changes: 16 additions & 0 deletions domain/hostedmandatemanagement/CreateResponse.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 hostedmandatemanagement

// CreateResponse represents class CreateHostedMandateManagementResponse
type CreateResponse struct {
RETURNMAC *string `json:"RETURNMAC,omitempty"`
HostedMandateManagementID *string `json:"hostedMandateManagementId,omitempty"`
PartialRedirectURL *string `json:"partialRedirectUrl,omitempty"`
}

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

package hostedmandatemanagement

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

// GetResponse represents class GetHostedMandateManagementResponse
type GetResponse struct {
Mandate *mandates.MandateResponse `json:"mandate,omitempty"`
Status *string `json:"status,omitempty"`
}

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

package hostedmandatemanagement

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

// HostedMandateInfo represents class HostedMandateInfo
type HostedMandateInfo struct {
Alias *string `json:"alias,omitempty"`
Customer *mandates.MandateCustomer `json:"customer,omitempty"`
CustomerReference *string `json:"customerReference,omitempty"`
RecurrenceType *string `json:"recurrenceType,omitempty"`
SignatureType *string `json:"signatureType,omitempty"`
UniqueMandateReference *string `json:"uniqueMandateReference,omitempty"`
}

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

package hostedmandatemanagement

// SpecificInput represents class HostedMandateManagementSpecificInput
type SpecificInput struct {
Locale *string `json:"locale,omitempty"`
ReturnURL *string `json:"returnUrl,omitempty"`
ShowResultPage *bool `json:"showResultPage,omitempty"`
Variant *string `json:"variant,omitempty"`
}

// NewSpecificInput constructs a new SpecificInput
func NewSpecificInput() *SpecificInput {
return &SpecificInput{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func createHostedCheckoutExample() {

var customer payment.Customer
customer.BillingAddress = &billingAddress
customer.MerchantCustomerID = newString("1234")

var order payment.Order
order.AmountOfMoney = &amountOfMoney
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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/hostedmandatemanagement"
)

func createHostedMandateManagementExample() {
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 function newString to overcome this issue.
// http://stackoverflow.com/a/30716481 lists a few more alternatives.
// The code for this helper function can be found in file Helper.go

var createMandateInfo hostedmandatemanagement.HostedMandateInfo
createMandateInfo.CustomerReference = newString("idonthaveareference")
createMandateInfo.RecurrenceType = newString("RECURRING")
createMandateInfo.SignatureType = newString("UNSIGNED")

var hostedMandateManagementSpecificInput hostedmandatemanagement.SpecificInput
hostedMandateManagementSpecificInput.Locale = newString("fr_FR")
hostedMandateManagementSpecificInput.ReturnURL = newString("http://www.example.com")
hostedMandateManagementSpecificInput.Variant = newString("101")

var body hostedmandatemanagement.CreateRequest
body.CreateMandateInfo = &createMandateInfo
body.HostedMandateManagementSpecificInput = &hostedMandateManagementSpecificInput

response, err := client.Merchant("merchantId").Hostedmandatemanagements().Create(body, nil)

fmt.Println(response, err)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package examples

import "fmt"

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

response, err := client.Merchant("merchantId").Hostedmandatemanagements().Get("hostedMandateManagementId", nil)

fmt.Println(response, err)
}
51 changes: 51 additions & 0 deletions examples/merchant/hostedmandatemanagements/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
}
2 changes: 1 addition & 1 deletion examples/merchant/payments/CreatePaymentExample.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func createPaymentExample() {

var personalInformation payment.PersonalInformation
personalInformation.DateOfBirth = newString("19490917")
personalInformation.Gender = newString("M")
personalInformation.Gender = newString("male")
personalInformation.Name = &name

var shippingName payment.PersonalName
Expand Down
7 changes: 7 additions & 0 deletions merchant/Client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/Ingenico-ePayments/connect-sdk-go/internal/apiresource"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/captures"
"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/mandates"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/payments"
"github.com/Ingenico-ePayments/connect-sdk-go/merchant/payouts"
Expand All @@ -30,6 +31,12 @@ func (c *Client) Hostedcheckouts() *hostedcheckouts.Client {
return hostedcheckouts.NewClient(c.apiResource, nil)
}

// Hostedmandatemanagements represents the resource /{merchantId}/hostedmandatemanagements
// Create new hosted mandate management
func (c *Client) Hostedmandatemanagements() *hostedmandatemanagements.Client {
return hostedmandatemanagements.NewClient(c.apiResource, nil)
}

// Payments represents the resource /{merchantId}/payments
// Create, cancel and approve payments
func (c *Client) Payments() *payments.Client {
Expand Down
130 changes: 130 additions & 0 deletions merchant/hostedmandatemanagements/Client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// This class was auto-generated from the API references found at
// https://epayments-api.developer-ingenico.com/s2sapi/v1/

package hostedmandatemanagements

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/hostedmandatemanagement"
sdkErrors "github.com/Ingenico-ePayments/connect-sdk-go/errors"
"github.com/Ingenico-ePayments/connect-sdk-go/internal/apiresource"
)

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

// Create represents the resource /{merchantId}/hostedmandatemanagements
// Create hosted mandate management
// Documentation can be found at https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/go/hostedmandatemanagements/create.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) Create(body hostedmandatemanagement.CreateRequest, context communication.CallContext) (hostedmandatemanagement.CreateResponse, error) {
var resultObject hostedmandatemanagement.CreateResponse

uri, err := c.apiResource.InstantiateURIWithContext("/{apiVersion}/{merchantId}/hostedmandatemanagements", 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
}

// Get represents the resource /{merchantId}/hostedmandatemanagements/{hostedMandateManagementId}
// Get hosted mandate management status
// Documentation can be found at https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/go/hostedmandatemanagements/get.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) Get(hostedMandateManagementID string, context communication.CallContext) (hostedmandatemanagement.GetResponse, error) {
var resultObject hostedmandatemanagement.GetResponse

pathContext := map[string]string{
"hostedMandateManagementId": hostedMandateManagementID,
}

uri, err := c.apiResource.InstantiateURIWithContext("/{apiVersion}/{merchantId}/hostedmandatemanagements/{hostedMandateManagementId}", pathContext)
if err != nil {
return resultObject, err
}

clientHeaders := c.apiResource.ClientHeaders()

getErr := c.apiResource.Communicator().Get(uri, clientHeaders, nil, context, &resultObject)
if getErr != nil {
responseError, isResponseError := getErr.(*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, getErr
}

return resultObject, nil
}

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

return &Client{apiResource}
}

0 comments on commit 234c9e4

Please sign in to comment.