=begin #Treezor #Treezor API. more info [here](https://www.treezor.com). OpenAPI spec version: 0.1.1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.1 =end require "uri" module TreezorClient class PayinApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # delete a pay in # Deactivate a payin in the system. # @param id Payin's id. # @param [Hash] opts the optional parameters # @return [InlineResponse20017] def delete_payin(id, opts = {}) data, _status_code, _headers = delete_payin_with_http_info(id, opts) return data end # delete a pay in # Deactivate a payin in the system. # @param id Payin's id. # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse20017, Fixnum, Hash)>] InlineResponse20017 data, response status code and response headers def delete_payin_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PayinApi.delete_payin ..." end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PayinApi.delete_payin" end # resource path local_var_path = "/payins/{id}".sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse20017') if @api_client.config.debugging @api_client.config.logger.debug "API called: PayinApi#delete_payin\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # get a pay in # Get a payin from the system by its id. # @param id Payin's id. # @param [Hash] opts the optional parameters # @return [InlineResponse20017] def get_payin(id, opts = {}) data, _status_code, _headers = get_payin_with_http_info(id, opts) return data end # get a pay in # Get a payin from the system by its id. # @param id Payin's id. # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse20017, Fixnum, Hash)>] InlineResponse20017 data, response status code and response headers def get_payin_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PayinApi.get_payin ..." end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PayinApi.get_payin" end # resource path local_var_path = "/payins/{id}".sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse20017') if @api_client.config.debugging @api_client.config.logger.debug "API called: PayinApi#get_payin\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # search pay ins # Get payins that match search criteria. # @param [Hash] opts the optional parameters # @option opts [String] :access_signature Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](https://agent.treezor.com/security-authentication). # @option opts [String] :access_tag Access tag is used for idem potency query. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_id Access user's id is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_ip Access user's ip is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :payin_id Payin's id. # @option opts [Integer] :wallet_id Payin's wallet id. # @option opts [String] :payin_tag Client custom data. # @option opts [String] :payin_status Payins's status. # @option opts [Integer] :user_id User's id who performed the operation (debited). # @option opts [String] :user_name User's name who performed the operation (debited). # @option opts [String] :user_email User's email who performed the operation (debited). # @option opts [Integer] :beneficiary_user_id User's id who received the operation (credited). # @option opts [String] :event_alias Wallet eventAlias of the payin (credited wallet). # @option opts [Integer] :wallet_type_id Payin's wallet type id. # @option opts [String] :payment_method_id Payin's payment method id. # @option opts [DateTime] :created_date_from The creation date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :created_date_to The creation date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :updated_date_from The modification date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :updated_date_to The modification date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [Integer] :page_number Pagination page number. More info [here](https://agent.treezor.com/lists). # @option opts [Integer] :page_count The number of items per page. More info [here](https://agent.treezor.com/lists). # @option opts [String] :sort_by The transaction element you want to sort the list with. Default value : createdDate. More info [here](https://agent.treezor.com/lists). # @option opts [String] :sort_order The order you want to sort the list. * **DESC** for a descending sort * **ASC** for a ascending sort. Default value : DESC. More info [here](https://agent.treezor.com/lists). # @return [InlineResponse20017] def get_payins(opts = {}) data, _status_code, _headers = get_payins_with_http_info(opts) return data end # search pay ins # Get payins that match search criteria. # @param [Hash] opts the optional parameters # @option opts [String] :access_signature Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](https://agent.treezor.com/security-authentication). # @option opts [String] :access_tag Access tag is used for idem potency query. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_id Access user's id is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_ip Access user's ip is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :payin_id Payin's id. # @option opts [Integer] :wallet_id Payin's wallet id. # @option opts [String] :payin_tag Client custom data. # @option opts [String] :payin_status Payins's status. # @option opts [Integer] :user_id User's id who performed the operation (debited). # @option opts [String] :user_name User's name who performed the operation (debited). # @option opts [String] :user_email User's email who performed the operation (debited). # @option opts [Integer] :beneficiary_user_id User's id who received the operation (credited). # @option opts [String] :event_alias Wallet eventAlias of the payin (credited wallet). # @option opts [Integer] :wallet_type_id Payin's wallet type id. # @option opts [String] :payment_method_id Payin's payment method id. # @option opts [DateTime] :created_date_from The creation date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :created_date_to The creation date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :updated_date_from The modification date from which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [DateTime] :updated_date_to The modification date up to which you want to filter the request result. Format YYYY-MM-DD HH:MM:SS. More info [here](https://agent.treezor.com/lists) # @option opts [Integer] :page_number Pagination page number. More info [here](https://agent.treezor.com/lists). # @option opts [Integer] :page_count The number of items per page. More info [here](https://agent.treezor.com/lists). # @option opts [String] :sort_by The transaction element you want to sort the list with. Default value : createdDate. More info [here](https://agent.treezor.com/lists). # @option opts [String] :sort_order The order you want to sort the list. * **DESC** for a descending sort * **ASC** for a ascending sort. Default value : DESC. More info [here](https://agent.treezor.com/lists). # @return [Array<(InlineResponse20017, Fixnum, Hash)>] InlineResponse20017 data, response status code and response headers def get_payins_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PayinApi.get_payins ..." end # resource path local_var_path = "/payins" # query parameters query_params = {} query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil? query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil? query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil? query_params[:'accessUserIP'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil? query_params[:'payinId'] = opts[:'payin_id'] if !opts[:'payin_id'].nil? query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil? query_params[:'payinTag'] = opts[:'payin_tag'] if !opts[:'payin_tag'].nil? query_params[:'payinStatus'] = opts[:'payin_status'] if !opts[:'payin_status'].nil? query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil? query_params[:'userName'] = opts[:'user_name'] if !opts[:'user_name'].nil? query_params[:'userEmail'] = opts[:'user_email'] if !opts[:'user_email'].nil? query_params[:'beneficiaryUserId'] = opts[:'beneficiary_user_id'] if !opts[:'beneficiary_user_id'].nil? query_params[:'eventAlias'] = opts[:'event_alias'] if !opts[:'event_alias'].nil? query_params[:'walletTypeId'] = opts[:'wallet_type_id'] if !opts[:'wallet_type_id'].nil? query_params[:'paymentMethodId'] = opts[:'payment_method_id'] if !opts[:'payment_method_id'].nil? query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil? query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil? query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil? query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil? query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil? query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil? query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse20017') if @api_client.config.debugging @api_client.config.logger.debug "API called: PayinApi#get_payins\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # create a pay in # Create a new pay in in the system. # @param wallet_id Credited wallet's ID # @param user_id User's id who makes the pay in. NB : this parameter should should not be transmitted in the case of payin of method Sepa Direct Debit Core (21). It will be set automatically by the system. # @param payment_method_id | Id | Payment by | | ---| --- | | 3 | Check | | 11 | Card | | 14 | Oneclick card (without payment form) | | 21 | Sepa Direct Debit Core | | 23 | Full Hosted HTML Payment Form. Please note that if you use this paymentMethodId the flieds paymentAcceptedUrl, paymentRefusedUrl, paymentWaitingUrl, paymentCanceledUrl and paymentExceptionUrl are mandatory. CSS of the payment page can be customized | | 24 | IFrame Payment Form. Please note that if you use this paymentMethodId the flieds paymentAcceptedUrl, paymentRefusedUrl, paymentWaitingUrl, paymentCanceledUrl and paymentExceptionUrl are mandatory. CSS of the payment page can be customized| | 25 | Payment made through an SDK - You cannot directly create a payin directly with this method id. The payin will be automatically created by the system. | # @param amount Pay in amount. # @param currency Payin currency. Format: [ISO 4217](https://fr.wikipedia.org/wiki/ISO_4217). Must be the same as the wallet's. # @param [Hash] opts the optional parameters # @option opts [String] :access_signature Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](https://agent.treezor.com/security-authentication). # @option opts [String] :access_tag Access tag is used for idem potency query. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_id Access user's id is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [String] :access_user_ip Access user's ip is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [String] :payin_tag Client custom data. # @option opts [Integer] :oneclickcard_id Oneclick card's id. Mandatory if payment method is 14. Useless otherwise. # @option opts [String] :payment_accepted_url Url where cardholder is redirected if payment is successful. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_waiting_url Url where cardholder is redirected to wait payment processing. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_refused_url Url where cardholder is redirected if payment is refused. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_canceled_url Url where cardholder is redirected if payment is canceled. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_exception_url Url where cardholder is redirected if the payment process raised an exception. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [Float] :distributor_fee Distributor fee # @option opts [String] :message_to_user Message to send to wallet's user. In the case of a Sepa Direct Debit Core payment method this parameter will be the reconciliation information transmitted to the Debtor (ie. Invoice number ...). In this case it cannot be more than 140 characters. # @option opts [String] :language Language for the third party interface. # @option opts [String] :created_ip User's IP address # @option opts [String] :payin_date The date at which the SDD should be presented. This parameter is mandatory when performing a payin of method SDD Core. Format is YYYY-MM-DD The date should follow some requirements (Traget 2 working day) : - Be a weekday (Monday to Friday) - January 1st is excluded - May 1st is excluded - December 25 is excluded - December 26th is excluded - Easter day is excluded - Easter Monday is excluded - Good Friday is excluded # @option opts [Integer] :mandate_id The id of the mandate. This parameter is mandatory when performing a payin with method SDD Core. # @return [InlineResponse20017] def post_payin(wallet_id, user_id, payment_method_id, amount, currency, opts = {}) data, _status_code, _headers = post_payin_with_http_info(wallet_id, user_id, payment_method_id, amount, currency, opts) return data end # create a pay in # Create a new pay in in the system. # @param wallet_id Credited wallet's ID # @param user_id User's id who makes the pay in. NB : this parameter should should not be transmitted in the case of payin of method Sepa Direct Debit Core (21). It will be set automatically by the system. # @param payment_method_id | Id | Payment by | | ---| --- | | 3 | Check | | 11 | Card | | 14 | Oneclick card (without payment form) | | 21 | Sepa Direct Debit Core | | 23 | Full Hosted HTML Payment Form. Please note that if you use this paymentMethodId the flieds paymentAcceptedUrl, paymentRefusedUrl, paymentWaitingUrl, paymentCanceledUrl and paymentExceptionUrl are mandatory. CSS of the payment page can be customized | | 24 | IFrame Payment Form. Please note that if you use this paymentMethodId the flieds paymentAcceptedUrl, paymentRefusedUrl, paymentWaitingUrl, paymentCanceledUrl and paymentExceptionUrl are mandatory. CSS of the payment page can be customized| | 25 | Payment made through an SDK - You cannot directly create a payin directly with this method id. The payin will be automatically created by the system. | # @param amount Pay in amount. # @param currency Payin currency. Format: [ISO 4217](https://fr.wikipedia.org/wiki/ISO_4217). Must be the same as the wallet's. # @param [Hash] opts the optional parameters # @option opts [String] :access_signature Access signature can be mandatory for specific context. Treezor will contact you if so. More info [here](https://agent.treezor.com/security-authentication). # @option opts [String] :access_tag Access tag is used for idem potency query. More info [here](https://agent.treezor.com/basics). # @option opts [Integer] :access_user_id Access user's id is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [String] :access_user_ip Access user's ip is used for user's action restriction. More info [here](https://agent.treezor.com/basics). # @option opts [String] :payin_tag Client custom data. # @option opts [Integer] :oneclickcard_id Oneclick card's id. Mandatory if payment method is 14. Useless otherwise. # @option opts [String] :payment_accepted_url Url where cardholder is redirected if payment is successful. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_waiting_url Url where cardholder is redirected to wait payment processing. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_refused_url Url where cardholder is redirected if payment is refused. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_canceled_url Url where cardholder is redirected if payment is canceled. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [String] :payment_exception_url Url where cardholder is redirected if the payment process raised an exception. When using paymentMethodId 23 and 24 an HTTPS URL is mandatory. # @option opts [Float] :distributor_fee Distributor fee # @option opts [String] :message_to_user Message to send to wallet's user. In the case of a Sepa Direct Debit Core payment method this parameter will be the reconciliation information transmitted to the Debtor (ie. Invoice number ...). In this case it cannot be more than 140 characters. # @option opts [String] :language Language for the third party interface. # @option opts [String] :created_ip User's IP address # @option opts [String] :payin_date The date at which the SDD should be presented. This parameter is mandatory when performing a payin of method SDD Core. Format is YYYY-MM-DD The date should follow some requirements (Traget 2 working day) : - Be a weekday (Monday to Friday) - January 1st is excluded - May 1st is excluded - December 25 is excluded - December 26th is excluded - Easter day is excluded - Easter Monday is excluded - Good Friday is excluded # @option opts [Integer] :mandate_id The id of the mandate. This parameter is mandatory when performing a payin with method SDD Core. # @return [Array<(InlineResponse20017, Fixnum, Hash)>] InlineResponse20017 data, response status code and response headers def post_payin_with_http_info(wallet_id, user_id, payment_method_id, amount, currency, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PayinApi.post_payin ..." end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling PayinApi.post_payin" end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling PayinApi.post_payin" end # verify the required parameter 'payment_method_id' is set if @api_client.config.client_side_validation && payment_method_id.nil? fail ArgumentError, "Missing the required parameter 'payment_method_id' when calling PayinApi.post_payin" end # verify the required parameter 'amount' is set if @api_client.config.client_side_validation && amount.nil? fail ArgumentError, "Missing the required parameter 'amount' when calling PayinApi.post_payin" end # verify the required parameter 'currency' is set if @api_client.config.client_side_validation && currency.nil? fail ArgumentError, "Missing the required parameter 'currency' when calling PayinApi.post_payin" end if @api_client.config.client_side_validation && opts[:'language'] && !['FRA', 'GBR', 'ESP', 'ITA', 'PRT'].include?(opts[:'language']) fail ArgumentError, 'invalid value for "language", must be one of FRA, GBR, ESP, ITA, PRT' end # resource path local_var_path = "/payins" # query parameters query_params = {} query_params[:'walletId'] = wallet_id query_params[:'userId'] = user_id query_params[:'paymentMethodId'] = payment_method_id query_params[:'amount'] = amount query_params[:'currency'] = currency query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil? query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil? query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil? query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil? query_params[:'payinTag'] = opts[:'payin_tag'] if !opts[:'payin_tag'].nil? query_params[:'oneclickcardId'] = opts[:'oneclickcard_id'] if !opts[:'oneclickcard_id'].nil? query_params[:'paymentAcceptedUrl'] = opts[:'payment_accepted_url'] if !opts[:'payment_accepted_url'].nil? query_params[:'paymentWaitingUrl'] = opts[:'payment_waiting_url'] if !opts[:'payment_waiting_url'].nil? query_params[:'paymentRefusedUrl'] = opts[:'payment_refused_url'] if !opts[:'payment_refused_url'].nil? query_params[:'paymentCanceledUrl'] = opts[:'payment_canceled_url'] if !opts[:'payment_canceled_url'].nil? query_params[:'paymentExceptionUrl'] = opts[:'payment_exception_url'] if !opts[:'payment_exception_url'].nil? query_params[:'distributorFee'] = opts[:'distributor_fee'] if !opts[:'distributor_fee'].nil? query_params[:'messageToUser'] = opts[:'message_to_user'] if !opts[:'message_to_user'].nil? query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil? query_params[:'createdIp'] = opts[:'created_ip'] if !opts[:'created_ip'].nil? query_params[:'payinDate'] = opts[:'payin_date'] if !opts[:'payin_date'].nil? query_params[:'mandateId'] = opts[:'mandate_id'] if !opts[:'mandate_id'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse20017') if @api_client.config.debugging @api_client.config.logger.debug "API called: PayinApi#post_payin\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end