Class: ActiveMerchant::Billing::PayuInGateway
- Defined in:
- lib/active_merchant/billing/gateways/payu_in.rb
Constant Summary collapse
- TEST_INFO_URL =
'https://test.payu.in/merchant/postservice.php?form=2'
- LIVE_INFO_URL =
'https://info.payu.in/merchant/postservice.php?form=2'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PayuInGateway
constructor
A new instance of PayuInGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, card_brand, #card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ PayuInGateway
Returns a new instance of PayuInGateway.
19 20 21 22 |
# File 'lib/active_merchant/billing/gateways/payu_in.rb', line 19 def initialize( = {}) requires!(, :key, :salt) super end |
Instance Method Details
#purchase(money, payment, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_merchant/billing/gateways/payu_in.rb', line 24 def purchase(money, payment, = {}) requires!(, :order_id) post = {} add_invoice(post, money, ) add_payment(post, payment) add_addresses(post, ) add_customer_data(post, ) add_auth(post) MultiResponse.run do |r| r.process { commit(url('purchase'), post) } if r.params['enrolled'].to_s == '0' r.process { commit(r.params['post_uri'], r.params['form_post_vars']) } else r.process { handle_3dsecure(r) } end end end |
#refund(money, authorization, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/active_merchant/billing/gateways/payu_in.rb', line 44 def refund(money, , = {}) raise ArgumentError, 'Amount is required' unless money post = {} post[:command] = 'cancel_refund_transaction' post[:var1] = post[:var2] = generate_unique_id post[:var3] = amount(money) add_auth(post, :command, :var1) commit(url('refund'), post) end |
#scrub(transcript) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/active_merchant/billing/gateways/payu_in.rb', line 63 def scrub(transcript) transcript. gsub(/(ccnum=)[^&\n"]*(&|\n|"|$)/, '\1[FILTERED]\2'). gsub(/(ccvv=)[^&\n"]*(&|\n|"|$)/, '\1[FILTERED]\2'). gsub(/(card_hash=)[^&\n"]*(&|\n|"|$)/, '\1[FILTERED]\2'). gsub(/(ccnum":")[^"]*(")/, '\1[FILTERED]\2'). gsub(/(ccvv":")[^"]*(")/, '\1[FILTERED]\2') end |
#supports_scrubbing? ⇒ Boolean
59 60 61 |
# File 'lib/active_merchant/billing/gateways/payu_in.rb', line 59 def supports_scrubbing? true end |