ez_paypal 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +41 -0
- data/README.md +136 -0
- data/doc/EZPaypal.html +124 -0
- data/doc/EZPaypal/Cart.html +125 -0
- data/doc/EZPaypal/Cart/OneTimePurchaseCart.html +621 -0
- data/doc/EZPaypal/Cart/RecurringProfile.html +278 -0
- data/doc/EZPaypal/Cart/RecurringPurchaseCart.html +434 -0
- data/doc/EZPaypal/Config.html +353 -0
- data/doc/EZPaypal/Helper.html +296 -0
- data/doc/EZPaypal/Request.html +926 -0
- data/doc/EZPaypal/Response.html +678 -0
- data/doc/_index.html +93 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +226 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +226 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +46 -0
- data/doc/top-level-namespace.html +95 -0
- data/ez_paypal.gemspec +32 -0
- data/lib/config.rb +55 -0
- data/lib/core/data.rb +241 -0
- data/lib/core/helper.rb +34 -0
- data/lib/core/request.rb +159 -0
- data/lib/core/response.rb +76 -0
- data/lib/ez_paypal.rb +5 -0
- data/lib/ez_paypal/version.rb +3 -0
- metadata +129 -0
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Compiled source #
|
2
|
+
###################
|
3
|
+
*.com
|
4
|
+
*.class
|
5
|
+
*.dll
|
6
|
+
*.exe
|
7
|
+
*.o
|
8
|
+
*.so
|
9
|
+
*.gem
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# Packages #
|
13
|
+
############
|
14
|
+
# it's better to unpack these files and commit the raw source
|
15
|
+
# git has its own built in compression methods
|
16
|
+
*.7z
|
17
|
+
*.dmg
|
18
|
+
*.gz
|
19
|
+
*.iso
|
20
|
+
*.jar
|
21
|
+
*.rar
|
22
|
+
*.tar
|
23
|
+
*.zip
|
24
|
+
|
25
|
+
# Logs and databases #
|
26
|
+
######################
|
27
|
+
*.log
|
28
|
+
*.sql
|
29
|
+
*.sqlite
|
30
|
+
|
31
|
+
# OS generated files #
|
32
|
+
######################
|
33
|
+
.DS_Store*
|
34
|
+
ehthumbs.db
|
35
|
+
Icon?
|
36
|
+
Thumbs.db
|
37
|
+
|
38
|
+
# IDE generated files #
|
39
|
+
#######################
|
40
|
+
.idea
|
41
|
+
*~
|
data/README.md
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# EZPaypal
|
2
|
+
|
3
|
+
Paypal express checkout plugin.
|
4
|
+
|
5
|
+
## How to use it
|
6
|
+
|
7
|
+
###Non-recurring purchase
|
8
|
+
|
9
|
+
####Request for token
|
10
|
+
|
11
|
+
# create cart and add items to it
|
12
|
+
cart = EZPaypal::Cart::OneTimePurchaseCart.new()
|
13
|
+
|
14
|
+
item = {
|
15
|
+
"name" => "Item name",
|
16
|
+
"item_code" => "Item code",
|
17
|
+
"description" => "xxx, xxxxxx",
|
18
|
+
"amount" => "3",
|
19
|
+
"quantity" => "1"
|
20
|
+
}
|
21
|
+
cart.addItem(item)
|
22
|
+
|
23
|
+
shipping = {
|
24
|
+
"name" => "John Smith",
|
25
|
+
"street" => "123 xx Rd",
|
26
|
+
"city" => "xxxxx",
|
27
|
+
"state" => "xx",
|
28
|
+
"country" => "US",
|
29
|
+
"zip" => "11234",
|
30
|
+
"phone" => "123-456-7890"
|
31
|
+
}
|
32
|
+
cart.setupShippingInfo(shipping)
|
33
|
+
|
34
|
+
summary = {
|
35
|
+
"subtotal" => "3",
|
36
|
+
"tax" => "0.5",
|
37
|
+
"shipping" => "1",
|
38
|
+
"handling" => "0",
|
39
|
+
"shipping_discount" => "-1",
|
40
|
+
"insurance" => "0",
|
41
|
+
"total" => "3.5"
|
42
|
+
}
|
43
|
+
cart.setupSummary(summary)
|
44
|
+
|
45
|
+
return_url = "http://127.0.0.1:3000/ec_return"
|
46
|
+
cancel_url = "http://127.0.0.1:3000/ec_cancel"
|
47
|
+
|
48
|
+
# send cart to request for token
|
49
|
+
response_origin = EZPaypal::Request.SetupExpressCheckout(cart, return_url, cancel_url)
|
50
|
+
response = EZPaypal::Response.new(response_origin)
|
51
|
+
|
52
|
+
# get checkout url
|
53
|
+
checkout_url = response.getCheckoutURL()
|
54
|
+
|
55
|
+
####Handle success purchase
|
56
|
+
|
57
|
+
# verify query string
|
58
|
+
d_token = params["token"]
|
59
|
+
d_payerid = params["PayerID"]
|
60
|
+
|
61
|
+
response = EZPaypal::Response.new(params)
|
62
|
+
|
63
|
+
# confirm purchase
|
64
|
+
confirm_purchase_origin = response.confirmPurchase()
|
65
|
+
confirm_response = EZPaypal::Response.new(confirm_purchase_origin)
|
66
|
+
|
67
|
+
if (confirm_response.success?)
|
68
|
+
# handle success purchase ...
|
69
|
+
transaction_id = confirm_response["PAYMENTINFO_0_TRANSACTIONID"]
|
70
|
+
else
|
71
|
+
# handle failed purchase ...
|
72
|
+
end
|
73
|
+
|
74
|
+
###Recurring purchase
|
75
|
+
|
76
|
+
####Request for token
|
77
|
+
|
78
|
+
# create cart and add item to it
|
79
|
+
cart = EZPaypal::Cart::RecurringPurchaseCart.new()
|
80
|
+
item = {
|
81
|
+
"item_code" => "Item code",
|
82
|
+
"unit_price" => "4",
|
83
|
+
"quantity" => "1",
|
84
|
+
"amount" => "4"
|
85
|
+
}
|
86
|
+
cart.setupAgreement(item)
|
87
|
+
|
88
|
+
return_url = "http://127.0.0.1:3000/ec_return"
|
89
|
+
cancel_url = "http://127.0.0.1:3000/ec_cancel"
|
90
|
+
|
91
|
+
# send cart to request for token
|
92
|
+
response_origin = EZPaypal::Request.SetupExpressCheckout(cart, return_url, cancel_url)
|
93
|
+
response = EZPaypal::Response.new(response_origin)
|
94
|
+
|
95
|
+
# get checkout url
|
96
|
+
checkout_url = response.getCheckoutURL()
|
97
|
+
|
98
|
+
####Handle success purchase
|
99
|
+
|
100
|
+
# verify query string
|
101
|
+
d_token = params["token"]
|
102
|
+
d_payerid = params["PayerID"]
|
103
|
+
|
104
|
+
# get checkout details
|
105
|
+
response = EZPaypal::Response.new(params)
|
106
|
+
checkout_details_origin = EZPaypal::Request.GetCheckoutDetails(response["TOKEN"])
|
107
|
+
checkout_details = EZPaypal::Response.new(checkout_details_origin)
|
108
|
+
|
109
|
+
# create and confirm recurring profile
|
110
|
+
profile = EZPaypal::Cart::RecurringProfile.ConvertFromCheckoutDetails(checkout_details)
|
111
|
+
confirm_response = EZPaypal::Response.new(EZPaypal::Request.CreateRecurringProfile(profile))
|
112
|
+
|
113
|
+
if (confirm_response.success?)
|
114
|
+
# handle success purchase ...
|
115
|
+
profile_id = confirm_response["PROFILEID"]
|
116
|
+
else
|
117
|
+
# handle failed purchase ...
|
118
|
+
end
|
119
|
+
|
120
|
+
## Installation
|
121
|
+
|
122
|
+
Add the following line to rails "Gemfile"
|
123
|
+
|
124
|
+
gem "ez_paypal"
|
125
|
+
|
126
|
+
then execute
|
127
|
+
|
128
|
+
$ bundle install
|
129
|
+
|
130
|
+
|
131
|
+
See [http://rubygems.org/gems/ez_paypal](http://rubygems.org/gems/ez_paypal "EZPaypal RubyGem Page") for more details
|
132
|
+
|
133
|
+
## Authors
|
134
|
+
|
135
|
+
Tianyu Huang
|
136
|
+
|
data/doc/EZPaypal.html
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: EZPaypal
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index (E)</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">EZPaypal</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: EZPaypal
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/config.rb<span class="defines">,<br />
|
76
|
+
lib/core/data.rb,<br /> lib/core/helper.rb,<br /> lib/core/request.rb,<br /> lib/core/response.rb,<br /> lib/ez_paypal/version.rb</span>
|
77
|
+
</dd>
|
78
|
+
|
79
|
+
</dl>
|
80
|
+
<div class="clear"></div>
|
81
|
+
|
82
|
+
<h2>Defined Under Namespace</h2>
|
83
|
+
<p class="children">
|
84
|
+
|
85
|
+
|
86
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="EZPaypal/Cart.html" title="EZPaypal::Cart (module)">Cart</a></span>, <span class='object_link'><a href="EZPaypal/Config.html" title="EZPaypal::Config (module)">Config</a></span>, <span class='object_link'><a href="EZPaypal/Helper.html" title="EZPaypal::Helper (module)">Helper</a></span>, <span class='object_link'><a href="EZPaypal/Request.html" title="EZPaypal::Request (module)">Request</a></span>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="EZPaypal/Response.html" title="EZPaypal::Response (class)">Response</a></span>
|
91
|
+
|
92
|
+
|
93
|
+
</p>
|
94
|
+
|
95
|
+
<h2>Constant Summary</h2>
|
96
|
+
|
97
|
+
<dl class="constants">
|
98
|
+
|
99
|
+
<dt id="VERSION-constant" class="">VERSION =
|
100
|
+
|
101
|
+
</dt>
|
102
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.0.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
103
|
+
|
104
|
+
</dl>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div id="footer">
|
118
|
+
Generated on Sat Apr 21 02:53:51 2012 by
|
119
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
120
|
+
0.7.5 (ruby-1.9.3).
|
121
|
+
</div>
|
122
|
+
|
123
|
+
</body>
|
124
|
+
</html>
|
@@ -0,0 +1,125 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: EZPaypal::Cart
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../EZPaypal.html" title="EZPaypal (module)">EZPaypal</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Cart</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: EZPaypal::Cart
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/core/data.rb</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
<h2>Overview</h2><div class="docstring">
|
81
|
+
<div class="discussion">
|
82
|
+
|
83
|
+
<p>Paypal NVP Documentation:</p>
|
84
|
+
|
85
|
+
<pre class="code ruby"><code>Express checkout:
|
86
|
+
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetExpressCheckoutDetails
|
87
|
+
Recurring payments:
|
88
|
+
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECRecurringPayments
|
89
|
+
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_CreateRecurringPayments</code></pre>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div><h2>Defined Under Namespace</h2>
|
98
|
+
<p class="children">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Cart/OneTimePurchaseCart.html" title="EZPaypal::Cart::OneTimePurchaseCart (class)">OneTimePurchaseCart</a></span>, <span class='object_link'><a href="Cart/RecurringProfile.html" title="EZPaypal::Cart::RecurringProfile (class)">RecurringProfile</a></span>, <span class='object_link'><a href="Cart/RecurringPurchaseCart.html" title="EZPaypal::Cart::RecurringPurchaseCart (class)">RecurringPurchaseCart</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
</p>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div id="footer">
|
119
|
+
Generated on Sat Apr 21 02:53:51 2012 by
|
120
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
|
+
0.7.5 (ruby-1.9.3).
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</body>
|
125
|
+
</html>
|
@@ -0,0 +1,621 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: EZPaypal::Cart::OneTimePurchaseCart
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '../..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../../_index.html">Index (O)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../../EZPaypal.html" title="EZPaypal (module)">EZPaypal</a></span></span> » <span class='title'><span class='object_link'><a href="../Cart.html" title="EZPaypal::Cart (module)">Cart</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">OneTimePurchaseCart</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: EZPaypal::Cart::OneTimePurchaseCart
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">HashWithIndifferentAccess</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">HashWithIndifferentAccess</li>
|
75
|
+
|
76
|
+
<li class="next">EZPaypal::Cart::OneTimePurchaseCart</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/core/data.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
<h2>Overview</h2><div class="docstring">
|
98
|
+
<div class="discussion">
|
99
|
+
|
100
|
+
<p>A cart object that holds all one time purchase items</p>
|
101
|
+
|
102
|
+
<pre class="code ruby"><code>How to use:
|
103
|
+
-> initialize Cart
|
104
|
+
-> add items (optional)
|
105
|
+
-> setup shipping info(optional)
|
106
|
+
-> setup summary(required)
|
107
|
+
-> done (if involve recurring purchase, please create profile, this cart only shows agreement for recurring items)
|
108
|
+
Note:
|
109
|
+
you are responsible for all the cost calculations</code></pre>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="tags">
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<h2>
|
126
|
+
Instance Method Summary
|
127
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
128
|
+
</h2>
|
129
|
+
|
130
|
+
<ul class="summary">
|
131
|
+
|
132
|
+
<li class="public ">
|
133
|
+
<span class="summary_signature">
|
134
|
+
|
135
|
+
<a href="#addItem-instance_method" title="#addItem (instance method)">- (Object) <strong>addItem</strong>(item) </a>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</span>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<span class="summary_desc"><div class='inline'>
|
149
|
+
<p>Add item to the cart (optional).</p>
|
150
|
+
</div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#cartSize-instance_method" title="#cartSize (instance method)">- (Object) <strong>cartSize</strong> </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Max cart size of this cart type.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong> </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'>
|
195
|
+
<p>Clean the cart.</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#setupShippingInfo-instance_method" title="#setupShippingInfo (instance method)">- (Object) <strong>setupShippingInfo</strong>(shipping) </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="summary_desc"><div class='inline'>
|
218
|
+
<p>Setup shipping info (optional).</p>
|
219
|
+
</div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li class="public ">
|
225
|
+
<span class="summary_signature">
|
226
|
+
|
227
|
+
<a href="#setupSummary-instance_method" title="#setupSummary (instance method)">- (Object) <strong>setupSummary</strong>(summary) </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'>
|
241
|
+
<p>Add cart summary, please calculate yourself (required).</p>
|
242
|
+
</div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
</ul>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<div id="instance_method_details" class="method_details_list">
|
254
|
+
<h2>Instance Method Details</h2>
|
255
|
+
|
256
|
+
|
257
|
+
<div class="method_details first">
|
258
|
+
<p class="signature first" id="addItem-instance_method">
|
259
|
+
|
260
|
+
- (<tt>Object</tt>) <strong>addItem</strong>(item)
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</p><div class="docstring">
|
265
|
+
<div class="discussion">
|
266
|
+
|
267
|
+
<p>Add item to the cart (optional)</p>
|
268
|
+
|
269
|
+
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
<div class="tags">
|
273
|
+
<h3>Parameters:</h3>
|
274
|
+
<ul class="param">
|
275
|
+
|
276
|
+
<li>
|
277
|
+
|
278
|
+
<span class='name'>item</span>
|
279
|
+
|
280
|
+
|
281
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
—
|
286
|
+
<div class='inline'>
|
287
|
+
<h1>{"category" => "digital / physical",</h1>
|
288
|
+
|
289
|
+
<p>"name", "item_code", "description", "amount", "quantity" }</p>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
</ul>
|
295
|
+
|
296
|
+
|
297
|
+
</div><table class="source_code">
|
298
|
+
<tr>
|
299
|
+
<td>
|
300
|
+
<pre class="lines">
|
301
|
+
|
302
|
+
|
303
|
+
35
|
304
|
+
36
|
305
|
+
37
|
306
|
+
38
|
307
|
+
39
|
308
|
+
40
|
309
|
+
41
|
310
|
+
42
|
311
|
+
43
|
312
|
+
44
|
313
|
+
45
|
314
|
+
46
|
315
|
+
47
|
316
|
+
48
|
317
|
+
49
|
318
|
+
50
|
319
|
+
51
|
320
|
+
52
|
321
|
+
53
|
322
|
+
54
|
323
|
+
55
|
324
|
+
56</pre>
|
325
|
+
</td>
|
326
|
+
<td>
|
327
|
+
<pre class="code"><span class="info file"># File 'lib/core/data.rb', line 35</span>
|
328
|
+
|
329
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_addItem'>addItem</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
|
330
|
+
|
331
|
+
<span class='comment'># Check max cart size, make sure do not exceed the limit
|
332
|
+
</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='int'>0</span>
|
333
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
334
|
+
<span class='id identifier rubyid_max'>max</span> <span class='op'>=</span> <span class='id identifier rubyid_max'>max</span> <span class='op'>+</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^L_PAYMENTREQUEST_0_NAME</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
335
|
+
<span class='kw'>end</span>
|
336
|
+
<span class='id identifier rubyid_throw'>throw</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Exceed max cart size: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cartSize'>cartSize</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_max'>max</span><span class='op'>+</span><span class='int'>1</span> <span class='op'>></span> <span class='id identifier rubyid_cartSize'>cartSize</span><span class='rparen'>)</span>
|
337
|
+
|
338
|
+
<span class='comment'># Add item to cart
|
339
|
+
</span> <span class='id identifier rubyid_current_index'>current_index</span> <span class='op'>=</span> <span class='id identifier rubyid_max'>max</span>
|
340
|
+
<span class='id identifier rubyid_current_item'>current_item</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
341
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_ITEMCATEGORY</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>category</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Physical</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
342
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_NAME</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>name</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
343
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_NUMBER</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>item_code</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
344
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_DESC</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>description</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
345
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_AMT</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>amount</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
346
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>L_PAYMENTREQUEST_0_QTY</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_current_index'>current_index</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>quantity</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span>
|
347
|
+
<span class='rbrace'>}</span>
|
348
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_current_item'>current_item</span><span class='rparen'>)</span>
|
349
|
+
|
350
|
+
<span class='kw'>end</span></pre>
|
351
|
+
</td>
|
352
|
+
</tr>
|
353
|
+
</table>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div class="method_details ">
|
357
|
+
<p class="signature " id="cartSize-instance_method">
|
358
|
+
|
359
|
+
- (<tt>Object</tt>) <strong>cartSize</strong>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</p><div class="docstring">
|
364
|
+
<div class="discussion">
|
365
|
+
|
366
|
+
<p>Max cart size of this cart type</p>
|
367
|
+
|
368
|
+
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
<div class="tags">
|
372
|
+
|
373
|
+
|
374
|
+
</div><table class="source_code">
|
375
|
+
<tr>
|
376
|
+
<td>
|
377
|
+
<pre class="lines">
|
378
|
+
|
379
|
+
|
380
|
+
27
|
381
|
+
28
|
382
|
+
29</pre>
|
383
|
+
</td>
|
384
|
+
<td>
|
385
|
+
<pre class="code"><span class="info file"># File 'lib/core/data.rb', line 27</span>
|
386
|
+
|
387
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cartSize'>cartSize</span>
|
388
|
+
<span class='int'>10</span>
|
389
|
+
<span class='kw'>end</span></pre>
|
390
|
+
</td>
|
391
|
+
</tr>
|
392
|
+
</table>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div class="method_details ">
|
396
|
+
<p class="signature " id="reset-instance_method">
|
397
|
+
|
398
|
+
- (<tt>Object</tt>) <strong>reset</strong>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
</p><div class="docstring">
|
403
|
+
<div class="discussion">
|
404
|
+
|
405
|
+
<p>Clean the cart</p>
|
406
|
+
|
407
|
+
|
408
|
+
</div>
|
409
|
+
</div>
|
410
|
+
<div class="tags">
|
411
|
+
|
412
|
+
|
413
|
+
</div><table class="source_code">
|
414
|
+
<tr>
|
415
|
+
<td>
|
416
|
+
<pre class="lines">
|
417
|
+
|
418
|
+
|
419
|
+
102
|
420
|
+
103
|
421
|
+
104</pre>
|
422
|
+
</td>
|
423
|
+
<td>
|
424
|
+
<pre class="code"><span class="info file"># File 'lib/core/data.rb', line 102</span>
|
425
|
+
|
426
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
|
427
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
428
|
+
<span class='kw'>end</span></pre>
|
429
|
+
</td>
|
430
|
+
</tr>
|
431
|
+
</table>
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<div class="method_details ">
|
435
|
+
<p class="signature " id="setupShippingInfo-instance_method">
|
436
|
+
|
437
|
+
- (<tt>Object</tt>) <strong>setupShippingInfo</strong>(shipping)
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
</p><div class="docstring">
|
442
|
+
<div class="discussion">
|
443
|
+
|
444
|
+
<p>Setup shipping info (optional)</p>
|
445
|
+
|
446
|
+
|
447
|
+
</div>
|
448
|
+
</div>
|
449
|
+
<div class="tags">
|
450
|
+
<h3>Parameters:</h3>
|
451
|
+
<ul class="param">
|
452
|
+
|
453
|
+
<li>
|
454
|
+
|
455
|
+
<span class='name'>shipping</span>
|
456
|
+
|
457
|
+
|
458
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
—
|
463
|
+
<div class='inline'>
|
464
|
+
<h1>{"name", "street", "street2", "city", "state", "country", "zip", "phone" }</h1>
|
465
|
+
</div>
|
466
|
+
|
467
|
+
</li>
|
468
|
+
|
469
|
+
</ul>
|
470
|
+
|
471
|
+
|
472
|
+
</div><table class="source_code">
|
473
|
+
<tr>
|
474
|
+
<td>
|
475
|
+
<pre class="lines">
|
476
|
+
|
477
|
+
|
478
|
+
60
|
479
|
+
61
|
480
|
+
62
|
481
|
+
63
|
482
|
+
64
|
483
|
+
65
|
484
|
+
66
|
485
|
+
67
|
486
|
+
68
|
487
|
+
69
|
488
|
+
70
|
489
|
+
71
|
490
|
+
72
|
491
|
+
73</pre>
|
492
|
+
</td>
|
493
|
+
<td>
|
494
|
+
<pre class="code"><span class="info file"># File 'lib/core/data.rb', line 60</span>
|
495
|
+
|
496
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setupShippingInfo'>setupShippingInfo</span><span class='lparen'>(</span><span class='id identifier rubyid_shipping'>shipping</span><span class='rparen'>)</span>
|
497
|
+
<span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='id identifier rubyid_shipping'>shipping</span>
|
498
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
499
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTONAME</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>name</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
500
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOSTREET</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>street</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
501
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOSTREET2</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>street2</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
502
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOCITY</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>city</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
503
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOSTATE</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>state</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
504
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>country</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
505
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOZIP</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>zip</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
506
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPTOPHONENUM</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>phone</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
507
|
+
<span class='rbrace'>}</span>
|
508
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
509
|
+
<span class='kw'>end</span></pre>
|
510
|
+
</td>
|
511
|
+
</tr>
|
512
|
+
</table>
|
513
|
+
</div>
|
514
|
+
|
515
|
+
<div class="method_details ">
|
516
|
+
<p class="signature " id="setupSummary-instance_method">
|
517
|
+
|
518
|
+
- (<tt>Object</tt>) <strong>setupSummary</strong>(summary)
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
</p><div class="docstring">
|
523
|
+
<div class="discussion">
|
524
|
+
|
525
|
+
<p>Add cart summary, please calculate yourself (required)</p>
|
526
|
+
|
527
|
+
|
528
|
+
</div>
|
529
|
+
</div>
|
530
|
+
<div class="tags">
|
531
|
+
<h3>Parameters:</h3>
|
532
|
+
<ul class="param">
|
533
|
+
|
534
|
+
<li>
|
535
|
+
|
536
|
+
<span class='name'>summary</span>
|
537
|
+
|
538
|
+
|
539
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
—
|
544
|
+
<div class='inline'>
|
545
|
+
<h1>{"currency" => "USD"(default "USD"),</h1>
|
546
|
+
|
547
|
+
<p>"subtotal", "tax", "shipping", "handling", "shipping_discount",
|
548
|
+
"insurance", "total", "disable_change_shipping_info" => "1 / 0" (default
|
549
|
+
1), "allow_note" => "1 / 0" (default 0) }</p>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
</li>
|
553
|
+
|
554
|
+
</ul>
|
555
|
+
|
556
|
+
|
557
|
+
</div><table class="source_code">
|
558
|
+
<tr>
|
559
|
+
<td>
|
560
|
+
<pre class="lines">
|
561
|
+
|
562
|
+
|
563
|
+
81
|
564
|
+
82
|
565
|
+
83
|
566
|
+
84
|
567
|
+
85
|
568
|
+
86
|
569
|
+
87
|
570
|
+
88
|
571
|
+
89
|
572
|
+
90
|
573
|
+
91
|
574
|
+
92
|
575
|
+
93
|
576
|
+
94
|
577
|
+
95
|
578
|
+
96
|
579
|
+
97
|
580
|
+
98
|
581
|
+
99</pre>
|
582
|
+
</td>
|
583
|
+
<td>
|
584
|
+
<pre class="code"><span class="info file"># File 'lib/core/data.rb', line 81</span>
|
585
|
+
|
586
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setupSummary'>setupSummary</span> <span class='lparen'>(</span><span class='id identifier rubyid_summary'>summary</span><span class='rparen'>)</span>
|
587
|
+
<span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='id identifier rubyid_summary'>summary</span>
|
588
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
589
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_PAYMENTACTION</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>payment_action</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sale</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
590
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_CURRENCYCODE</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>currency</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>USD</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
591
|
+
|
592
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_ITEMAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>subtotal</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
593
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_TAXAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>tax</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
594
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPPINGAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>shipping</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
595
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_HANDLINGAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>handling</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
596
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_SHIPDISCAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>shipping_discount</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
597
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_INSURANCEAMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>insurance</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
598
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PAYMENTREQUEST_0_AMT</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>total</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
599
|
+
|
600
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ALLOWNOTE</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>allow_note</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
601
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>NOSHIPPING</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>disable_change_shipping_info</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1</span><span class='tstring_end'>"</span></span>
|
602
|
+
<span class='rbrace'>}</span>
|
603
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
604
|
+
<span class='kw'>end</span></pre>
|
605
|
+
</td>
|
606
|
+
</tr>
|
607
|
+
</table>
|
608
|
+
</div>
|
609
|
+
|
610
|
+
</div>
|
611
|
+
|
612
|
+
</div>
|
613
|
+
|
614
|
+
<div id="footer">
|
615
|
+
Generated on Sat Apr 21 02:53:51 2012 by
|
616
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
617
|
+
0.7.5 (ruby-1.9.3).
|
618
|
+
</div>
|
619
|
+
|
620
|
+
</body>
|
621
|
+
</html>
|