six_saferpay 1.5.0 → 1.16.2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.test.env +1 -1
- data/.travis.yml +4 -2
- data/Gemfile.lock +70 -85
- data/README.md +21 -3
- data/lib/six_saferpay/api.rb +1 -1
- data/lib/six_saferpay/api/six_batch/responses/close_response.rb +2 -2
- data/lib/six_saferpay/api/six_omni_channel/requests/insert_alias.rb +2 -2
- data/lib/six_saferpay/api/six_payment_page/requests/initialize.rb +4 -0
- data/lib/six_saferpay/api/six_payment_page/responses/assert_response.rb +11 -2
- data/lib/six_saferpay/api/six_payment_page/responses/{initalize_response.rb → initialize_response.rb} +0 -0
- data/lib/six_saferpay/api/six_secure_card_data/requests/update.rb +42 -0
- data/lib/six_saferpay/api/six_secure_card_data/responses/update_response.rb +29 -0
- data/lib/six_saferpay/api/six_secure_pay_gate_offer/requests/create_offer.rb +61 -0
- data/lib/six_saferpay/api/six_secure_pay_gate_offer/responses/create_offer_response.rb +26 -0
- data/lib/six_saferpay/api/six_transaction/requests/alternative_payment.rb +59 -0
- data/lib/six_saferpay/api/six_transaction/requests/authorize_direct.rb +4 -0
- data/lib/six_saferpay/api/six_transaction/requests/authorize_referenced.rb +4 -0
- data/lib/six_saferpay/api/six_transaction/requests/capture.rb +11 -2
- data/lib/six_saferpay/api/six_transaction/requests/initialize.rb +4 -0
- data/lib/six_saferpay/api/six_transaction/requests/query_alternative_payment.rb +35 -0
- data/lib/six_saferpay/api/six_transaction/requests/refund.rb +2 -2
- data/lib/six_saferpay/api/six_transaction/responses/adjust_amount_response.rb +1 -4
- data/lib/six_saferpay/api/six_transaction/responses/alternative_payment_response.rb +35 -0
- data/lib/six_saferpay/api/six_transaction/responses/authorize_direct_response.rb +11 -2
- data/lib/six_saferpay/api/six_transaction/responses/authorize_response.rb +11 -3
- data/lib/six_saferpay/api/six_transaction/responses/cancel_response.rb +1 -1
- data/lib/six_saferpay/api/six_transaction/responses/query_alternative_payment_response.rb +39 -0
- data/lib/six_saferpay/client.rb +8 -2
- data/lib/six_saferpay/clients/secure_pay_gate_api/client.rb +23 -0
- data/lib/six_saferpay/models/address.rb +4 -4
- data/lib/six_saferpay/models/alias_card.rb +20 -0
- data/lib/six_saferpay/models/authentication.rb +36 -0
- data/lib/six_saferpay/models/authentication_result.rb +20 -0
- data/lib/six_saferpay/models/bancontact.rb +20 -0
- data/lib/six_saferpay/models/bankcontact.rb +21 -0
- data/lib/six_saferpay/models/check_result.rb +6 -2
- data/lib/six_saferpay/models/chosen_plan.rb +62 -0
- data/lib/six_saferpay/models/custom_plan.rb +4 -0
- data/lib/six_saferpay/models/error.rb +0 -28
- data/lib/six_saferpay/models/first_installment_amount.rb +4 -0
- data/lib/six_saferpay/models/ideal.rb +18 -0
- data/lib/six_saferpay/models/installment_fee.rb +4 -0
- data/lib/six_saferpay/models/installment_plans.rb +73 -0
- data/lib/six_saferpay/models/mastercard_issuer_installments.rb +49 -0
- data/lib/six_saferpay/models/notification.rb +4 -4
- data/lib/six_saferpay/models/payment_method_options.rb +18 -0
- data/lib/six_saferpay/models/payment_methods_options.rb +4 -2
- data/lib/six_saferpay/models/pending_notification.rb +4 -4
- data/lib/six_saferpay/models/processing_data.rb +18 -0
- data/lib/six_saferpay/models/registration_result.rb +11 -2
- data/lib/six_saferpay/models/request_payment_means.rb +6 -2
- data/lib/six_saferpay/models/response_card.rb +0 -4
- data/lib/six_saferpay/models/saferpay_fields.rb +18 -0
- data/lib/six_saferpay/models/subsequent_installment_amount.rb +4 -0
- data/lib/six_saferpay/models/total_amont_due.rb +4 -0
- data/lib/six_saferpay/models/update_alias.rb +20 -0
- data/lib/six_saferpay/models/update_payment_means.rb +18 -0
- data/lib/six_saferpay/version.rb +1 -1
- data/six_saferpay.gemspec +8 -10
- metadata +52 -25
@@ -0,0 +1,39 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
module SixTransaction
|
3
|
+
class QueryAlternativePaymentResponse
|
4
|
+
|
5
|
+
attr_accessor(:response_header,
|
6
|
+
:transaction,
|
7
|
+
:payment_means,
|
8
|
+
:payer,
|
9
|
+
:liability
|
10
|
+
)
|
11
|
+
|
12
|
+
def initialize(response_header: ,
|
13
|
+
transaction: ,
|
14
|
+
payment_means: ,
|
15
|
+
payer: nil,
|
16
|
+
liability: nil)
|
17
|
+
|
18
|
+
|
19
|
+
@response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
|
20
|
+
@transaction = SixSaferpay::Transaction.new(transaction.to_h)
|
21
|
+
@payment_means = SixSaferpay::ResponsePaymentMeans.new(payment_means.to_h)
|
22
|
+
@payer = SixSaferpay::Payer.new(payer.to_h) if payer
|
23
|
+
@liability = SixSaferpay::Liability.new(liability.to_h) if liability
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_hash
|
27
|
+
hash = Hash.new
|
28
|
+
hash.merge!(response_header: @response_header.to_h) if @response_header
|
29
|
+
hash.merge!(transaction: @transaction.to_h) if @transaction
|
30
|
+
hash.merge!(payment_means: @payment_means.to_h) if @payment_means
|
31
|
+
hash.merge!(payer: @payer.to_h) if @payer
|
32
|
+
hash.merge!(liability: @liability.to_h) if @liability
|
33
|
+
hash
|
34
|
+
end
|
35
|
+
alias_method :to_h, :to_hash
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/six_saferpay/client.rb
CHANGED
@@ -17,17 +17,23 @@ module SixSaferpay
|
|
17
17
|
hash = @response.body
|
18
18
|
hash = JSON.parse(hash, symbolize_names: true)
|
19
19
|
hash = transform_response_hash(hash)
|
20
|
-
if @response.code ==
|
20
|
+
if @response.code == '200'
|
21
21
|
@object.response_class.new(hash)
|
22
22
|
else
|
23
23
|
raise SixSaferpay::Error.new(hash)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
protected
|
28
|
+
|
29
|
+
def header
|
30
|
+
{"Content-Type" => 'application/json'}
|
31
|
+
end
|
32
|
+
|
27
33
|
private
|
28
34
|
|
29
35
|
def request
|
30
|
-
request = Net::HTTP::Post.new(uri.path,
|
36
|
+
request = Net::HTTP::Post.new(uri.path, header)
|
31
37
|
hash = @object.to_h
|
32
38
|
hash = transform_request_hash(hash)
|
33
39
|
hash = hash.to_json
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
module SecurePayGateApi
|
3
|
+
class Client < SixSaferpay::Client
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
def header
|
8
|
+
super.merge!(
|
9
|
+
{
|
10
|
+
'Saferpay-ApiVersion' => SixSaferpay::API::VERSION,
|
11
|
+
'Saferpay-RequestId' => request_id()
|
12
|
+
}
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def request_id
|
19
|
+
@request_id ||= SecureRandom.uuid
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -8,7 +8,7 @@ module SixSaferpay
|
|
8
8
|
:gender,
|
9
9
|
:legal_form,
|
10
10
|
:street,
|
11
|
-
:
|
11
|
+
:street2,
|
12
12
|
:zip,
|
13
13
|
:city,
|
14
14
|
:country_subdevision_code,
|
@@ -25,7 +25,7 @@ module SixSaferpay
|
|
25
25
|
gender: nil,
|
26
26
|
legal_form: nil,
|
27
27
|
street: nil,
|
28
|
-
|
28
|
+
street2: nil,
|
29
29
|
zip: nil,
|
30
30
|
city: nil,
|
31
31
|
country_subdevision_code: nil,
|
@@ -40,7 +40,7 @@ module SixSaferpay
|
|
40
40
|
@gender = gender
|
41
41
|
@legal_form = legal_form
|
42
42
|
@street = street
|
43
|
-
@
|
43
|
+
@street2 = street2
|
44
44
|
@zip = zip
|
45
45
|
@city = city
|
46
46
|
@country_subdevision_code = country_subdevision_code
|
@@ -58,7 +58,7 @@ module SixSaferpay
|
|
58
58
|
hash.merge!(gender: @gender) if @gender
|
59
59
|
hash.merge!(legal_form: @legal_form) if @legal_form
|
60
60
|
hash.merge!(street: @street) if @street
|
61
|
-
hash.merge!(
|
61
|
+
hash.merge!(street2: @street2) if @street2.present?
|
62
62
|
hash.merge!(zip: @zip) if @zip
|
63
63
|
hash.merge!(city: @city) if @city
|
64
64
|
hash.merge!(country_subdevision_code: @country_subdevision_code) if @country_subdevision_code
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class AliasCard
|
3
|
+
|
4
|
+
attr_accessor(:exp_year, :exp_month)
|
5
|
+
|
6
|
+
def initialize(exp_year:, exp_month:)
|
7
|
+
@exp_year = exp_year
|
8
|
+
@exp_month = exp_month
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_hash
|
12
|
+
hash = Hash.new
|
13
|
+
hash.merge!(exp_year: @exp_year)
|
14
|
+
hash.merge!(exp_month: @exp_month)
|
15
|
+
hash
|
16
|
+
end
|
17
|
+
alias_method :to_h, :to_hash
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class Authentication
|
3
|
+
|
4
|
+
attr_accessor(
|
5
|
+
:result,
|
6
|
+
:message,
|
7
|
+
:xid,
|
8
|
+
:exemption,
|
9
|
+
:three_ds_challenge
|
10
|
+
)
|
11
|
+
|
12
|
+
def initialize(result: nil, # ATTENTION: This is in some case mandatory
|
13
|
+
message: nil, # ATTENTION: This is in some case mandatory
|
14
|
+
xid: nil,
|
15
|
+
exemption: nil,
|
16
|
+
three_ds_challenge: nil)
|
17
|
+
@result = result
|
18
|
+
@message = message
|
19
|
+
@xid = xid
|
20
|
+
@exemption = exemption
|
21
|
+
@three_ds_challenge = three_ds_challenge
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
hash = Hash.new
|
26
|
+
hash.merge!(result: @result) if @result
|
27
|
+
hash.merge!(message: @message) if @message
|
28
|
+
hash.merge!(xid: @xid) if @xid
|
29
|
+
hash.merge!(exemption: @exemption) if @exemption
|
30
|
+
hash.merge!(three_ds_challenge: @three_ds_challenge) if @three_ds_challenge
|
31
|
+
hash
|
32
|
+
end
|
33
|
+
alias_method :to_h, :to_hash
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class AuthenticationResult
|
3
|
+
|
4
|
+
attr_accessor :result, :message
|
5
|
+
|
6
|
+
def initialize(result:, message:)
|
7
|
+
@result = result
|
8
|
+
@message = message
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_hash
|
12
|
+
hash = Hash.new
|
13
|
+
hash.merge!(result: @result)
|
14
|
+
hash.merge!(message: @message)
|
15
|
+
hash
|
16
|
+
end
|
17
|
+
alias_method :to_h, :to_hash
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class Bancontact
|
3
|
+
|
4
|
+
attr_accessor :qr_code_data, :intent_url
|
5
|
+
|
6
|
+
def initialize(qr_code_data: nil, intent_url: nil)
|
7
|
+
@qr_code_data = qr_code_data
|
8
|
+
@intent_url = intent_url
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_hash
|
12
|
+
hash = Hash.new
|
13
|
+
hash.merge!(qr_code_data: @qr_code_data) if @qr_code_data
|
14
|
+
hash.merge!(intent_url: @intent_url) if @intent_url
|
15
|
+
hash
|
16
|
+
end
|
17
|
+
alias_method :to_h, :to_hash
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class Bankcontact
|
3
|
+
|
4
|
+
attr_accessor(:app_default_redirect_url,
|
5
|
+
:app_completion_redirect_url)
|
6
|
+
|
7
|
+
def initialize(app_default_redirect_url: nil, app_completion_redirect_url: nil)
|
8
|
+
@app_default_redirect_url = app_default_redirect_url
|
9
|
+
@app_completion_redirect_url = app_completion_redirect_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_hash
|
13
|
+
hash = Hash.new
|
14
|
+
hash.merge!(app_default_redirect_url: @app_default_redirect_url) if @app_default_redirect_url
|
15
|
+
hash.merge!(app_completion_redirect_url: @app_completion_redirect_url) if @app_completion_redirect_url
|
16
|
+
hash
|
17
|
+
end
|
18
|
+
alias_method :to_h, :to_hash
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -2,19 +2,23 @@ module SixSaferpay
|
|
2
2
|
class CheckResult
|
3
3
|
|
4
4
|
attr_accessor(:result,
|
5
|
-
:message
|
5
|
+
:message,
|
6
|
+
:authentication
|
6
7
|
)
|
7
8
|
|
8
9
|
def initialize(result:,
|
9
|
-
message:
|
10
|
+
message: ,
|
11
|
+
authentication: nil)
|
10
12
|
@result = result
|
11
13
|
@message = message
|
14
|
+
@authentication = authentication
|
12
15
|
end
|
13
16
|
|
14
17
|
def to_hash
|
15
18
|
hash = Hash.new
|
16
19
|
hash.merge!(result: @result) if @result
|
17
20
|
hash.merge!(message: @message) if @message
|
21
|
+
hash.merge!(authentication: @authentication.to_h) if @authentication
|
18
22
|
hash
|
19
23
|
end
|
20
24
|
alias_method :to_h, :to_hash
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class ChosenPlan
|
3
|
+
|
4
|
+
attr_accessor(
|
5
|
+
:minimum_number_of_installments,
|
6
|
+
:maximum_number_of_installments,
|
7
|
+
:interest_rate,
|
8
|
+
:installment_fee,
|
9
|
+
:annual_percentage_rate,
|
10
|
+
:total_amount_due,
|
11
|
+
)
|
12
|
+
|
13
|
+
def initialize(
|
14
|
+
minimum_number_of_installments: ,
|
15
|
+
maximum_number_of_installments: ,
|
16
|
+
interest_rate: nil,
|
17
|
+
installment_fee: nil,
|
18
|
+
annual_percentage_rate: nil,
|
19
|
+
total_amount_due: nil
|
20
|
+
)
|
21
|
+
@minimum_number_of_installments =
|
22
|
+
minimum_number_of_installments
|
23
|
+
@maximum_number_of_installments =
|
24
|
+
maximum_number_of_installments
|
25
|
+
@interest_rate = interest_rate
|
26
|
+
if installment_fee
|
27
|
+
@installment_fee = SixSaferpay::InstallmentFee
|
28
|
+
.new(installment_fee.to_h)
|
29
|
+
end
|
30
|
+
if annual_percentage_rate
|
31
|
+
@annual_percentage_rate = annual_percentage_rate
|
32
|
+
end
|
33
|
+
if total_amount_due
|
34
|
+
@total_amount_due = SixSaferpay::TotalAmountDue
|
35
|
+
.new(total_amount_due.to_h)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_hash
|
40
|
+
hash = Hash.new
|
41
|
+
hash.merge!(minimum_number_of_installments:
|
42
|
+
@minimum_number_of_installments)
|
43
|
+
hash.merge!(maximum_number_of_installments:
|
44
|
+
@maximum_number_of_installments)
|
45
|
+
if @interest_rate
|
46
|
+
hash.merge!(interest_rate: @interest_rate)
|
47
|
+
end
|
48
|
+
if @installment_fee
|
49
|
+
hash.merge!(installment_fee: @installment_fee.to_h)
|
50
|
+
end
|
51
|
+
if @annual_percentage_rate
|
52
|
+
hash.merge!(annual_percentage_rate: @annual_percentage_rate)
|
53
|
+
end
|
54
|
+
if @total_amount_due
|
55
|
+
hash.merge!(total_amount_due: @total_amount_due.to_h)
|
56
|
+
end
|
57
|
+
hash
|
58
|
+
end
|
59
|
+
alias_method :to_h, :to_hash
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module SixSaferpay
|
2
|
-
class RegistrationError
|
3
|
-
|
4
|
-
attr_accessor(:success,
|
5
|
-
:fd_alias,
|
6
|
-
:error
|
7
|
-
)
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(success:,
|
11
|
-
fd_alias: nil,
|
12
|
-
error: nil)
|
13
|
-
|
14
|
-
binding.pry
|
15
|
-
@success = success
|
16
|
-
@fd_alias = SixSaferpay::RegistrationAlias.new(fd_alias.to_h) if fd_alias
|
17
|
-
@error = SixSaferpay::RegistrationError.new(error.to_h) if error
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_hash
|
21
|
-
hash = Hash.new
|
22
|
-
hash.merge!(sucess: @sucess) if @success
|
23
|
-
hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
|
24
|
-
hash.merge!(error: @error.to_h) if @error
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class Ideal
|
3
|
+
|
4
|
+
attr_accessor(:issuer_id)
|
5
|
+
|
6
|
+
def initialize(issuer_id:)
|
7
|
+
@issuer_id = issuer_id
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_hash
|
11
|
+
hash = Hash.new
|
12
|
+
hash.merge!(issuer_id: @issuer_id) if @issuer_id
|
13
|
+
hash
|
14
|
+
end
|
15
|
+
alias_method :to_h, :to_hash
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module SixSaferpay
|
2
|
+
class InstallmentPlans
|
3
|
+
|
4
|
+
attr_accessor(
|
5
|
+
:number_of_installments,
|
6
|
+
:interest_rate,
|
7
|
+
:installment_fee,
|
8
|
+
:annual_percentage_rate,
|
9
|
+
:first_installment_amount,
|
10
|
+
:subsequent_installment_amount,
|
11
|
+
:total_amount_due
|
12
|
+
)
|
13
|
+
|
14
|
+
def initialize(
|
15
|
+
number_of_installments: ,
|
16
|
+
interest_rate: nil,
|
17
|
+
installment_fee: nil,
|
18
|
+
annual_percentage_rate: nil,
|
19
|
+
first_installment_amount: nil,
|
20
|
+
subsequent_installment_amount: nil,
|
21
|
+
total_amount_due: nil
|
22
|
+
)
|
23
|
+
@number_of_installments = number_of_installments
|
24
|
+
@interest_rate = interest_rate
|
25
|
+
if installment_fee
|
26
|
+
@installment_fee = SixSaferpay::InstallmentFee
|
27
|
+
.new(installment_fee.to_h)
|
28
|
+
end
|
29
|
+
if annual_percentage_rate
|
30
|
+
@annual_percentage_rate = annual_percentage_rate
|
31
|
+
end
|
32
|
+
if first_installment_amount
|
33
|
+
@first_installment_amount = SixSaferpay::FirstInstallmentAmount
|
34
|
+
.new(first_installment_amount.to_h)
|
35
|
+
end
|
36
|
+
if subsequent_installment_amount
|
37
|
+
@subsequent_installment_amount = SixSaferpay::SubsequentInstallmentAmount
|
38
|
+
.new(subsequent_installment_amount.to_h)
|
39
|
+
end
|
40
|
+
if total_amount_due
|
41
|
+
@total_amount_due = SixSaferpay::TotalAmountDue
|
42
|
+
.new(total_amount_due.to_h)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_hash
|
47
|
+
hash = Hash.new
|
48
|
+
hash.merge!(number_of_installments: @number_of_installments)
|
49
|
+
if @interest_rate
|
50
|
+
hash.merge!(interest_rate: @interest_rate)
|
51
|
+
end
|
52
|
+
if @installment_fee
|
53
|
+
hash.merge!(installment_fee: @installment_fee.to_h)
|
54
|
+
end
|
55
|
+
if @annual_percentage_rate
|
56
|
+
hash.merge!(annual_percentage_rate: @annual_percentage_rate)
|
57
|
+
end
|
58
|
+
if @first_installment_amount
|
59
|
+
hash.merge!(first_installment_amount: @first_installment_amount.to_h)
|
60
|
+
end
|
61
|
+
if @subsequent_installment_amount
|
62
|
+
hash.merge!(subsequent_installment_amount: @subsequent_installment_amount.to_h)
|
63
|
+
end
|
64
|
+
if @total_amount_due
|
65
|
+
hash.merge!(total_amount_due: @total_amount_due.to_h)
|
66
|
+
end
|
67
|
+
hash
|
68
|
+
end
|
69
|
+
alias_method :to_h, :to_hash
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|