Class: ActiveMerchant::Billing::WebpayGateway
- Inherits:
-
StripeGateway
- Object
- Gateway
- StripeGateway
- ActiveMerchant::Billing::WebpayGateway
- Defined in:
- lib/active_merchant/billing/gateways/webpay.rb
Constant Summary
Constants inherited from StripeGateway
StripeGateway::AVS_CODE_TRANSLATOR, StripeGateway::CURRENCIES_WITHOUT_FRACTIONS, StripeGateway::CVC_CODE_TRANSLATOR, StripeGateway::STANDARD_ERROR_CODE_MAPPING
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #add_customer(post, creditcard, options) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
- #refund(money, identification, options = {}) ⇒ Object
- #refund_fee(identification, options, meta) ⇒ Object
- #store(creditcard, options = {}) ⇒ Object
- #update(customer_id, creditcard, options = {}) ⇒ Object
Methods inherited from StripeGateway
#application_fee_from_response, #authorize, #initialize, #purchase, #refund_application_fee, #scrub, #supports_network_tokenization?, #supports_scrubbing?, #tokenize_apple_pay_token, #unstore, #update_customer, #verify, #void
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, #initialize, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::StripeGateway
Instance Method Details
#add_customer(post, creditcard, options) ⇒ Object
40 41 42 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 40 def add_customer(post, creditcard, ) post[:customer] = [:customer] if [:customer] && !creditcard.respond_to?(:number) end |
#capture(money, authorization, options = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 16 def capture(money, , = {}) post = {} add_amount(post, money, ) add_application_fee(post, ) commit(:post, "charges/#{CGI.escape()}/capture", post) end |
#refund(money, identification, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 23 def refund(money, identification, = {}) post = {} add_amount(post, money, ) MultiResponse.run do |r| r.process { commit(:post, "charges/#{CGI.escape(identification)}/refund", post, ) } return r unless [:refund_fee_amount] r.process { fetch_application_fees(identification, ) } r.process { refund_application_fee([:refund_fee_amount], application_fee_from_response(r), ) } end end |
#refund_fee(identification, options, meta) ⇒ Object
36 37 38 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 36 def refund_fee(identification, , ) raise NotImplementedError.new end |
#store(creditcard, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 44 def store(creditcard, = {}) post = {} add_creditcard(post, creditcard, ) post[:description] = [:description] post[:email] = [:email] if [:customer] MultiResponse.run(:first) do |r| r.process { commit(:post, "customers/#{CGI.escape([:customer])}/", post, ) } return r unless [:set_default] and r.success? and !r.params["id"].blank? r.process { update_customer([:customer], :default_card => r.params["id"]) } end else commit(:post, 'customers', post, ) end end |
#update(customer_id, creditcard, options = {}) ⇒ Object
63 64 65 66 67 |
# File 'lib/active_merchant/billing/gateways/webpay.rb', line 63 def update(customer_id, creditcard, = {}) post = {} add_creditcard(post, creditcard, ) commit(:post, "customers/#{CGI.escape(customer_id)}", post, ) end |