Class: VisaAcceptanceMergedSpec::BillingAgreementsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/apis/billing_agreements_api.rb

Overview

BillingAgreementsApi

Constant Summary

Constants inherited from BaseApi

VisaAcceptanceMergedSpec::BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

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

Constructor Details

This class inherits a constructor from VisaAcceptanceMergedSpec::BaseApi

Instance Method Details

#billing_agreements_de_registration(id, body) ⇒ 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. cancellation of Billing Agreement description here

Parameters:

  • id (String)

    Required parameter: ID for de-registration or

  • body (ModifyBillingAgreement)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/visa_acceptance_merged_spec/apis/billing_agreements_api.rb', line 100

def billing_agreements_de_registration(id,
                                       body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/pts/v2/billing-agreements/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('BearerAuth', 'Accept')))
    .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.',
                             PtsV2ModifyBillingAgreementPost400Response1Exception)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2ModifyBillingAgreementPost502Response1Exception))
    .execute
end

#billing_agreements_intimation(id, body) ⇒ ApiResponse

Standing Instruction with or without Token. Agreement description here

Parameters:

  • id (String)

    Required parameter: ID for intimation of Billing

  • body (IntimateBillingAgreement)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/visa_acceptance_merged_spec/apis/billing_agreements_api.rb', line 134

def billing_agreements_intimation(id,
                                  body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/pts/v2/billing-agreements/{id}/intimations',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('BearerAuth', 'Accept')))
    .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.',
                             PtsV2CreditsPost400Response21Exception)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2CreditsPost502Response21Exception))
    .execute
end

#billing_agreements_registration(body) ⇒ 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 Visa Acceptance database when:

- You have existing customers with signed, active mandates
- You manage mandates outside of Visa Acceptance.

When you import an existing mandate to the Visa Acceptance 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. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/visa_acceptance_merged_spec/apis/billing_agreements_api.rb', line 32

def billing_agreements_registration(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/pts/v2/billing-agreements',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('BearerAuth', 'Accept')))
    .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.',
                             PtsV2CreateBillingAgreementPost400Response1Exception)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             PtsV2CreateBillingAgreementPost502Response1Exception))
    .execute
end