Skip to content

Commit

Permalink
Merge pull request #81 from Shopify/update_sofort
Browse files Browse the repository at this point in the history
update reason1 field per sofort request
  • Loading branch information
j-mutter committed Mar 11, 2015
2 parents 22adb04 + 0e50ed0 commit b087a6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lib/offsite_payments/integrations/directebanking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Helper < OffsitePayments::Helper
# credential4: Notification Password (Algorithm: SH1)
def initialize(order, account, options = {})
super
add_field('user_variable_0', order)
add_field('project_id', options[:credential2])
@project_password = options[:credential3]
end
Expand Down Expand Up @@ -112,7 +111,7 @@ def form_fields
mapping :account, 'user_id'
mapping :amount, 'amount'
mapping :currency, 'currency_id'
mapping :description, 'reason_1'
mapping :order, 'reason_1'

mapping :return_url, 'user_variable_1'
mapping :cancel_return_url, 'user_variable_2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ def test_basic_helper_fields
assert_field 'user_id', 'UserID-24352435'
assert_field 'project_id', 'ProjectID-1234'
assert_field 'amount', '5.00'
assert_field 'user_variable_0', 'order-500'
assert_field 'reason_1', 'My order #1234'
assert_field 'reason_1', 'order-500'
end

def test_generate_signature_string
assert_equal "UserID-24352435|ProjectID-1234|||||5.00|EUR|||order-500|https://localhost:8080/directebanking|||||mysecretString",
assert_equal "UserID-24352435|ProjectID-1234|||||5.00|EUR|order-500|||https://localhost:8080/directebanking|||||mysecretString",
@helper.generate_signature_string
end

def test_generate_signature
assert !@helper.form_fields['hash'].empty?
assert_equal 'c34113bc04eb28a045fe5c2b1e9e186fe3cde03b', @helper.generate_signature
assert_equal "c34113bc04eb28a045fe5c2b1e9e186fe3cde03b", @helper.form_fields['hash']
assert_equal '669884aeab85fedb5ed4c9614d91fcf5dde19d9f', @helper.generate_signature
assert_equal "669884aeab85fedb5ed4c9614d91fcf5dde19d9f", @helper.form_fields['hash']
end

def test_unknown_mapping
Expand Down

0 comments on commit b087a6c

Please sign in to comment.