Class: CyberSource::BillingAgreementsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/billing_agreements_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ BillingAgreementsApi

Returns a new instance of BillingAgreementsApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 18

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#billing_agreements_de_registration(modify_billing_agreement, id, opts = {}) ⇒ PtsV2ModifyBillingAgreementPost201Response

Modify a Billing Agreement #### Standing Instruction: Standing Instruction with or without Token. #### Revoke Mandate: When you revoke a mandate, any pending direct debits linked to that mandate are canceled. No notifications are sent. When you revoke a mandate with no pending direct debits, the Bacs scheme or customer’s bank notify you of any subsequent direct debit events. When you revoke a mandate, you cannot send a direct debit request using the mandate ID. Customer payments cannot be made against a revoked mandate. You can revoke a mandate when the customer: - Requests that you revoke the mandate. - Closes their account with you. Possible revoke mandate status values - - Revoked—the revoke mandate request was successfully processed. - Failed—the revoke mandate request was not accepted. #### Update Mandate: In most cases, the account details of an existing mandate cannot be updated in the Bacs schema, except by creating a new mandate. However, some very limited customer information, like name and address, can be updated to the mandate without needing to revoke it first #### Mandate Status: After the customer signs the mandate, request that the mandate status service verify the mandate status. Possible mandate status values: - Active—the mandate is successfully created. A direct debit can be sent for this mandate ID. - Pending—a pending mandate means the mandate is not yet signed. - Failed—the customer did not authenticate. - Expired—the deadline to create the mandate passed. - Revoked—the mandate is cancelled. #### Paypal Billing Agreement: A billing agreement is set up between PayPal and your customer. When you collect the details of a customer’s billing agreement, you are able to bill that customer without requiring an authorization for each payment. You can bill the customer at the same time you process their PayPal Express checkout order, which simplifies your business processes.

Parameters:

  • modify_billing_agreement
  • id

    ID for de-registration or cancellation of Billing Agreement

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



30
31
32
33
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 30

def billing_agreements_de_registration(modify_billing_agreement, id, opts = {})
  data, status_code, headers = billing_agreements_de_registration_with_http_info(modify_billing_agreement, id, opts)
  return data, status_code, headers
end

#billing_agreements_de_registration_with_http_info(modify_billing_agreement, id, opts = {}) ⇒ Array<(PtsV2ModifyBillingAgreementPost201Response, Fixnum, Hash)>

Modify a Billing Agreement #### Standing Instruction: Standing Instruction with or without Token. #### Revoke Mandate: When you revoke a mandate, any pending direct debits linked to that mandate are canceled. No notifications are sent. When you revoke a mandate with no pending direct debits, the Bacs scheme or customer&#39;s bank notify you of any subsequent direct debit events. When you revoke a mandate, you cannot send a direct debit request using the mandate ID. Customer payments cannot be made against a revoked mandate. You can revoke a mandate when the customer: - Requests that you revoke the mandate. - Closes their account with you. Possible revoke mandate status values - - Revoked—the revoke mandate request was successfully processed. - Failed—the revoke mandate request was not accepted. #### Update Mandate: In most cases, the account details of an existing mandate cannot be updated in the Bacs schema, except by creating a new mandate. However, some very limited customer information, like name and address, can be updated to the mandate without needing to revoke it first #### Mandate Status: After the customer signs the mandate, request that the mandate status service verify the mandate status. Possible mandate status values: - Active—the mandate is successfully created. A direct debit can be sent for this mandate ID. - Pending—a pending mandate means the mandate is not yet signed. - Failed—the customer did not authenticate. - Expired—the deadline to create the mandate passed. - Revoked—the mandate is cancelled. #### Paypal Billing Agreement: A billing agreement is set up between PayPal and your customer. When you collect the details of a customer&#39;s billing agreement, you are able to bill that customer without requiring an authorization for each payment. You can bill the customer at the same time you process their PayPal Express checkout order, which simplifies your business processes.

Parameters:

  • modify_billing_agreement
  • id

    ID for de-registration or cancellation of Billing Agreement

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 41

