Class: CyberSourceMergedSpec::BillingAgreementsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/billing_agreements_controller.rb

Overview

BillingAgreementsController

Constant Summary

Constants inherited from BaseController

CyberSourceMergedSpec::BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#billing_agreements_de_registration(modify_billing_agreement, id) ⇒ ApiResponse

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. parameter: TODO: type description here cancellation of Billing Agreement

Parameters:

  • modify_billing_agreement (ModifyBillingAgreement)

    Required

  • id (String)

    Required parameter: ID for de-registration or

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/controllers/billing_agreements_controller.rb', line 98

def billing_agreements_de_registration(modify_billing_agreement,
                                       id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/pts/v2/billing-agreements/{id}',
                                 Server::DEFAULT)
               .body_param(new_parameter(modify_billing_agreement)
                            .is_required(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PtsV2ModifyBillingAgreementPost201Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             PtsV2ModifyBillingAgreementPost400ResponseException)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2ModifyBillingAgreementPost502ResponseException))
    .execute
end

#billing_agreements_intimation(intimate_billing_agreement, id) ⇒ ApiResponse

Standing Instruction with or without Token. parameter: TODO: type description here Agreement

Parameters:

  • intimate_billing_agreement (IntimateBillingAgreement)

    Required

  • id (String)

    Required parameter: ID for intimation of Billing

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/cyber_source_merged_spec/controllers/billing_agreements_controller.rb', line 131

def billing_agreements_intimation(intimate_billing_agreement,
                                  id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/pts/v2/billing-agreements/{id}/intimations',
                                 Server::DEFAULT)
               .body_param(new_parameter(intimate_billing_agreement)
                            .is_required(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PtsV2CreditsPost201Response1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             PtsV2CreditsPost400Response2Exception)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2CreditsPost502Response2Exception))
    .execute
end

#billing_agreements_registration(create_billing_agreement) ⇒ ApiResponse

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. parameter: TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/controllers/billing_agreements_controller.rb', line 31

def billing_agreements_registration(create_billing_agreement)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/pts/v2/billing-agreements',
                                 Server::DEFAULT)
               .body_param(new_parameter(create_billing_agreement)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PtsV2CreateBillingAgreementPost201Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             PtsV2CreateBillingAgreementPost400ResponseException)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2CreateBillingAgreementPost502ResponseException))
    .execute
end