tpaga 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 276563b880a8fe9ce405088712f16439583a8323
4
- data.tar.gz: fc914eda52360a07b8a4ba6a86cfe8d5fd05670f
3
+ metadata.gz: e645d8c398c5989bdd7847ae837244f4ebcc996c
4
+ data.tar.gz: db610df63165ad8ee39972e6c513224632d3baf7
5
5
  SHA512:
6
- metadata.gz: 813cf3fdc1715200d90d447aac9c811c188a9520593fa147d0732830216b151e350bbfb5d512960098a03a21776e1b0eb4e840be4b107f9b55aff52e07c2f6fd
7
- data.tar.gz: 19885e27841096620a79d362fb9d4dec282aaaaa0640ec689d47b6843fa1ee1462049689d9d97f79b2bc67fe12e7b04bc8054ec8075de3f85b0c8e5a188af1ef
6
+ metadata.gz: b38ef1440a3eb443b9b705f83788a3f420b4dea2a7bdfbb2b1330a5629f7cedb62597e9651b038e20bbdf641ef12a12070eca14d50dd7a7acf62dcbb5d5bfaf6
7
+ data.tar.gz: 6a0ae9aaf5e100be696e00aa543fc10a61f4f2a189440278b144a75ad52cca7c65e2cd054889b885ce9d42a636005d227bb835b74355f548b1aa1e33e2bc3f2a
@@ -1,28 +1,35 @@
1
- # Create the base module
2
- module Tpaga
3
-
4
1
  # Swagger common files
5
- require 'tpaga/monkey.rb'
6
- require 'tpaga/swagger.rb'
7
- require 'tpaga/swagger/configuration.rb'
8
- require 'tpaga/swagger/request.rb'
9
- require 'tpaga/swagger/response.rb'
10
- require 'tpaga/swagger/version.rb'
11
-
2
+ require 'tpaga/monkey'
3
+ require 'tpaga/swagger'
4
+ require 'tpaga/swagger/configuration'
5
+ require 'tpaga/swagger/request'
6
+ require 'tpaga/swagger/response'
7
+ require 'tpaga/swagger/version'
12
8
 
13
9
  # Models
14
- require 'tpaga/models/customer.rb'
15
- require 'tpaga/models/address.rb'
16
- require 'tpaga/models/creditcard.rb'
17
- require 'tpaga/models/creditcardcreate.rb'
18
- require 'tpaga/models/billingaddress.rb'
19
- require 'tpaga/models/charge.rb'
20
- require 'tpaga/models/city.rb'
21
-
10
+ require 'tpaga/models/base_object'
11
+ require 'tpaga/models/city'
12
+ require 'tpaga/models/address'
13
+ require 'tpaga/models/customer'
14
+ require 'tpaga/models/credit_card'
15
+ require 'tpaga/models/credit_card_create'
16
+ require 'tpaga/models/billing_address'
17
+ require 'tpaga/models/credit_card_charge'
18
+ require 'tpaga/models/davi_plata'
19
+ require 'tpaga/models/davi_plata_charge'
20
+ require 'tpaga/models/davi_plata_chargeback'
21
+ require 'tpaga/models/davi_plata_verification'
22
+ require 'tpaga/models/api_errors_item'
23
+ require 'tpaga/models/api_error'
22
24
 
23
25
  # APIs
24
- require 'tpaga/api/charge_api.rb'
25
- require 'tpaga/api/customer_api.rb'
26
-
26
+ require 'tpaga/api/chargeback_api'
27
+ require 'tpaga/api/customer_api'
28
+ require 'tpaga/api/davi_plata_api'
29
+ require 'tpaga/api/charge_api'
30
+ require 'tpaga/api/credit_card_api'
27
31
 
32
+ module Tpaga
33
+ # Initialize the default configuration
34
+ Swagger.configuration ||= Swagger::Configuration.new
28
35
  end
@@ -1,135 +1,168 @@
1
1
  require "uri"
2
2
 
3
3
  module Tpaga
4
- class ChargeAPI
5
- basePath = "https://api.tpaga.co.local:8443/api"
6
- # apiInvoker = APIInvoker
4
+ class ChargeApi
5
+ basePath = "https://sandbox.tpaga.co/api"
6
+ # apiInvoker = APIInvoker
7
7
 
8
- def self.escapeString(string)
9
- URI.encode(string.to_s)
10
- end
8
+ # Adds a new CreditCardCharge to Customer's CreditCard
9
+ # Creates a new `CreditCardCharge` and associates it to a `CreditCard`.
10
+ # @param body The `CreditCardCharge` object to be generated to a `CreditCard` it has the following fields\n- **id** its the id of the `CreditCardCharge` thats going to be generated after creation.\n- **creditCard** which is the identificator of the `CreditCard` to be charged\n- **customer** which is the id of the `Customer` associated with the `CreditCard`\n- **amount** which is the full amount of the charge\n- **currency** its the 3-letter ISO code for the currency.\n- **installments** its the amount of payments to divide the charge amount, it can be minumum 1 maximum 36\n- **taxAmount** the amount that accounts as taxes.\n- **paid** its the status of the charge. true if its paid, false if its not.\n- **description** which is the desciption of the charge being made.\n- **orderId** commerce order identificator
11
+ # @param [Hash] opts the optional parameters
12
+ # @return [CreditCardCharge]
13
+ def self.add_credit_card_charge(body, opts = {})
14
+
15
+ # verify the required parameter 'body' is set
16
+ raise "Missing the required parameter 'body' when calling add_credit_card_charge" if body.nil?
17
+
18
+
19
+ # resource path
20
+ path = "/charge/credit_card".sub('{format}', 'json')
11
21
 
12
-
22
+ # query parameters
23
+ query_params = {}
13
24
 
14
- # Add a new Charge to Customer's CreditCard
15
- # A new `Charge` to a `CreditCard` is created.
16
- # @param body Charge object that needs to be authorized.
17
- # @return Charge
18
- def self.add_charge (body,opts={})
19
- query_param_keys = []
25
+ # header parameters
26
+ header_params = {}
20
27
 
21
- # verify existence of params
22
- raise "body is required" if body.nil?
23
- # set default values and merge with input
24
- options = {
25
- }.merge(opts)
28
+ # HTTP header 'Accept' (if needed)
29
+ _header_accept = []
30
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
26
31
 
27
- required_options = {
28
- :'body' => body}
32
+ # HTTP header 'Content-Type'
33
+ _header_content_type = []
34
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
29
35
 
30
- options.merge!(required_options)
36
+ # form parameters
37
+ form_params = {}
31
38
 
32
- #resource path
33
- path = "/charge"
39
+ # http body (model)
40
+ post_body = Swagger::Request.object_to_http_body(body)
34
41
 
35
-
36
- # pull querystring keys from options
37
- queryopts = options.select do |key,value|
38
- query_param_keys.include? key
42
+
43
+ auth_names = ['api_key']
44
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
45
+ obj = CreditCardCharge.new() and obj.build_from_hash(response)
39
46
  end
40
47
 
41
- # header parameter
42
- headers = {}
43
- # additional http headers
44
- headers['Accept'] = 'application/json'
45
- headers['Content-Type'] = 'application/json'
46
-
47
- # http body
48
- post_body = nil
49
- if body != nil
50
- if body.is_a?(Array)
51
- array = Array.new
52
- body.each do |item|
53
- if item.respond_to?("to_body".to_sym)
54
- array.push item.to_body
55
- else
56
- array.push item
57
- end
58
- end
59
- post_body = array
60
-
61
- else
62
- if body.respond_to?("to_body".to_sym)
63
- post_body = body.to_body
64
- else
65
- post_body = body
66
- end
67
- end
48
+ # Retrieve a CreditCardCharge by ID
49
+ # Get the details of an existing `CreditCardCharge`. This method only requires an unique `CreditCardCharge` identifier `id` that was returned upon `CreditCardCharge` creation.
50
+ # @param id Identification of `CreditCardCharge` that needs to be retrieved
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [CreditCardCharge]
53
+ def self.get_credit_card_charge_by_id(id, opts = {})
54
+
55
+ # verify the required parameter 'id' is set
56
+ raise "Missing the required parameter 'id' when calling get_credit_card_charge_by_id" if id.nil?
57
+
58
+
59
+ # resource path
60
+ path = "/charge/credit_card/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
61
+
62
+ # query parameters
63
+ query_params = {}
64
+
65
+ # header parameters
66
+ header_params = {}
67
+
68
+ # HTTP header 'Accept' (if needed)
69
+ _header_accept = []
70
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
71
+
72
+ # HTTP header 'Content-Type'
73
+ _header_content_type = []
74
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
75
+
76
+ # form parameters
77
+ form_params = {}
78
+
79
+ # http body (model)
80
+ post_body = nil
81
+
82
+
83
+ auth_names = ['api_key']
84
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
85
+ obj = CreditCardCharge.new() and obj.build_from_hash(response)
68
86
  end
69
- # form parameter
70
- form_parameter_hash = {}
71
-
72
87
 
88
+ # Adds a new DaviPlataCharge to Customer's DaviPlata
89
+ # Creates a new `DaviPlataCharge` and associates it to a `DaviPlata`.
90
+ # @param body The `DaviPlataCharge` object to be generated to a `DaviPlata`. It has the following fields\n- **id** its the id of the `DaviPlataCharge` thats going to be generated after creation.\n- **daviPlata** which is the identificator of the `DaviPlata` to be charged\n- **customer** which is the id of the `Customer` associated with the `DaviPlata`\n- **amount** which is the full amount of the charge\n- **currency** its the 3-letter ISO code for the currency.\n- **taxAmount** the amount that accounts as taxes.\n- **paid** its the status of the charge. true if its paid, false if its not.\n- **description** which is the desciption of the charge being made.\n- **orderId** commerce order identificator
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [DaviPlataCharge]
93
+ def self.add_davi_plata_charge(body, opts = {})
73
94
 
74
- # authentication setting
75
- require_auth = true
95
+ # verify the required parameter 'body' is set
96
+ raise "Missing the required parameter 'body' when calling add_davi_plata_charge" if body.nil?
76
97
 
77
- response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
78
- Charge.new(response)
79
98
 
80
- end
99
+ # resource path
100
+ path = "/charge/daviplata".sub('{format}', 'json')
81
101
 
102
+ # query parameters
103
+ query_params = {}
82
104
 
105
+ # header parameters
106
+ header_params = {}
83
107
 
84
- # Find a Charge by ID
85
- # Returns a `Charge` when id is `charge_token_id` or anything else will simulate API error conditions
86
- # @param id Identification of `Charge` that needs to be fetched
87
- # @return Charge
88
- def self.get_charge_by_id (id,opts={})
89
- query_param_keys = []
108
+ # HTTP header 'Accept' (if needed)
109
+ _header_accept = []
110
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
90
111
 
91
- # verify existence of params
92
- raise "id is required" if id.nil?
93
- # set default values and merge with input
94
- options = {
95
- }.merge(opts)
112
+ # HTTP header 'Content-Type'
113
+ _header_content_type = []
114
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
96
115
 
97
- required_options = {
98
- :'id' => id}
116
+ # form parameters
117
+ form_params = {}
99
118
 
100
- options.merge!(required_options)
119
+ # http body (model)
120
+ post_body = Swagger::Request.object_to_http_body(body)
101
121
 
102
- #resource path
103
- path = "/charge/{id}".sub('{' + 'id' + '}', escapeString(id))
104
-
105
122
 
106
-
107
- # pull querystring keys from options
108
- queryopts = options.select do |key,value|
109
- query_param_keys.include? key
123
+ auth_names = ['api_key']
124
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
125
+ obj = DaviPlataCharge.new() and obj.build_from_hash(response)
110
126
  end
111
127
 
112
- # header parameter
113
- headers = {}
114
- # additional http headers
115
- headers['Accept'] = 'application/json'
116
- headers['Content-Type'] = 'application/x-www-form-urlencoded'
128
+ # Retrieve a DaviPlataCharge by ID
129
+ # Get the details of an existing `DaviPlataCharge`. This method only requires an unique `DaviPlataCharge` identifier `id` that was returned upon `DaviPlataCharge` creation.
130
+ # @param id Identification of `DaviPlataCharge` that needs to be retrieved
131
+ # @param [Hash] opts the optional parameters
132
+ # @return [DaviPlataCharge]
133
+ def self.get_davi_plata_charge_by_id(id, opts = {})
117
134
 
118
- # http body
119
- post_body = nil
120
- # form parameter
121
- form_parameter_hash = {}
122
-
135
+ # verify the required parameter 'id' is set
136
+ raise "Missing the required parameter 'id' when calling get_davi_plata_charge_by_id" if id.nil?
123
137
 
124
138
 
125
- # authentication setting
126
- require_auth = true
139
+ # resource path
140
+ path = "/charge/daviplata/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
127
141
 
