zaui_zapi 0.1.9 → 0.1.11

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/version.rb +1 -1
  3. data/lib/zapi_xml.rb +32 -3
  4. data/lib/zaui.rb +23 -2
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ceb13ccb4a5113a33016f6cfd417607a3d34d4fb
4
- data.tar.gz: 91c94c720b602a23d3b5355b57ce70fd0cb35c96
3
+ metadata.gz: 273e6b12763256424f9e8b09af98989b3abfa290
4
+ data.tar.gz: 0e0fb2edd0c9529fd2c6a2bcf96bd41a19f0a8b3
5
5
  SHA512:
6
- metadata.gz: 48bc7321a4e497895e8351251a3b0300d6600e32535b0c2f9f3661c96f7ee231a2306b8d2db10dfea512fbb4f1a5261ec5a0e96670d4cbc325457348c96c6eb3
7
- data.tar.gz: fd505a11fcfd57e2aff4812350e51c9cc240eaae70fd8935c506ca2d88f4a9c750e81c5ff86898fb23af7f04e2474c3c381bfe19ef4189d162d8c78a9c1a6cfd
6
+ metadata.gz: f0483284eb90035286834134673122ceb6fd577f94d8b8206b328d9fa3f7690b5cd2606872fac702515859fb638873fb79f45264f9739c084aa260f3789f0820
7
+ data.tar.gz: 4d77a2e6fe7ec8231958dc92d9410e91c0e9cf1b0633570334831eef338d1711661b2c10a00cbb32235363461631fc2ddcb704d383bf5490819e5b96a67c3e1e
data/lib/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION = '0.1.9'
1
+ VERSION = '0.1.11'
data/lib/zapi_xml.rb CHANGED
@@ -89,7 +89,7 @@ class ZapiXML
89
89
  end
90
90
 
91
91
  def get_cart_contents
92
- _wrap_xml_request({
92
+ raw = _wrap_xml_request({
93
93
  "methodName" => 'zapiGetCartContents',
94
94
  "cartId" => session.cart_id
95
95
  })
@@ -280,10 +280,39 @@ class ZapiXML
280
280
  end
281
281
 
282
282
  def promotion_code_apply promo_code:
283
- _wrap_xml_request({
283
+ foo = _wrap_xml_request({
284
284
  "methodName" => 'zapiPromotionCodeApply',
285
285
  "cartId" => session.cart_id,
286
- "promotCodeName" => promo_code
286
+ "promoCodeName" => promo_code
287
+ })
288
+ end
289
+
290
+ def process_single_transaction hash:
291
+ _wrap_xml_request({
292
+ "methodName" => 'zapiProcessSingleTransaction',
293
+ "cartId" => session.cart_id,
294
+ "transactionDetails" => {
295
+ "transactionType" => 2000,
296
+ "transactionAmount" => hash[:amount],
297
+ "creditCardDetails" => {
298
+ "nameOnCard" => hash[:name_on_card],
299
+ "number" => hash[:cc_num],
300
+ "expMonth" => hash[:expiration_month],
301
+ "expYear" => hash[:expiration_year],
302
+ "csv" => hash[:csv],
303
+ "cardType" => hash[:card_type],
304
+ "rawSwipeData" => nil,
305
+ "track1Data" => nil,
306
+ "track2Data" => nil
307
+ }
308
+ }
309
+ })
310
+ end
311
+
312
+ def load_booking_into_cart booking_number:
313
+ _wrap_xml_request({
314
+ "methodName" => "zapiLoadBookingIntoCart",
315
+ "bookingNumber" => booking_number
287
316
  })
288
317
  end
289
318
 
data/lib/zaui.rb CHANGED
@@ -37,8 +37,13 @@ class Zaui
37
37
  end
38
38
 
39
39
  def get_cart_contents
40
- activities = _zapi(xml.get_cart_contents).try(:[],'cart').try(:[],'activities').try(:[],'activity')
41
- activities.is_a?(Array) ? activities : [activities]
40
+ raw = _zapi(xml.get_cart_contents)
41
+ activities = raw.try(:[],'cart').try(:[],'activities').try(:[],'activity')
42
+ activities = activities.is_a?(Array) ? activities : [activities]
43
+ {
44
+ :activities => activities,
45
+ :total => raw['cart']['remainingBalance']['balance']
46
+ }
42
47
  end
43
48
 
44
49
  def update_customer_details_to_cart first_name:, last_name:, phone:, email:
@@ -66,6 +71,22 @@ class Zaui
66
71
  raw = _zapi(xml.process_cart_with_payment(hash: cart_data))
67
72
  end
68
73
 
74
+ def process_single_transaction hash: {}
75
+ cart_data = {
76
+ amount: hash[:amount],
77
+ name_on_card: hash[:name_on_card],
78
+ cc_num: hash[:cc_num].gsub(/[^\d]/, ''),
79
+ expiration_month: hash[:expiration_month],
80
+ expiration_year: hash[:expiration_year],
81
+ csv: hash[:csv]
82
+ }
83
+ raw = _zapi(xml.process_single_transaction(hash: cart_data))
84
+ end
85
+
86
+ def load_booking_into_cart booking_number:
87
+ raw = _zapi(xml.load_booking_into_cart)
88
+ end
89
+
69
90
  def get_package_categories
70
91
  raw = _zapi(xml.get_package_categories)[:categories][:category]
71
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaui_zapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Kretzmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest