Class: ActiveMerchant::Billing::WorldpayGateway
- Defined in:
- lib/active_merchant/billing/gateways/worldpay.rb
Defined Under Namespace
Classes: MultiResponse
Constant Summary collapse
- TEST_URL =
'https://secure-test.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp'
- LIVE_URL =
'https://secure.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp'
- CARD_CODES =
{ 'visa' => 'VISA-SSL', 'master' => 'ECMC-SSL', 'discover' => 'DISCOVER-SSL', 'american_express' => 'AMEX-SSL', }
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, payment_method, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ WorldpayGateway
constructor
A new instance of WorldpayGateway.
- #purchase(money, payment_method, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from Utils
#deprecated, generate_unique_id
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ WorldpayGateway
Returns a new instance of WorldpayGateway.
21 22 23 24 25 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 21 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 34 def (money, payment_method, = {}) requires!(, :order_id) commit 'authorize', (money, payment_method, ) end |
#capture(money, authorization, options = {}) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 39 def capture(money, , = {}) response = MultiResponse.new response << inquire(, ) unless [:authorization_validated] response << commit('capture', build_capture_request(money, , )) if response.success? response end |
#purchase(money, payment_method, options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 27 def purchase(money, payment_method, = {}) response = MultiResponse.new response << (money, payment_method, ) response << capture(money, response., :authorization_validated => true) if response.success? response end |
#refund(money, authorization, options = {}) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 53 def refund(money, , = {}) response = MultiResponse.new response << inquire(, ) response << commit('refund', build_refund_request(money, , )) if response.success? response end |
#void(authorization, options = {}) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/active_merchant/billing/gateways/worldpay.rb', line 46 def void(, = {}) response = MultiResponse.new response << inquire(, ) response << commit('cancel', build_void_request(, )) if response.success? response end |