128
- response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
129
- Charge.new(response)
142
+ # query parameters
143
+ query_params = {}
130
144
 
131
- end
145
+ # header parameters
146
+ header_params = {}
132
147
 
133
- end
134
- end
148
+ # HTTP header 'Accept' (if needed)
149
+ _header_accept = []
150
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
151
+
152
+ # HTTP header 'Content-Type'
153
+ _header_content_type = []
154
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
135
155
 
156
+ # form parameters
157
+ form_params = {}
158
+
159
+ # http body (model)
160
+ post_body = nil
161
+
162
+
163
+ auth_names = ['api_key']
164
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
165
+ obj = DaviPlataCharge.new() and obj.build_from_hash(response)
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,88 @@
1
+ require "uri"
2
+
3
+ module Tpaga
4
+ class ChargebackApi
5
+ basePath = "https://sandbox.tpaga.co/api"
6
+ # apiInvoker = APIInvoker
7
+
8
+ # Adds a new DaviPlataChargeback to Customer's DaviPlata
9
+ # Creates a new `DaviPlataChargeback` and associates it to a `DaviPlata`.
10
+ # @param body The `DaviPlataChargeback` to be applied to a `DaviPlata`. It has the following fields\n- **id** its the id of the `DaviPlataChargeback` thats going to be generated after creation.\n- **daviPlata** its the id of the `DaviPlata` to be reinbursed.\n- **daviPlataCharge** its the id of the `DaviPlataCharge` to apply the Chargeback.\n- **reimbursed** its the status of the chargeback, true if its been reinbursed or false if its still pending.
11
+ # @param [Hash] opts the optional parameters
12
+ # @return [DaviPlataChargeback]
13
+ def self.add_davi_plata_chargeback(body, opts = {})
14
+
15
+ # verify the required parameter 'body' is set
16
+ raise "Missing the required parameter 'body' when calling add_davi_plata_chargeback" if body.nil?
17
+
18
+
19
+ # resource path
20
+ path = "/chargeback/daviplata".sub('{format}', 'json')
21
+
22
+ # query parameters
23
+ query_params = {}
24
+
25
+ # header parameters
26
+ header_params = {}
27
+
28
+ # HTTP header 'Accept' (if needed)
29
+ _header_accept = []
30
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
31
+
32
+ # HTTP header 'Content-Type'
33
+ _header_content_type = []
34
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
35
+
36
+ # form parameters
37
+ form_params = {}
38
+
39
+ # http body (model)
40
+ post_body = Swagger::Request.object_to_http_body(body)
41
+
42
+
43
+ auth_names = ['api_key']
44
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
45
+ obj = DaviPlataChargeback.new() and obj.build_from_hash(response)
46
+ end
47
+
48
+ # Retrieve a DaviPlataChargeback by ID
49
+ # Get the details of an existing `DaviPlataChargeback`. This method only requires an unique `DaviPlataChargeback` identifier `id` that was returned upon `DaviPlataChargeback` creation.
50
+ # @param id Identification of `DaviPlataChargeback` to be retrieved
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [DaviPlataChargeback]
53
+ def self.get_davi_plata_chargeback_by_id(id, opts = {})
54
+
55
+ # verify the required parameter 'id' is set
56
+ raise "Missing the required parameter 'id' when calling get_davi_plata_chargeback_by_id" if id.nil?
57
+
58
+
59
+ # resource path
60
+ path = "/chargeback/daviplata/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
61
+
62
+ # query parameters
63
+ query_params = {}
64
+
65
+ # header parameters
66
+ header_params = {}
67
+
68
+ # HTTP header 'Accept' (if needed)
69
+ _header_accept = []
70
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
71
+
72
+ # HTTP header 'Content-Type'
73
+ _header_content_type = []
74
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
75
+
76
+ # form parameters
77
+ form_params = {}
78
+
79
+ # http body (model)
80
+ post_body = nil
81
+
82
+
83
+ auth_names = ['api_key']
84
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
85
+ obj = DaviPlataChargeback.new() and obj.build_from_hash(response)
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,220 @@
1
+ require "uri"
2
+
3
+ module Tpaga
4
+ class CreditCardApi
5
+ basePath = "https://sandbox.tpaga.co/api"
6
+ # apiInvoker = APIInvoker
7
+
8
+ # Adds a new CreditCardCharge to Customer's CreditCard
9
+ # Creates a new `CreditCardCharge` and associates it to a `CreditCard`.
10
+ # @param body The `CreditCardCharge` object to be generated to a `CreditCard` it has the following fields\n- **id** its the id of the `CreditCardCharge` thats going to be generated after creation.\n- **creditCard** which is the identificator of the `CreditCard` to be charged\n- **customer** which is the id of the `Customer` associated with the `CreditCard`\n- **amount** which is the full amount of the charge\n- **currency** its the 3-letter ISO code for the currency.\n- **installments** its the amount of payments to divide the charge amount, it can be minumum 1 maximum 36\n- **taxAmount** the amount that accounts as taxes.\n- **paid** its the status of the charge. true if its paid, false if its not.\n- **description** which is the desciption of the charge being made.\n- **orderId** commerce order identificator
11
+ # @param [Hash] opts the optional parameters
12
+ # @return [CreditCardCharge]
13
+ def self.add_credit_card_charge(body, opts = {})
14
+
15
+ # verify the required parameter 'body' is set
16
+ raise "Missing the required parameter 'body' when calling add_credit_card_charge" if body.nil?
17
+
18
+
19
+ # resource path
20
+ path = "/charge/credit_card".sub('{format}', 'json')
21
+
22
+ # query parameters
23
+ query_params = {}
24
+
25
+ # header parameters
26
+ header_params = {}
27
+
28
+ # HTTP header 'Accept' (if needed)
29
+ _header_accept = []
30
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
31
+
32
+ # HTTP header 'Content-Type'
33
+ _header_content_type = []
34
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
35
+
36
+ # form parameters
37
+ form_params = {}
38
+
39
+ # http body (model)
40
+ post_body = Swagger::Request.object_to_http_body(body)
41
+
42
+
43
+ auth_names = ['api_key']
44
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
45
+ obj = CreditCardCharge.new() and obj.build_from_hash(response)
46
+ end
47
+
48
+ # Retrieve a CreditCardCharge by ID
49
+ # Get the details of an existing `CreditCardCharge`. This method only requires an unique `CreditCardCharge` identifier `id` that was returned upon `CreditCardCharge` creation.
50
+ # @param id Identification of `CreditCardCharge` that needs to be retrieved
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [CreditCardCharge]
53
+ def self.get_credit_card_charge_by_id(id, opts = {})
54
+
55
+ # verify the required parameter 'id' is set
56
+ raise "Missing the required parameter 'id' when calling get_credit_card_charge_by_id" if id.nil?
57
+
58
+
59
+ # resource path
60
+ path = "/charge/credit_card/{id}".sub('{format}', 'json').sub('{' + 'id' + '}', id.to_s)
61
+
62
+ # query parameters
63
+ query_params = {}
64
+
65
+ # header parameters
66
+ header_params = {}
67
+
68
+ # HTTP header 'Accept' (if needed)
69
+ _header_accept = []
70
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
71
+
72
+ # HTTP header 'Content-Type'
73
+ _header_content_type = []
74
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
75
+
76
+ # form parameters
77
+ form_params = {}
78
+
79
+ # http body (model)
80
+ post_body = nil
81
+
82
+
83
+ auth_names = ['api_key']
84
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
85
+ obj = CreditCardCharge.new() and obj.build_from_hash(response)
86
+ end
87
+
88
+ # Adds a new Credit Card payment method to the Customer
89
+ # Creates a new `CreditCard` and associates it to the `Customer`
90
+ # @param customer_id Identificaiton of `Customer` to associate the new `CreditCard`
91
+ # @param body The `CreditCard` object to be associated to the `Customer`, it has the following fields\n- **primaryAccountNumber** which is the number as it appears on the credit card.\n- **cardVerificationCode** which is the security code usually found in the back o the credit card.\n- **expirationMonth** which is the month of expiration of the credit card, its entered as a numeric value with single digits or double digits like 5 or 05 to represent may.\n- **expirationYear** which is the year of expiration of the credit card in its complete numeric value.\n- **cardHolderName** which is the name of the card holder exactly as it appears on the credit card.\n- **billingAddress** which is the billing address of the credit card that consists of two address lines, the city, the country, the postalCode and the state of the address.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [CreditCard]
94
+ def self.add_credit_card(customer_id, body, opts = {})
95
+
96
+ # verify the required parameter 'customer_id' is set
97
+ raise "Missing the required parameter 'customer_id' when calling add_credit_card" if customer_id.nil?
98
+
99
+ # verify the required parameter 'body' is set
100
+ raise "Missing the required parameter 'body' when calling add_credit_card" if body.nil?
101
+
102
+
103
+ # resource path
104
+ path = "/customer/{customer_id}/credit_card".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s)
105
+
106
+ # query parameters
107
+ query_params = {}
108
+
109
+ # header parameters
110
+ header_params = {}
111
+
112
+ # HTTP header 'Accept' (if needed)
113
+ _header_accept = []
114
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
115
+
116
+ # HTTP header 'Content-Type'
117
+ _header_content_type = []
118
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
119
+
120
+ # form parameters
121
+ form_params = {}
122
+
123
+ # http body (model)
124
+ post_body = Swagger::Request.object_to_http_body(body)
125
+
126
+
127
+ auth_names = ['api_key']
128
+ response = Swagger::Request.new(:POST, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
129
+ obj = CreditCard.new() and obj.build_from_hash(response)
130
+ end
131
+
132
+ # Retrieve a CreditCard by ID
133
+ # Get the details of an existing `CreditCard`. This method only requires an unique `CreditCard` identifier `id` that was returned upon `CreditCard` creation.
134
+ # @param customer_id Identification of `Customer` associated with the `CreditCard`
135
+ # @param card_id Identification of `CreditCard` that needs to be retrieved
136
+ # @param [Hash] opts the optional parameters
137
+ # @return [CreditCard]
138
+ def self.get_credit_card_by_id(customer_id, card_id, opts = {})
139
+
140
+ # verify the required parameter 'customer_id' is set
141
+ raise "Missing the required parameter 'customer_id' when calling get_credit_card_by_id" if customer_id.nil?
142
+
143
+ # verify the required parameter 'card_id' is set
144
+ raise "Missing the required parameter 'card_id' when calling get_credit_card_by_id" if card_id.nil?
145
+
146
+
147
+ # resource path
148
+ path = "/customer/{customer_id}/credit_card/{card_id}".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'card_id' + '}', card_id.to_s)
149
+
150
+ # query parameters
151
+ query_params = {}
152
+
153
+ # header parameters
154
+ header_params = {}
155
+
156
+ # HTTP header 'Accept' (if needed)
157
+ _header_accept = []
158
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
159
+
160
+ # HTTP header 'Content-Type'
161
+ _header_content_type = []
162
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
163
+
164
+ # form parameters
165
+ form_params = {}
166
+
167
+ # http body (model)
168
+ post_body = nil
169
+
170
+
171
+ auth_names = ['api_key']
172
+ response = Swagger::Request.new(:GET, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make.body
173
+ obj = CreditCard.new() and obj.build_from_hash(response)
174
+ end
175
+
176
+ # Deletes a CreditCard by ID
177
+ # Deletes a `CreditCard` when its `id` matches the parameters. Only available when `CreditCard` does not have associated Charges.
178
+ # @param customer_id Identificaiton of `Customer` associated with the `CreditCard`
179
+ # @param card_id Identification of `CreditCard` to be deleted
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [nil]
182
+ def self.delete_credit_card_by_id(customer_id, card_id, opts = {})
183
+
184
+ # verify the required parameter 'customer_id' is set
185
+ raise "Missing the required parameter 'customer_id' when calling delete_credit_card_by_id" if customer_id.nil?
186
+
187
+ # verify the required parameter 'card_id' is set
188
+ raise "Missing the required parameter 'card_id' when calling delete_credit_card_by_id" if card_id.nil?
189
+
190
+
191
+ # resource path
192
+ path = "/customer/{customer_id}/credit_card/{card_id}".sub('{format}', 'json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'card_id' + '}', card_id.to_s)
193
+
194
+ # query parameters
195
+ query_params = {}
196
+
197
+ # header parameters
198
+ header_params = {}
199
+
200
+ # HTTP header 'Accept' (if needed)
201
+ _header_accept = []
202
+ _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
203
+
204
+ # HTTP header 'Content-Type'
205
+ _header_content_type = []
206
+ header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)
207
+
208
+ # form parameters
209
+ form_params = {}
210
+
211
+ # http body (model)
212
+ post_body = nil
213
+
214
+
215
+ auth_names = ['api_key']
216
+ Swagger::Request.new(:DELETE, path, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make
217
+ nil
218
+ end
219
+ end
220
+ end