workarea-forter 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +2 -1
- data/README.md +28 -42
- data/Rakefile +4 -4
- data/app/services/workarea/forter/tender/credit_card.rb +11 -1
- data/config/initializers/workarea.rb +3 -1
- data/lib/workarea/forter/version.rb +1 -1
- data/test/services/workarea/forter/order_test.rb +28 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c4f679107573bc38a3e4a2ec421d83e53a85907082c678ff47553c4b3f9785
|
4
|
+
data.tar.gz: 1aa0edd84330d5b6fee488117362f134f38b2e2763951585cfc36ce1de1c810d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2813c8e8aad7976352238666d8aeccb569e443f946f726ae0d2281c3346602940449613ac1b311da9fd3d8ac86e2420eaaf488c67fdee5ffecfcdc376ad88835
|
7
|
+
data.tar.gz: 877214170590717f90ac8ada8d3db7f57c84be2a62842f156cdfcbb2d7fcc26a6ca1e767a6adddaf72e85f2872c8cff9b5afa799923cc8b9b853d501628fa377
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
Workarea Forter 1.2.4 (2019-10-16)
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
* Set default Forter API version to 2.3
|
5
|
+
|
6
|
+
API version 2.3 allows for the general payment option, which
|
7
|
+
allows users to pass payment types that are not explicitly supported
|
8
|
+
by Forter.
|
9
|
+
Jeff Yucis
|
10
|
+
|
11
|
+
* Add additional data to forter credit card tender data.
|
12
|
+
|
13
|
+
Adds the gateway name and transaction ID to the credit card
|
14
|
+
information sent to forter when making a decision.
|
15
|
+
Jeff Yucis
|
16
|
+
|
17
|
+
* Update README
|
18
|
+
|
19
|
+
Matt Duffy
|
20
|
+
|
21
|
+
|
22
|
+
|
1
23
|
Workarea Forter 1.2.3 (2019-09-17)
|
2
24
|
--------------------------------------------------------------------------------
|
3
25
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,6 +20,24 @@ This plugin is compatible with following Workarea supported payment types:
|
|
20
20
|
|
21
21
|
Payment types not in this list will still function but are not eligible for fraud protection.
|
22
22
|
|
23
|
+
Getting Started
|
24
|
+
--------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
Add the gem to your application's Gemfile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# ...
|
30
|
+
gem 'workarea-forter'
|
31
|
+
# ...
|
32
|
+
```
|
33
|
+
|
34
|
+
Update your application's bundle.
|
35
|
+
|
36
|
+
```bash
|
37
|
+
cd path/to/application
|
38
|
+
bundle
|
39
|
+
```
|
40
|
+
|
23
41
|
Configuration
|
24
42
|
--------------------------------------------------------------------------------
|
25
43
|
Add the secret key to your secrets file:
|
@@ -43,6 +61,12 @@ You can specify which version of the API via configuration:
|
|
43
61
|
|
44
62
|
If no API version is configured the default of **2.2** will be used.
|
45
63
|
|
64
|
+
Setting a configuration value for ```credit_card_gateway_name``` value will improve the decision accuracy. This is the name of the credit card processor used by the host application.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
Workarea.config.forter.credit_card_gateway_name = "Stripe"
|
68
|
+
```
|
69
|
+
|
46
70
|
Implementation Notes
|
47
71
|
--------------------------------------------------------------------------------
|
48
72
|
**Verifcation Data**
|
@@ -64,50 +88,12 @@ Be sure to test that the following data is sent in the **verificationResults**
|
|
64
88
|
|
65
89
|
Credit card authorizations are voided when a transaction is deemed to be fraudulent. The void action relies on the #cancel! method implemented on each tenders authorization class. It is very important to implement and test this method when creating a new payment type.
|
66
90
|
|
67
|
-
|
68
|
-
Getting Started
|
91
|
+
Workarea Commerce Documentation
|
69
92
|
--------------------------------------------------------------------------------
|
70
93
|
|
71
|
-
|
94
|
+
See [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation.
|
72
95
|
|
73
|
-
|
74
|
-
|
75
|
-
Workarea gems are hosted privately at https://gems.weblinc.com/.
|
76
|
-
You must have individual or team credentials to install gems from this server. Add your gems server credentials to Bundler:
|
77
|
-
|
78
|
-
bundle config gems.weblinc.com my_username:my_password
|
79
|
-
|
80
|
-
Or set the appropriate environment variable in a shell startup file:
|
81
|
-
|
82
|
-
export BUNDLE_GEMS__WEBLINC__COM='my_username:my_password'
|
83
|
-
|
84
|
-
Then add the gem to your application's Gemfile specifying the source:
|
85
|
-
|
86
|
-
# ...
|
87
|
-
gem 'workarea-forter', source: 'https://gems.weblinc.com'
|
88
|
-
# ...
|
89
|
-
|
90
|
-
Or use a source block:
|
91
|
-
|
92
|
-
# ...
|
93
|
-
source 'https://gems.weblinc.com' do
|
94
|
-
gem 'workarea-forter'
|
95
|
-
end
|
96
|
-
# ...
|
97
|
-
|
98
|
-
Update your application's bundle.
|
99
|
-
|
100
|
-
cd path/to/application
|
101
|
-
bundle
|
102
|
-
|
103
|
-
Workarea Platform Documentation
|
96
|
+
License
|
104
97
|
--------------------------------------------------------------------------------
|
105
98
|
|
106
|
-
|
107
|
-
|
108
|
-
Copyright & Licensing
|
109
|
-
--------------------------------------------------------------------------------
|
110
|
-
|
111
|
-
Copyright WebLinc 2018. All rights reserved.
|
112
|
-
|
113
|
-
For licensing, contact sales@workarea.com.
|
99
|
+
Workarea Forter is released under the [Business Software License](LICENSE)
|
data/Rakefile
CHANGED
@@ -34,10 +34,10 @@ desc "Release version #{Workarea::Forter::VERSION} of the gem"
|
|
34
34
|
task :release do
|
35
35
|
host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
Rake::Task['workarea:changelog'].execute
|
38
|
+
system 'git add CHANGELOG.md'
|
39
|
+
system 'git commit -m "Update CHANGELOG"'
|
40
|
+
system 'git push origin HEAD'
|
41
41
|
|
42
42
|
system "git tag -a v#{Workarea::Forter::VERSION} -m 'Tagging #{Workarea::Forter::VERSION}'"
|
43
43
|
system 'git push --tags'
|
@@ -19,7 +19,8 @@ module Workarea
|
|
19
19
|
expirationMonth: cc_month(tender.month),
|
20
20
|
expirationYear: tender.year.to_s,
|
21
21
|
cardBrand: tender.issuer,
|
22
|
-
nameOnCard: "#{address.first_name} #{address.last_name}"
|
22
|
+
nameOnCard: "#{address.first_name} #{address.last_name}",
|
23
|
+
paymentGatewayData: payment_gateway_data
|
23
24
|
}.merge!(verification_results)
|
24
25
|
}
|
25
26
|
end
|
@@ -67,6 +68,15 @@ module Workarea
|
|
67
68
|
gateway_class = Workarea.config.gateways.credit_card.class.to_s
|
68
69
|
Workarea.config.forter.response_code[gateway_class].call(transaction) rescue nil
|
69
70
|
end
|
71
|
+
|
72
|
+
def payment_gateway_data
|
73
|
+
return unless tender.transactions.present? && transaction.present?
|
74
|
+
|
75
|
+
{
|
76
|
+
gatewayName: Workarea::Forter.config.credit_card_gateway_name || "not specified",
|
77
|
+
gatewayTransactionId: transaction.response.authorization.to_s
|
78
|
+
}
|
79
|
+
end
|
70
80
|
end
|
71
81
|
end
|
72
82
|
end
|
@@ -5,11 +5,13 @@ Workarea.configure do |config|
|
|
5
5
|
config.forter = ActiveSupport::Configurable::Configuration.new
|
6
6
|
config.forter.site_id = nil
|
7
7
|
|
8
|
-
config.forter.api_version = "2.
|
8
|
+
config.forter.api_version = "2.3"
|
9
9
|
|
10
10
|
config.forter.api_timeout = 2
|
11
11
|
config.forter.open_timeout = 2
|
12
12
|
|
13
|
+
config.forter.credit_card_gateway_name = nil # name of payment gateway used, ie. Stripe
|
14
|
+
|
13
15
|
config.forter.response_code = {
|
14
16
|
'ActiveMerchant::Billing::StripeGateway' => -> (transaction) { transaction.params['failure_code'] },
|
15
17
|
'ActiveMerchant::Billing::BraintreeBlueGateway' => -> (transaction) { transaction.response.params["braintree_transaction"]["processor_response_code"] },
|
@@ -4,36 +4,43 @@ module Workarea
|
|
4
4
|
module Foter
|
5
5
|
class OrderTest < Workarea::TestCase
|
6
6
|
def test_to_h
|
7
|
-
|
8
|
-
|
9
|
-
hsh = Forter::Order.new(order).to_h
|
7
|
+
Workarea.with_config do |config|
|
8
|
+
config.forter.credit_card_gateway_name = "cc_processor"
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
user = create_user(id: 'u-1234', first_name: 'jeffy', last_name: 'tester')
|
11
|
+
order = create_placed_forter_order(overrides = { id: '1234', user_id: user.id })
|
12
|
+
hsh = Forter::Order.new(order).to_h
|
13
|
+
|
14
|
+
payment = Workarea::Payment.find('1234')
|
15
|
+
shipping = Workarea::Shipping.find_by_order('1234')
|
16
|
+
|
17
|
+
assert_equal(order.id, hsh[:orderId])
|
18
|
+
assert_equal("WEB", hsh[:orderType])
|
13
19
|
|
14
|
-
|
15
|
-
|
20
|
+
assert_equal(payment.address.first_name, hsh[:primaryRecipient][:personalDetails][:firstName])
|
21
|
+
assert_equal(payment.address.last_name, hsh[:primaryRecipient][:personalDetails][:lastName])
|
16
22
|
|
17
|
-
|
18
|
-
|
23
|
+
assert_equal(shipping.address.street, hsh[:primaryRecipient][:address][:address1])
|
24
|
+
assert_equal(shipping.address.city, hsh[:primaryRecipient][:address][:city])
|
25
|
+
assert_equal(shipping.address.country.alpha2, hsh[:primaryRecipient][:address][:country])
|
19
26
|
|
20
|
-
|
21
|
-
assert_equal(shipping.address.city, hsh[:primaryRecipient][:address][:city])
|
22
|
-
assert_equal(shipping.address.country.alpha2, hsh[:primaryRecipient][:address][:country])
|
27
|
+
assert_equal(order.total_price.to_s, hsh[:totalAmount][:amountUSD])
|
23
28
|
|
24
|
-
|
29
|
+
assert_equal(1, hsh[:cartItems].size)
|
25
30
|
|
26
|
-
|
31
|
+
assert_equal(1, hsh[:payment].size)
|
32
|
+
assert_equal(order.total_price.to_s, hsh[:payment].first[:amount][:amountUSD])
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
assert_equal("cc_processor", hsh[:payment].first[:creditCard][:paymentGatewayData][:gatewayName])
|
35
|
+
assert(hsh[:payment].first[:creditCard][:paymentGatewayData][:gatewayTransactionId].present?)
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
37
|
+
assert_equal(user.first_name, hsh[:accountOwner][:firstName])
|
38
|
+
assert_equal(user.last_name, hsh[:accountOwner][:lastName])
|
39
|
+
assert_equal(user.email, hsh[:accountOwner][:email])
|
40
|
+
assert_equal(user.id, hsh[:accountOwner][:accountId])
|
35
41
|
|
36
|
-
|
42
|
+
assert_equal("123ABC", hsh[:connectionInformation][:forterTokenCookie])
|
43
|
+
end
|
37
44
|
end
|
38
45
|
|
39
46
|
def test_to_h_with_no_shipping_address
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-forter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Yucis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: workarea
|