Class: Pin::Charge
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
-
#card ⇒ Object
Returns the value of attribute card.
-
#card_token ⇒ Object
Returns the value of attribute card_token.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#customer_token ⇒ Object
Returns the value of attribute customer_token.
-
#description ⇒ Object
Returns the value of attribute description.
-
#email ⇒ Object
Returns the value of attribute email.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#merchant_entitlement ⇒ Object
Returns the value of attribute merchant_entitlement.
-
#refund_pending ⇒ Object
Returns the value of attribute refund_pending.
-
#refunds ⇒ Object
find all refunds for the current Charge object returns a list of Refunds.
-
#status_message ⇒ Object
Returns the value of attribute status_message.
-
#success ⇒ Object
Returns the value of attribute success.
-
#token ⇒ Object
Returns the value of attribute token.
-
#total_fees ⇒ Object
Returns the value of attribute total_fees.
-
#transfer ⇒ Object
Returns the value of attribute transfer.
Class Method Summary collapse
-
.create(options = {}) ⇒ Object
options should be a hash with the following params email, description, amount, currency, ip_address are mandatory identifier must be a hash, can take the forms <Pin::Card> String<“…”> String<“…”> <Pin::Customer> eg.
-
.search(options = {}) ⇒ Object
search for charges using parameters provided in options available parameters: query (string) start_date (date, or string formatted as ‘YYYY-MM-DD’) end_date (date, or string formatted as ‘YYYY-MM-DD’) sort (string or symbol: “created_at” (default), “description”, or “amount”) direction (“asc”/“desc”, or 1/-1).
Instance Method Summary collapse
-
#refund!(amnt = nil) ⇒ Object
creates a refund for this Charge refunds the full amount of the charge by default, provide an amount in cents to override.
Methods inherited from Base
all, find, first, #initialize, last
Constructor Details
This class inherits a constructor from Pin::Base
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def amount @amount end |
#amount_refunded ⇒ Object
Returns the value of attribute amount_refunded.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def amount_refunded @amount_refunded end |
#card ⇒ Object
Returns the value of attribute card.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def card @card end |
#card_token ⇒ Object
Returns the value of attribute card_token.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def card_token @card_token end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def currency @currency end |
#customer_token ⇒ Object
Returns the value of attribute customer_token.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def customer_token @customer_token end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def description @description end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def email @email end |
#error_message ⇒ Object
Returns the value of attribute error_message.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def @error_message end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def ip_address @ip_address end |
#merchant_entitlement ⇒ Object
Returns the value of attribute merchant_entitlement.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def merchant_entitlement @merchant_entitlement end |
#refund_pending ⇒ Object
Returns the value of attribute refund_pending.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def refund_pending @refund_pending end |
#refunds ⇒ Object
find all refunds for the current Charge object returns a list of Refunds
40 41 42 |
# File 'lib/pin-payments/charge.rb', line 40 def refunds @refunds end |
#status_message ⇒ Object
Returns the value of attribute status_message.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def @status_message end |
#success ⇒ Object
Returns the value of attribute success.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def success @success end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def token @token end |
#total_fees ⇒ Object
Returns the value of attribute total_fees.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def total_fees @total_fees end |
#transfer ⇒ Object
Returns the value of attribute transfer.
3 4 5 |
# File 'lib/pin-payments/charge.rb', line 3 def transfer @transfer end |
Class Method Details
.create(options = {}) ⇒ Object
options should be a hash with the following params email, description, amount, currency, ip_address are mandatory identifier must be a hash, can take the forms
{card: <Pin::Card>}
{card_token: String<"...">}
{customer_token: String<"...">}
{customer: <Pin::Customer>}
eg. ‘[email protected]’, description: ‘One month subscription’, amount: 19900, currency: ‘USD’, ip_address: ‘192.0.0.1’, customer_token: ‘asdf’
20 21 22 23 |
# File 'lib/pin-payments/charge.rb', line 20 def create( = {}) [:customer_token] = .delete(:customer).token unless [:customer].nil? super() end |
.search(options = {}) ⇒ Object
search for charges using parameters provided in options available parameters:
query (string)
start_date (date, or string formatted as 'YYYY-MM-DD')
end_date (date, or string formatted as 'YYYY-MM-DD')
sort (string or symbol: "created_at" (default), "description", or "amount")
direction ("asc"/"desc", or 1/-1)
32 33 34 35 |
# File 'lib/pin-payments/charge.rb', line 32 def search( = {}) [:direction] = [:direction] == 'asc' ? 1 : -1 if ['asc', 'desc'].include?([:direction]) build_collection_from_response(authenticated_get('/charges/search', )) end |