Created
October 5, 2013 14:52
-
-
Save ntalbott/6841857 to your computer and use it in GitHub Desktop.
Thoughts on wrapping the Realex Vault API for ActiveMerchant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response = store(cc) | |
token = response.authorization #=> "#{payer_ref}:#{card_ref}" | |
update(token, {...}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def store(cc, options={}) | |
payer_ref = (options[:customer] || generate_unique_id[0...30]) | |
card_ref = (options[:card_reference] || generate_unique_id[0...30]) | |
MultiResponse.new.tap do |r| | |
r.process{store_payer(payer_ref, options)} | |
r.process{store_card(payer_ref, card_ref, options)} | |
end | |
end | |
def update(token, options) | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment