-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Simple Pay Standard service definition.
Modified Simplepay module variable names to be more descriptive. Fixed authentication signature generation algorithm. Added convenience methods to Service to auto-set access id's and signature. Added method and action to generated form tags.
- Loading branch information
Showing
11 changed files
with
107 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'action_view/base' | ||
|
||
module Simplepay | ||
module Helpers | ||
|
||
module RailsHelper | ||
|
||
def simplepay_form_for(service_name, attributes = {}) | ||
service = get_simplepay_service(service_name) | ||
service.form(attributes) | ||
end | ||
|
||
|
||
private | ||
|
||
|
||
def get_simplepay_service(name) | ||
service = "Simplepay::Services::#{name.to_s.camelize}".constantize | ||
service.new | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
|
||
# Inject helper into Rails ActionView. | ||
ActionView::Base.__send__(:include, Simplepay::Helpers::RailsHelper) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Simplepay | ||
module Services | ||
|
||
## | ||
# The Amazon Simple Pay Standard service is used for one-time payments. | ||
# | ||
class Standard < Service | ||
|
||
ENDPOINT_URL = 'https://authorize.payments-sandbox.amazon.com/pba/paypipeline' | ||
SANDBOX_URL = 'https://authorize.payments-sandbox.amazon.com/pba/paypipeline' | ||
|
||
required_field :access_key | ||
required_field :signature | ||
required_field :account_id, :as => :amazon_payments_account_id | ||
|
||
required_field :description | ||
required_field :amount, :class => Support::Amount | ||
required_field :cobranding_style, :value => 'logo' | ||
|
||
field :reference_id | ||
field :immediate_return, :class => Support::Boolean | ||
field :collect_shipping_address, :class => Support::Boolean | ||
field :process_immediately, :class => Support::Boolean, | ||
:as => :process_immediate | ||
|
||
field :return_url | ||
field :ipn_url | ||
field :abandon_url | ||
|
||
# These fields are not currently utilized by the service | ||
field :variable_marketplace_fee, :value => '' | ||
field :donation_widget, :as => :is_donation_widget, | ||
:value => '0' | ||
field :fixed_marketplace_fee, :value => '' | ||
|
||
end | ||
|
||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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