atpay_ruby 0.0.15 → 0.0.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bce36e3830db96a0e969e4d0dad24dd2f661fdb3
4
- data.tar.gz: 56fb25dc01863f5f1bac4166ddf235c9a860ecc0
3
+ metadata.gz: 47522dffa39c809294e5009c68539a3d796ba456
4
+ data.tar.gz: ef373de8ecb66207ba17ebcfd201004cecf8ac19
5
5
  SHA512:
6
- metadata.gz: e366984b6d265e4d2b59317b56769a88c23cd2bf2def5566c320019064cac8bd95a77939fc2a73fcfdd4ae271d6d87d8a71b19b4be211075c802f323d6be4c03
7
- data.tar.gz: 0e5602acdeacf9713bc72f03e5094cebdef0977dd0ce1acb242d7f84ed3b53d294a8e9a9b672a98b74b3611fe8809f618bd3352b3babc7c07a34c2024bc2bd41
6
+ metadata.gz: 7716f02544430ad2d30ee0ccac43e8aaeb24243063ef727df80aaae14e32652d57eef7243527c43a5d2661b728ee698dcb5de595836ee85219e488368e60efd1
7
+ data.tar.gz: 8b5fefef2362498010f8259b037883ea23aa264661ae43fbe2f96a0148c50aefed39221f177c6a67e4da3d38a4476ddcd10ed5ba23adfaa77b034b9bb80e33fd
data/README.md CHANGED
@@ -79,7 +79,19 @@ credit card @Pay has associated with 'test@example.com':
79
79
 
80
80
  ```ruby
81
81
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
82
- puts token.to_s
82
+ registration = token.register!
83
+
84
+ registration.url
85
+ => "https://example.secured.atpay.com/{token_identifier}"
86
+
87
+ registration.short
88
+ => "atpay://{token_identifier}"
89
+
90
+ registration.id
91
+ => "{token_identifier}"
92
+
93
+ registration.qrcode_url
94
+ => "https://dashboard.atpay.com/offers/{token_identifier}.png"
83
95
  ```
84
96
  Note: **Targeted** tokens used to be known as **Invoice** tokens. Please use **Targeted** tokens, as **Invoice** tokens will be deprecated.
85
97
 
@@ -99,6 +111,7 @@ To create a **Bulk Token** for a 30 dollar offer:
99
111
 
100
112
  ```ruby
101
113
  token = AtPay::Token::Bulk.new(session, 30.00)
114
+ registration = token.register!
102
115
  ```
103
116
 
104
117
  If a recipient of this token attempts to purchase the product via email but
@@ -108,6 +121,8 @@ on that page to enable Customers' two-click email transactions in the future.
108
121
 
109
122
  ## General Token Attributes
110
123
 
124
+ These attributes have to be set before calling the register function on the token.
125
+
111
126
  ### Auth Only
112
127
 
113
128
  A **Token** will trigger a funds authorization and a funds capture
@@ -117,7 +132,6 @@ want to delay the capture, use the `auth_only!` method to adjust this behavior:
117
132
  ```ruby
118
133
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
119
134
  token.auth_only!
120
- email(token.to_s)
121
135
  ```
122
136
 
123
137
  ### Expiration
@@ -157,31 +171,6 @@ token = AtPay::Token::Bulk.new(session, 20.00)
157
171
  token.request_custom_data!('gift_message', required: false)
158
172
  ```
159
173
 
160
- #### Requesting the URL of a Hosted Signup Page
161
-
162
- The **Hosted Payment Capture Page** is related directly to a Token. It is
163
- created when the token is first received at `transaction@processor.atpay.com` or
164
- when the URL is requested from @Pay prior to the first use. To request the URL, you
165
- must contact @Pay's server:
166
-
167
- ```ruby
168
- token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
169
- registration = token.register!
170
-
171
- registration.url
172
- => "https://example.secured.atpay.com/{token_identifier}"
173
-
174
- registration.short
175
- => "atpay://{token_identifier}"
176
-
177
- registration.qrcode_url
178
- => "https://dashboard.atpay.com/offers/{token_identifier}.png"
179
- ```
180
-
181
- NOTE: For high traffic this solution may be inadequate. Contact @Pay for
182
- consultation.
183
-
184
-
185
174
  #### Item Name
186
175
 
187
176
  You can set an **item name** that will display on the **Hosted Payment Capture Page**.
@@ -189,7 +178,6 @@ You can set an **item name** that will display on the **Hosted Payment Capture P
189
178
  ```ruby
