=begin #Conekta API #Conekta sdk The version of the OpenAPI document: 2.1.0 Contact: engineering@conekta.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.6.0 =end require 'spec_helper' require 'json' # Unit tests for Conekta::PlansApi # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'PlansApi' do before do # run before each test @api_instance = Conekta::PlansApi.new end after do # run after each test end describe 'test an instance of PlansApi' do it 'should create an instance of PlansApi' do expect(@api_instance).to be_instance_of(Conekta::PlansApi) end end # unit tests for create_plan # Create Plan # Create a new plan for an existing order # @param plan_request requested field for plan # @param [Hash] opts the optional parameters # @option opts [String] :accept_language Use for knowing which language to use # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. # @return [PlanResponse] describe 'create_plan test' do it 'should work' do request = Conekta::PlanRequest.new({ name: "Gold Plan", amount: 10000, currency: "MXN", interval: 'week', frequency: 1 }) response = @api_instance.create_plan(request) expect(response).to be_instance_of(Conekta::PlanResponse) expect(response.expiry_count).to be_nil expect(response.livemode).to be_truthy expect(response.name).to eq(request.name) end end # unit tests for delete_plan # Delete Plan # @param id Identifier of the resource # @param [Hash] opts the optional parameters # @option opts [String] :accept_language Use for knowing which language to use # @return [PlanResponse] describe 'delete_plan test' do it 'should work' do response = @api_instance.delete_plan('plan_2tZb5q8Z3PYpg6SJd', { accept_language: 'es' }) expect(response).to be_instance_of(Conekta::PlanResponse) end end # unit tests for get_plan # Get Plan # @param id Identifier of the resource # @param [Hash] opts the optional parameters # @option opts [String] :accept_language Use for knowing which language to use # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. # @return [PlanResponse] describe 'get_plan test' do it 'should work' do id = 'plan_2tZb5q8Z3PYpg6SJd' response = @api_instance.get_plan(id, { accept_language: 'es' }) expect(response).to be_instance_of(Conekta::PlanResponse) expect(response.id).to eq(id) expect(response.currency).to eq('MXN') end end # unit tests for get_plans # Get A List of Plans # @param [Hash] opts the optional parameters # @option opts [String] :accept_language Use for knowing which language to use # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250 # @option opts [String] :search General order search, e.g. by mail, reference etc. # @option opts [String] :_next next page # @option opts [String] :previous previous page # @return [GetPlansResponse] describe 'get_plans test' do it 'should work' do response = @api_instance.get_plans({ accept_language: 'es', limit: 20 }) expect(response).to be_instance_of(Conekta::GetPlansResponse) expect(response.data.length).to eq(10) expect(response.has_more).to be_falsey expect(response.next_page_url).to be_nil expect(response.previous_page_url).to be_nil end end # unit tests for update_plan # Update Plan # @param id Identifier of the resource # @param plan_update_request requested field for plan # @param [Hash] opts the optional parameters # @option opts [String] :accept_language Use for knowing which language to use # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. # @return [PlanResponse] describe 'update_plan test' do it 'should work' do id = 'plan_2tZb5q8Z3PYpg6SJd' request = Conekta::PlanUpdateRequest.new({ name: 'updated name' }) response = @api_instance.update_plan(id, request) expect(response).to be_instance_of(Conekta::PlanResponse) expect(response.name).to eq(request.name) expect(response.id).to eq(id) end end end