def billing_agreements_de_registration_with_http_info(modify_billing_agreement, id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BillingAgreementsApi.billing_agreements_de_registration ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'modify_billing_agreement' is set
  if @api_client.config.client_side_validation && modify_billing_agreement.nil?
    fail ArgumentError, "Missing the required parameter 'modify_billing_agreement' when calling BillingAgreementsApi.billing_agreements_de_registration"
  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 BillingAgreementsApi.billing_agreements_de_registration"
  end
  # resource path
  local_var_path = 'pts/v2/billing-agreements/{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/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(modify_billing_agreement)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'ModifyBillingAgreement', @api_client.config.host)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PtsV2ModifyBillingAgreementPost201Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BillingAgreementsApi#billing_agreements_de_registration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#billing_agreements_intimation(intimate_billing_agreement, id, opts = {}) ⇒ PtsV2CreditsPost201Response1

Standing Instruction intimation Standing Instruction with or without Token.

Parameters:

  • intimate_billing_agreement
  • id

    ID for intimation of Billing Agreement

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



105
106
107
108
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 105

def billing_agreements_intimation(intimate_billing_agreement, id, opts = {})
  data, status_code, headers = billing_agreements_intimation_with_http_info(intimate_billing_agreement, id, opts)
  return data, status_code, headers
end

#billing_agreements_intimation_with_http_info(intimate_billing_agreement, id, opts = {}) ⇒ Array<(PtsV2CreditsPost201Response1, Fixnum, Hash)>

Standing Instruction intimation Standing Instruction with or without Token.

Parameters:

  • intimate_billing_agreement
  • id

    ID for intimation of Billing Agreement

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 116

def billing_agreements_intimation_with_http_info(intimate_billing_agreement, id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BillingAgreementsApi.billing_agreements_intimation ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'intimate_billing_agreement' is set
  if @api_client.config.client_side_validation && intimate_billing_agreement.nil?
    fail ArgumentError, "Missing the required parameter 'intimate_billing_agreement' when calling BillingAgreementsApi.billing_agreements_intimation"
  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 BillingAgreementsApi.billing_agreements_intimation"
  end
  # resource path
  local_var_path = 'pts/v2/billing-agreements/{id}/intimations'.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/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(intimate_billing_agreement)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'IntimateBillingAgreement', @api_client.config.host)
  auth_names = []
  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 => 'PtsV2CreditsPost201Response1')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BillingAgreementsApi#billing_agreements_intimation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#billing_agreements_registration(create_billing_agreement, opts = {}) ⇒ PtsV2CreateBillingAgreementPost201Response

Create a Billing Agreement #### Standing Instruction: Standing Instruction with or without Token. Transaction amount in case First payment is coming along with registration. Only 2 decimal places allowed #### Create Mandate: You can create a mandate through the direct debit mandate flow. Possible create mandate status values: - Pending—the create mandate request was successfully processed. - Failed—the create mandate request was not accepted. #### Import Mandate: In the Bacs scheme, a mandate is created with a status of active. Direct debit collections can be made against it immediately. You can import a mandate to the CyberSource database when: - You have existing customers with signed, active mandates - You manage mandates outside of CyberSource. When you import an existing mandate to the CyberSource database, provide a unique value for the mandate ID or the request results in an error. If an import mandate request is not accepted, the import mandate status value is failed.

Parameters:

  • create_billing_agreement
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



179
180
181
182
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 179

def billing_agreements_registration(create_billing_agreement, opts = {})
  data, status_code, headers = billing_agreements_registration_with_http_info(create_billing_agreement, opts)
  return data, status_code, headers
end

#billing_agreements_registration_with_http_info(create_billing_agreement, opts = {}) ⇒ Array<(PtsV2CreateBillingAgreementPost201Response, Fixnum, Hash)>

Create a Billing Agreement #### Standing Instruction: Standing Instruction with or without Token. Transaction amount in case First payment is coming along with registration. Only 2 decimal places allowed #### Create Mandate: You can create a mandate through the direct debit mandate flow. Possible create mandate status values: - Pending—the create mandate request was successfully processed. - Failed—the create mandate request was not accepted. #### Import Mandate: In the Bacs scheme, a mandate is created with a status of active. Direct debit collections can be made against it immediately. You can import a mandate to the CyberSource database when: - You have existing customers with signed, active mandates - You manage mandates outside of CyberSource. When you import an existing mandate to the CyberSource database, provide a unique value for the mandate ID or the request results in an error. If an import mandate request is not accepted, the import mandate status value is failed.

Parameters:

  • create_billing_agreement
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/cybersource_rest_client/api/billing_agreements_api.rb', line 189

def billing_agreements_registration_with_http_info(create_billing_agreement, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BillingAgreementsApi.billing_agreements_registration ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'create_billing_agreement' is set
  if @api_client.config.client_side_validation && create_billing_agreement.nil?
    fail ArgumentError, "Missing the required parameter 'create_billing_agreement' when calling BillingAgreementsApi.billing_agreements_registration"
  end
  # resource path
  local_var_path = 'pts/v2/billing-agreements'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(create_billing_agreement)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreateBillingAgreement', @api_client.config.host)
  auth_names = []
  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 => 'PtsV2CreateBillingAgreementPost201Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BillingAgreementsApi#billing_agreements_registration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end