-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
WorldlineAcquiring
committed
Dec 11, 2024
1 parent
e6b9028
commit 1f07f51
Showing
27 changed files
with
242 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// This file was automatically generated. | ||
|
||
package balanceinquiries | ||
|
||
import ( | ||
"github.com/Worldline-Acquiring/acquiring-sdk-go/apiv1/domain" | ||
v1Errors "github.com/Worldline-Acquiring/acquiring-sdk-go/apiv1/errors" | ||
"github.com/Worldline-Acquiring/acquiring-sdk-go/communicator" | ||
commErrors "github.com/Worldline-Acquiring/acquiring-sdk-go/communicator/errors" | ||
) | ||
|
||
// Client represents a BalanceInquiries client. Thread-safe. | ||
type Client struct { | ||
apiResource *communicator.APIResource | ||
} | ||
|
||
// ProcessBalanceInquiry represents the resource /processing/v1/{acquirerId}/{merchantId}/balance-inquiries - Balance inquiry | ||
// | ||
// Documentation can be found at https://docs.acquiring.worldline-solutions.com/api-reference#tag/Balance-Inquiries/operation/processBalanceInquiry | ||
// | ||
// 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) | ||
// * 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) | ||
// * PlatformError if something went wrong at the Worldline Acquiring platform, | ||
// the Worldline Acquiring 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 Worldline Acquiring platform returned any other error | ||
func (c *Client) ProcessBalanceInquiry(body domain.APIBalanceInquiryRequest, context *communicator.CallContext) (domain.APIBalanceInquiryResponse, error) { | ||
var resultObject domain.APIBalanceInquiryResponse | ||
|
||
uri, err := c.apiResource.InstantiateURIWithContext("/processing/v1/{acquirerId}/{merchantId}/balance-inquiries", nil) | ||
if err != nil { | ||
return resultObject, err | ||
} | ||
|
||
postErr := c.apiResource.Communicator().Post(uri, nil, nil, body, context, &resultObject) | ||
if postErr != nil { | ||
responseError, isResponseError := postErr.(*commErrors.ResponseError) | ||
if isResponseError { | ||
var errorObject interface{} | ||
|
||
errorObject = &domain.APIPaymentErrorResponse{} | ||
err = c.apiResource.Communicator().Marshaller().Unmarshal(responseError.Body(), errorObject) | ||
if err != nil { | ||
return resultObject, err | ||
} | ||
|
||
err, createErr := v1Errors.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 new BalanceInquiries client | ||
// | ||
// parent is the communicator.APIResource on top of which we want to build the new BalanceInquiries client | ||
func NewClient(parent *communicator.APIResource, pathContext map[string]string) (*Client, error) { | ||
apiResource, err := communicator.NewAPIResourceWithParent(parent, pathContext) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &Client{apiResource}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This file was automatically generated. | ||
|
||
package domain | ||
|
||
// APIBalanceInquiryRequest represents class ApiBalanceInquiryRequest | ||
type APIBalanceInquiryRequest struct { | ||
CardPaymentData *CardPaymentDataForBalanceInquiry `json:"cardPaymentData,omitempty"` | ||
Merchant *MerchantData `json:"merchant,omitempty"` | ||
OperationID *string `json:"operationId,omitempty"` | ||
References *PaymentReferences `json:"references,omitempty"` | ||
TerminalData *TerminalData `json:"terminalData,omitempty"` | ||
TransactionTimestamp *string `json:"transactionTimestamp,omitempty"` | ||
} | ||
|
||
// NewAPIBalanceInquiryRequest constructs a new APIBalanceInquiryRequest instance | ||
func NewAPIBalanceInquiryRequest() *APIBalanceInquiryRequest { | ||
return &APIBalanceInquiryRequest{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This file was automatically generated. | ||
|
||
package domain | ||
|
||
// APIBalanceInquiryResponse represents class ApiBalanceInquiryResponse | ||
type APIBalanceInquiryResponse struct { | ||
AuthorizationCode *string `json:"authorizationCode,omitempty"` | ||
AvailableAmount *AmountData `json:"availableAmount,omitempty"` | ||
OperationID *string `json:"operationId,omitempty"` | ||
References *APIReferencesForResponses `json:"references,omitempty"` | ||
Responder *string `json:"responder,omitempty"` | ||
ResponseCode *string `json:"responseCode,omitempty"` | ||
ResponseCodeCategory *string `json:"responseCodeCategory,omitempty"` | ||
ResponseCodeDescription *string `json:"responseCodeDescription,omitempty"` | ||
} | ||
|
||
// NewAPIBalanceInquiryResponse constructs a new APIBalanceInquiryResponse instance | ||
func NewAPIBalanceInquiryResponse() *APIBalanceInquiryResponse { | ||
return &APIBalanceInquiryResponse{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This file was automatically generated. | ||
|
||
package domain | ||
|
||
// CardPaymentDataForBalanceInquiry represents class CardPaymentDataForBalanceInquiry | ||
type CardPaymentDataForBalanceInquiry struct { | ||
Brand *string `json:"brand,omitempty"` | ||
BrandSelector *string `json:"brandSelector,omitempty"` | ||
CardData *PlainCardData `json:"cardData,omitempty"` | ||
CardEntryMode *string `json:"cardEntryMode,omitempty"` | ||
CardholderVerificationMethod *string `json:"cardholderVerificationMethod,omitempty"` | ||
EcommerceData *ECommerceData `json:"ecommerceData,omitempty"` | ||
PointOfSaleData *PointOfSaleData `json:"pointOfSaleData,omitempty"` | ||
WalletID *string `json:"walletId,omitempty"` | ||
} | ||
|
||
// NewCardPaymentDataForBalanceInquiry constructs a new CardPaymentDataForBalanceInquiry instance | ||
func NewCardPaymentDataForBalanceInquiry() *CardPaymentDataForBalanceInquiry { | ||
return &CardPaymentDataForBalanceInquiry{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This file was automatically generated. | ||
|
||
package domain | ||
|
||
// EmvDataItem represents class EmvDataItem | ||
type EmvDataItem struct { | ||
Tag *string `json:"tag,omitempty"` | ||
Value *string `json:"value,omitempty"` | ||
} | ||
|
||
// NewEmvDataItem constructs a new EmvDataItem instance | ||
func NewEmvDataItem() *EmvDataItem { | ||
return &EmvDataItem{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.