Class: ChinaPay::Alipay::Order
- Inherits:
-
Object
- Object
- ChinaPay::Alipay::Order
- Defined in:
- lib/china_pay/alipay.rb
Constant Summary collapse
- PAYMENT_TYPE_BUYING =
1- PAYMENT_TYPE_DONATION =
4
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#merchant ⇒ Object
Returns the value of attribute merchant.
Instance Method Summary collapse
- #as_donation ⇒ Object
- #buyer_email(email) ⇒ Object
- #direct_pay ⇒ Object
-
#initialize(order_id, subject, description) ⇒ Order
constructor
A new instance of Order.
- #product_url(url) ⇒ Object
- #seller_email(email) ⇒ Object
- #total_fee(fee) ⇒ Object
Constructor Details
#initialize(order_id, subject, description) ⇒ Order
Returns a new instance of Order.
109 110 111 112 113 114 115 116 |
# File 'lib/china_pay/alipay.rb', line 109 def initialize(order_id, subject, description) @attributes = { :out_trade_no => order_id, :subject => subject, :body => description } @attributes[:payment_type] = PAYMENT_TYPE_BUYING end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
107 108 109 |
# File 'lib/china_pay/alipay.rb', line 107 def attributes @attributes end |
#merchant ⇒ Object
Returns the value of attribute merchant.
106 107 108 |
# File 'lib/china_pay/alipay.rb', line 106 def merchant @merchant end |
Instance Method Details
#as_donation ⇒ Object
139 140 141 142 |
# File 'lib/china_pay/alipay.rb', line 139 def as_donation @attributes[:payment_type] = PAYMENT_TYPE_DONATION self end |
#buyer_email(email) ⇒ Object
123 124 125 126 |
# File 'lib/china_pay/alipay.rb', line 123 def buyer_email(email) @attributes[:buyer_email] = email self end |
#direct_pay ⇒ Object
144 145 146 |
# File 'lib/china_pay/alipay.rb', line 144 def direct_pay Product::DirectPay.new(self) end |
#product_url(url) ⇒ Object
134 135 136 137 |
# File 'lib/china_pay/alipay.rb', line 134 def product_url(url) @attributes[:show_url] = url self end |
#seller_email(email) ⇒ Object
118 119 120 121 |
# File 'lib/china_pay/alipay.rb', line 118 def seller_email(email) @attributes[:seller_email] = email self end |
#total_fee(fee) ⇒ Object
128 129 130 131 132 |
# File 'lib/china_pay/alipay.rb', line 128 def total_fee(fee) @attributes[:total_fee] = fee self end |