killbill-orbital 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/orbital/api.rb +10 -4
- data/lib/orbital/ext/active_merchant/active_merchant.rb +21 -21
- data/lib/orbital/models/response.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79c94a1e5cf3ddacf63444b693a0b576353b3c7b
|
4
|
+
data.tar.gz: ccf210b4dd5e6e76047552eccfc00898ac27bc82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bfef0b4ec28065a2b8dba0acd47a8c2e8491cb85b2920dcb602c4c2e3d3356ed64a7f9a964aebeb04277a97569f3950ad6c3904d5ae68fd13c5fea0592dc823
|
7
|
+
data.tar.gz: 754d60b264e0d33e0dc58abcc4f76e8c316c3ce43bdcd602e709f1877a034983e12a78876e311e46b624e3f9c2468ce27ccbdab679d3a8b4abd9686d6f328650
|
data/lib/orbital/api.rb
CHANGED
@@ -35,10 +35,16 @@ module Killbill #:nodoc:
|
|
35
35
|
|
36
36
|
def capture_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
|
37
37
|
# Pass extra parameters for the gateway here
|
38
|
-
options =
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
options = properties_to_hash properties
|
39
|
+
if options[:force_capture]
|
40
|
+
last_auth_response = @response_model.send('auth_responses_from_kb_payment_id', kb_payment_id, context.tenant_id).last
|
41
|
+
raise "Unable to retrieve last authorization for operation=capture, kb_payment_id=#{kb_payment_id}, kb_payment_transaction_id=#{kb_payment_transaction_id}, kb_payment_method_id=#{kb_payment_method_id}" if last_auth_response.nil?
|
42
|
+
options[:payment_processor_account_id] = last_auth_response.payment_processor_account_id
|
43
|
+
options[:prior_auth_id] = last_auth_response.params_auth_code
|
44
|
+
purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, hash_to_properties(options), context)
|
45
|
+
else
|
46
|
+
super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
|
@@ -86,6 +86,7 @@ module ActiveMerchant
|
|
86
86
|
|
87
87
|
yield xml if block_given?
|
88
88
|
|
89
|
+
xml.tag! :PriorAuthID, parameters[:prior_auth_id] if parameters[:prior_auth_id]
|
89
90
|
xml.tag! :OrderID, format_order_id(parameters[:order_id])
|
90
91
|
xml.tag! :Amount, amount(money)
|
91
92
|
xml.tag! :Comments, parameters[:comments] if parameters[:comments]
|
@@ -113,42 +114,41 @@ module ActiveMerchant
|
|
113
114
|
|
114
115
|
# A – Authorization request
|
115
116
|
def authorize(money, creditcard, options = {})
|
116
|
-
order =
|
117
|
-
add_creditcard(xml, creditcard, options)
|
118
|
-
add_address(xml, creditcard, options)
|
119
|
-
if @options[:customer_profiles]
|
120
|
-
add_customer_data(xml, creditcard, options)
|
121
|
-
add_managed_billing(xml, options)
|
122
|
-
end
|
123
|
-
add_network_tokenization(xml, creditcard)
|
124
|
-
end
|
117
|
+
order = build_new_order_xml_with_cc(AUTH_ONLY, money, creditcard, options)
|
125
118
|
commit(order, :authorize, options[:trace_number])
|
126
119
|
end
|
127
120
|
|
128
|
-
# AC – Authorization and Capture
|
121
|
+
# AC – Authorization and Capture or Force Capture
|
129
122
|
def purchase(money, creditcard, options = {})
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
end
|
137
|
-
add_network_tokenization(xml, creditcard)
|
123
|
+
if options[:force_capture]
|
124
|
+
order = build_new_order_xml_with_cc(FORCE_AUTH_AND_CAPTURE, money, creditcard, options)
|
125
|
+
commit(order, :purchase, options[:trace_number])
|
126
|
+
else
|
127
|
+
order = build_new_order_xml_with_cc(AUTH_AND_CAPTURE, money, creditcard, options)
|
128
|
+
commit(order, :purchase, options[:trace_number])
|
138
129
|
end
|
139
|
-
|
130
|
+
end
|
131
|
+
|
132
|
+
# MFC - Mark For Capture or Force capture
|
133
|
+
def capture(money, authorization, options = {})
|
134
|
+
commit(build_mark_for_capture_xml(money, authorization, options), :capture)
|
140
135
|
end
|
141
136
|
|
142
137
|
def credit(money, creditcard, options= {})
|
143
|
-
order =
|
138
|
+
order = build_new_order_xml_with_cc(REFUND, money, creditcard, options)
|
139
|
+
commit(order, :credit, options[:trace_number])
|
140
|
+
end
|
141
|
+
|
142
|
+
def build_new_order_xml_with_cc(operation, money, creditcard, options)
|
143
|
+
build_new_order_xml(operation, money, options.merge(:creditcard=>creditcard)) do |xml|
|
144
144
|
add_creditcard(xml, creditcard, options)
|
145
145
|
add_address(xml, creditcard, options)
|
146
146
|
if @options[:customer_profiles]
|
147
147
|
add_customer_data(xml, creditcard, options)
|
148
148
|
add_managed_billing(xml, options)
|
149
149
|
end
|
150
|
+
add_network_tokenization(xml, creditcard)
|
150
151
|
end
|
151
|
-
commit(order, :credit, options[:trace_number])
|
152
152
|
end
|
153
153
|
|
154
154
|
def add_creditcard(xml, creditcard, options = {})
|
@@ -88,6 +88,10 @@ module Killbill #:nodoc:
|
|
88
88
|
params_order_id
|
89
89
|
end
|
90
90
|
|
91
|
+
def self.auth_responses_from_kb_payment_id(kb_payment_id, kb_tenant_id)
|
92
|
+
where(:kb_payment_id => kb_payment_id, :kb_tenant_id => kb_tenant_id, :api_call => 'authorize').order(:created_at)
|
93
|
+
end
|
94
|
+
|
91
95
|
def gateway_error_code
|
92
96
|
params_resp_code
|
93
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-orbital
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|