190
179
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
191
180
  token.name = "A Cool Offer"
192
- email(token.to_s, receipient_address)
193
181
  ```
194
182
 
195
183
  #### Item Details
@@ -200,7 +188,6 @@ You can set an **item details** that will display on the **Hosted Payment Captur
200
188
  ```ruby
201
189
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
202
190
  token.item_details = "Lorem Ipsum ..."
203
- email(token.to_s, receipient_address)
204
191
  ```
205
192
 
206
193
 
@@ -214,7 +201,6 @@ of shipping or billing address with `requires_shipping_address=` and
214
201
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
215
202
  token.requires_shipping_address = true
216
203
  token.requires_billing_address = true
217
- email(token.to_s, receipient_address)
218
204
  ```
219
205
 
220
206
  ### Set Item Quantity
@@ -224,7 +210,6 @@ If you are using @Pay's webhook for inventory control, you can specify an initia
224
210
  ```ruby
225
211
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
226
212
  token.item_quantity = 3
227
- email(token.to_s, receipient_address)
228
213
  ```
229
214
 
230
215
 
@@ -237,7 +222,6 @@ A Transaction should be Captured only when fulfillment is completed.
237
222
  ```ruby
238
223
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
239
224
  token.estimated_fulfillment_days = 3
240
- email(token.to_s, receipient_address)
241
225
  ```
242
226
 
243
227
  ### Custom User Data
@@ -248,7 +232,6 @@ response on processing the token. It has a limit of 2500 characters.
248
232
  ```ruby
249
233
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
250
234
  token.custom_user_data = 'some-value'
251
- email(token.to_s, receipient_address)
252
235
  ```
253
236
 
254
237
 
@@ -258,7 +241,8 @@ To create a friendly button that wraps your token:
258
241
 
259
242
  ```ruby
260
243
  token = AtPay::Token::Targeted.new(session, 20.00, 'test@example.com')
261
- button = AtPay::Button.new(token.to_s, 20.00, 'My Company', wrap: true).render
244
+ registration = token.register!
245
+ button = AtPay::Button.new(registration.short, registration.id, 20.00, 'My Company', wrap: true).render
262
246
  email(button, recipient_address)
263
247
  ```
264
248
 
@@ -282,7 +266,7 @@ File.write("code.png", qr.png) # Export PNG
282
266
  File.write("code.svg", qr.svg) # Export SVG
283
267
  ```
284
268
 
285
- ## Command Line Usage
269
+ <!-- ## Command Line Usage
286
270
 
287
271
  The `atpay` utility generates **Targeted Tokens**, **Bulk Tokens**, and **Email Buttons**
288
272
  that you can embed in outgoing email. Run `atpay help` for more details.
@@ -296,4 +280,4 @@ $ atpay token bulk --partner_id=X --private-key=X --amount=20.55 --url="http://e
296
280
 
297
281
  $ atpay token targeted --partner_id=X --private_key=X --amount=20.55 --target=test@example.com --user-data=sku-123 | atpay button generic --amount=20.55 --merchant="Mom's"
298
282
  => <p>...</p>
299
- ```
283
+ ``` -->
@@ -1,8 +1 @@
1
-
2
- Send this email order form to confirm your purchase of {{amount}}. If we need more info we will let you know. Thanks!
3
-
4
-
5
-
6
- ---
7
-
8
- This code secures and validates your transaction:
1
+ {{merchant_name}} makes it easy to pay. Simply press "send" to confirm your payment of {{amount}}. If we need more info, we will let you know. Thanks!
data/atpay_ruby.gemspec CHANGED
@@ -2,11 +2,11 @@ $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'atpay_ruby'
5
- s.version = '0.0.15'
5
+ s.version = '0.0.16'
6
6
  s.summary = 'Ruby bindings for the @Pay API'
7
7
  s.description = ""
8
- s.authors = ['James Kassemi', 'Isaiah Baca']
9
- s.email = ['james@atpay.com', 'isaiah@atpay.com']
8
+ s.authors = ['James Kassemi', 'Isaiah Baca', 'Tyler Thompson']
9
+ s.email = ['james@atpay.com', 'isaiah@atpay.com', 'tyler@atpay.com']
10
10
  s.homepage = 'https://atpay.com'
11
11
  s.license = 'MIT'
12
12
 
data/bin/atpay CHANGED
@@ -49,7 +49,7 @@ module AtPay
49
49
  option :merchant, type: :string, required: true, desc: "Merchant name"
50
50
  def generic
51
51
  token = $stdin.read
52
- puts AtPay::Button.new(token, options[:amount], options[:merchant]).render
52
+ puts AtPay::Button.new(token, token, options[:amount], options[:merchant]).render
53
53
  end
54
54
  end
55
55
 
data/lib/atpay/button.rb CHANGED
@@ -11,23 +11,24 @@ module AtPay
11
11
  background_color: '#6dbe45',
12
12
  foreground_color: '#ffffff',
13
13
  image: 'https://www.atpay.com/wp-content/themes/atpay/images/bttn_cart.png',
14
- processor: ENV['ATPAY_PAYMENT_ADDRESS'] || 'payment@transaction-l4.atpay.com',
14
+ processor: ENV['ATPAY_PAYMENT_ADDRESS'] || 'payments.atpay.com',
15
15
  templates: File.join(File.dirname(__FILE__), '..', '..', 'assets', 'button', 'templates'),
16
16
  analytic_url: nil,
17
17
  wrap: false,
18
18
  wrap_text: 'Made for Mobile'
19
19
  }
20
20
 
21
- def initialize(token, amount, merchant_name, options={})
22
- @token = token
23
- @amount = amount
24
- @merchant_name = merchant_name
25
- @options = OPTIONS.merge(options)
26
- @options[:image] = nil if @options[:image] == ''
21
+ def initialize(token, short_token, amount, merchant_name, options={})
22
+ @token = token
23
+ @short_token = short_token
24
+ @amount = amount
25
+ @merchant_name = merchant_name
26
+ @options = OPTIONS.merge(options)
27
+ @options[:image] = nil if @options[:image] == ''
27
28
  end
28
29
 
29
30
  def default_mailto
30
- "mailto:#{@options[:processor]}?subject=#{mailto_subject}&body=#{mailto_body}"
31
+ "mailto:#{mailto_processor}?subject=#{mailto_subject}&body=#{mailto_body}"
31
32
  end
32
33
 
33
34
  def render(args={})
@@ -70,15 +71,15 @@ module AtPay
70
71
  end
71
72
 
72
73
  def mailto_subject
73
- URI.encode(@options[:subject])
74
+ URI.encode("Press send to pay #{amount} to #{@merchant_name} ")
74
75
  end
75
76
 
76
77
  def yahoo_mailto
77
- "http://compose.mail.yahoo.com/?to=#{@options[:processor]}&subject=#{mailto_subject}&body=#{mailto_body}"
78
+ "http://compose.mail.yahoo.com/?to=#{mailto_processor}&subject=#{mailto_subject}&body=#{mailto_body}"
78
79
  end
79
80
 
80
81
  def outlook_mailto
81
- "https://www.hotmail.com/secure/start?action=compose&to=#{@options[:processor]}&subject=#{mailto_subject}&body=#{mailto_body}"
82
+ "https://www.hotmail.com/secure/start?action=compose&to=#{mailto_processor}&subject=#{mailto_subject}&body=#{mailto_body}"
82
83
  end
83
84
 
84
85
  # Load the mailto body template from the specified location
@@ -86,17 +87,18 @@ module AtPay
86
87
  Liquid::Template.parse(File.read(File.join(@options[:templates], "mailto_body.liquid")))
87
88
  end
88
89
 
90
+ def mailto_processor
91
+ "payment-id-#{@short_token}@#{@options[:processor]}"
92
+ end
93
+
89
94
  # Parse the mailto body, this is where we inject the token, merchant_name and amount values we received in
90
95
  # the options.
91
96
  #
92
97
  # @return [String]
93
98
  def mailto_body
94
- part_a = URI.encode(mailto_body_template.render({
99
+ URI.encode(mailto_body_template.render({
95
100
  'amount' => amount,
96
101
  'merchant_name' => @merchant_name}))
97
- part_b = CGI.escape(token)
98
- part_z = "#{part_a}%0A%0A#{part_b}"
99
- return part_z
100
102
  end
101
103
 
102
104
  # This is processed as liquid - in the future we can allow overwriting the
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atpay_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Kassemi
8
8
  - Isaiah Baca
9
+ - Tyler Thompson
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-10-22 00:00:00.000000000 Z
13
+ date: 2014-12-16 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rbnacl-libsodium
@@ -127,6 +128,7 @@ description: ''
127
128
  email:
128
129
  - james@atpay.com
129
130
  - isaiah@atpay.com
131
+ - tyler@atpay.com
130
132
  executables:
131
133
  - atpay
132
134
  extensions: []