Class: Skrill::Payment
- Inherits:
-
Object
- Object
- Skrill::Payment
- Includes:
- Utils
- Defined in:
- lib/skrill/payment.rb,
lib/skrill/payment/utils.rb,
lib/skrill/payment/version.rb
Defined Under Namespace
Modules: Utils Classes: Configuration, Request
Constant Summary collapse
- OPTIONS =
[:email, :amount, :identifier]
- VERSION =
'0.3.' + (ENV['BUILD_VERSION'] || '0')
Instance Method Summary collapse
-
#deliver ⇒ Request
Sends a payment request to Skrill.
-
#error_message ⇒ String?
Returns the error message from Skrill or nil when the payment was successful.
-
#initialize(payment_data = {}) {|_self| ... } ⇒ Skrill::Payment
constructor
Prepares a new payment using the configuration attributes when provided and the payment attributes.
-
#successful? ⇒ true, false
Checks if the payment has been delivered and was successful.
Methods included from Utils
#assign_attirbutes, #serialize_arguments
Constructor Details
#initialize(payment_data = {}) {|_self| ... } ⇒ Skrill::Payment
Prepares a new payment using the configuration attributes when provided and the payment attributes. The configuration attributes can be overwritten by using in the same Hash keys or methods. Attributes can be passed in by using a block or a Hash.
33 34 35 36 37 |
# File 'lib/skrill/payment.rb', line 33 def initialize(payment_data = {}, &block) assign_attirbutes(payment_data) yield(self) if block_given? end |
Instance Method Details
#deliver ⇒ Request
Sends a payment request to Skrill. Use the ‘successful?` method to check if the Skrill was able to process the payment successfully.
45 46 47 |
# File 'lib/skrill/payment.rb', line 45 def deliver @request = Skrill::Payment::Request.post(config_data, payment_data) end |
#error_message ⇒ String?
Returns the error message from Skrill or nil when the payment was successful.
64 65 66 |
# File 'lib/skrill/payment.rb', line 64 def @request. end |
#successful? ⇒ true, false
Checks if the payment has been delivered and was successful.
54 55 56 |
# File 'lib/skrill/payment.rb', line 54 def successful? !!@request && @request.successful? end |