Class: MultiSafePay::Order

Inherits:
Base
  • Object
show all
Defined in:
lib/multisafepay/order.rb

Constant Summary collapse

STATUS_CANCELLED =
"cancelled".freeze
STATUS_COMPLETED =
"completed".freeze
STATUS_DECLINED =
"declined".freeze
STATUS_EXPIRED =
"expired".freeze
STATUS_INITIALIZED =
"initialized".freeze
STATUS_REFUNDED =
"refunded".freeze
STATUS_RESERVED =
"reserved".freeze
STATUS_SHIPPED =
"shipped".freeze
STATUS_UNCLEARED =
"uncleared".freeze
STATUS_VOID =
"void".freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, #assign_attributes, cancel, create, #delete, delete, get, id_param, #initialize, parent_id, request, resource_name, update, #update

Constructor Details

This class inherits a constructor from MultiSafePay::Base

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def amount
  @amount
end

#amount_refundedObject

Returns the value of attribute amount_refunded.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def amount_refunded
  @amount_refunded
end

#auth_order_idObject

Returns the value of attribute auth_order_id.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def auth_order_id
  @auth_order_id
end

#costsObject

Returns the value of attribute costs.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def costs
  @costs
end

#createdObject

Returns the value of attribute created.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def created
  @created
end

#currencyObject

Returns the value of attribute currency.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def currency
  @currency
end

#customerObject

Returns the value of attribute customer.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def customer
  @customer
end

#deliveryObject

Returns the value of attribute delivery.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def delivery
  @delivery
end

#descriptionObject

Returns the value of attribute description.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def description
  @description
end

#fastcheckoutObject

Returns the value of attribute fastcheckout.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def fastcheckout
  @fastcheckout
end

#financial_statusObject

Returns the value of attribute financial_status.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def financial_status
  @financial_status
end

#gatewayObject

Returns the value of attribute gateway.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def gateway
  @gateway
end

#itemsObject

Returns the value of attribute items.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def items
  @items
end

#modifiedObject

Returns the value of attribute modified.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def modified
  @modified
end

#order_idObject

Returns the value of attribute order_id.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def order_id
  @order_id
end

#payment_detailsObject

Returns the value of attribute payment_details.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def payment_details
  @payment_details
end

#payment_methodsObject

Returns the value of attribute payment_methods.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def payment_methods
  @payment_methods
end

#payment_optionsObject

Returns the value of attribute payment_options.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def payment_options
  @payment_options
end

#payment_urlObject

Returns the value of attribute payment_url.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def payment_url
  @payment_url
end

#reasonObject

Returns the value of attribute reason.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def reason
  @reason
end

#reason_codeObject

Returns the value of attribute reason_code.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def reason_code
  @reason_code
end

Returns the value of attribute related_transactions.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def related_transactions
  @related_transactions
end

#session_idObject

Returns the value of attribute session_id.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def session_id
  @session_id
end

#shopping_cartObject

Returns the value of attribute shopping_cart.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def shopping_cart
  @shopping_cart
end

#statusObject

Returns the value of attribute status.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def status
  @status
end

#transaction_idObject

Returns the value of attribute transaction_id.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def transaction_id
  @transaction_id
end

#typeObject

Returns the value of attribute type.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def type
  @type
end

#var1Object

Returns the value of attribute var1.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def var1
  @var1
end

#var2Object

Returns the value of attribute var2.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def var2
  @var2
end

#var3Object

Returns the value of attribute var3.



14
15
16
# File 'lib/multisafepay/order.rb', line 14

def var3
  @var3
end

Class Method Details

.cancel_payment(order_id, data = {}) ⇒ Object

Raises:

  • (ArgumentError)


118
119
120
121
122
123
124
125
# File 'lib/multisafepay/order.rb', line 118

def self.cancel_payment(order_id, data = {})
  raise ArgumentError, "reason is required" unless data["reason"]

  Client.instance.delete("capture/#{order_id}", nil, data.merge({
    status: STATUS_CANCELLED,
    reason: data["reason"]
  }))
end

.capture(order_id, data = {}) ⇒ Object



114
115
116
# File 'lib/multisafepay/order.rb', line 114

def self.capture(order_id, data = {})
  Client.instance.post("orders/#{order_id}/capture", nil, data)
end

.refund(order_id, data = {}) ⇒ Object



110
111
112
# File 'lib/multisafepay/order.rb', line 110

def self.refund(order_id, data = {})
  Client.instance.post("orders/#{order_id}/refunds", nil, data)
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/multisafepay/order.rb', line 45

def cancelled?
  status == STATUS_CANCELLED
end

#completed?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/multisafepay/order.rb', line 49

def completed?
  status == STATUS_COMPLETED
end

#declined?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/multisafepay/order.rb', line 53

def declined?
  status == STATUS_DECLINED
end

#expired?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/multisafepay/order.rb', line 57

def expired?
  status == STATUS_EXPIRED
end

#initialized?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/multisafepay/order.rb', line 61

def initialized?
  status == STATUS_INITIALIZED
end

#refunded?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/multisafepay/order.rb', line 65

def refunded?
  status == STATUS_REFUNDED
end

#reserved?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/multisafepay/order.rb', line 69

def reserved?
  status == STATUS_RESERVED
end

#shipped?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/multisafepay/order.rb', line 73

def shipped?
  status == STATUS_SHIPPED
end

#uncleared?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/multisafepay/order.rb', line 77

def uncleared?
  status == STATUS_UNCLEARED
end

#void?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/multisafepay/order.rb', line 81

def void?
  status == STATUS_VOID
end