conekta 1.1.3 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c16615310bda9e764fd5db0bfa5cb8b05c7bc08a
4
- data.tar.gz: 09a727a7f215cf5440058702c9b5ffa629bb0143
3
+ metadata.gz: 1e0356d7e62f2a683a66d4be7583998322284110
4
+ data.tar.gz: 971ca5e785e1877e1bf4e6f8630b00081545ca4c
5
5
  SHA512:
6
- metadata.gz: e725130779234c507acb1db49a4c17e954c866eec2de16c7552b78a2b6bde30deb9beeae7009eb0701e6f0d67c99abdc48cda7123c1ccba07d864332a1a3d9d0
7
- data.tar.gz: 428ed0c5ee2f81a234801d773b8eced3c4353f5214a254f6bac60a684ede7c20c29e5a6371e52390cf9a149f425179f6047d8ecec094a35d450919af8b714da2
6
+ metadata.gz: 3b1b4132f3ed6aebc55db64fedbfbf59b3e9a46b415c1ff52e52c1ee5e5ccca4f1891f275c2d534aa482165152cb0f120466665e41096bad337a7b37238b2f1f
7
+ data.tar.gz: e4023ac675e8ae0d18b22d26718bdf2d1a5a42b9a0df990740db9ea51404c719fec2826bfe573535919ade85a053c1977e6b8ab0dcf6cbe98410e943997252e5
data/README.md CHANGED
@@ -46,14 +46,8 @@ end
46
46
  {
47
47
  "livemode": false,
48
48
  "amount": 35000,
49
- "status": "created",
49
+ "payment_status": "pending_payment",
50
50
  "currency": "MXN",
51
- "capture": true,
52
- "last_payment_info": {
53
- "charge_id": "5887772aedbb6ea3a30056c5",
54
- "payment_method": "OxxoPayment",
55
- "status": "pending_payment"
56
- },
57
51
  "customer_info": {
58
52
  "email": "hola@hola.com",
59
53
  "phone": "+5213353319758",
@@ -26,7 +26,6 @@ require "conekta/charge"
26
26
  require "conekta/customer"
27
27
  require "conekta/card"
28
28
  require "conekta/discount_line"
29
- require "conekta/fiscal_entity"
30
29
  require "conekta/log"
31
30
  require "conekta/method"
32
31
  require "conekta/order"
@@ -46,7 +45,6 @@ require "conekta/webhook"
46
45
  require "conekta/webhook_log"
47
46
  require "conekta/refund"
48
47
  require "conekta/line_item"
49
- require "conekta/return"
50
48
  require "conekta/address"
51
49
 
52
50
  module Conekta
@@ -14,6 +14,7 @@ module Conekta
14
14
  def capture
15
15
  custom_action(:post, 'capture')
16
16
  end
17
+
17
18
  def refund(params=nil)
18
19
  params = { 'amount' => (params || self.amount) }
19
20
  custom_action(:post, 'refund', params)
@@ -9,14 +9,13 @@ module Conekta
9
9
  include Conekta::Operations::CreateMember
10
10
 
11
11
  attr_accessor :livemode, :name, :email, :phone, :default_shipping_contact_id,
12
- :default_fiscal_entity_id, :referrer, :account_age,
12
+ :referrer, :account_age,
13
13
  :paid_transactions, :first_paid_at, :corporate, :default_payment_source_id,
14
- :fiscal_entities, :shipping_contacts, :subscription, :payment_sources, :cards
14
+ :shipping_contacts, :subscription, :payment_sources, :cards
15
15
 
16
16
  def initialize(id=nil)
17
17
  @id = id
18
18
  @payment_sources ||= List.new("PaymentSource", {})
19
- @fiscal_entities ||= List.new("FiscalEntity", {})
20
19
  @shipping_contacts ||= List.new("ShippingContacts", {})
21
20
  super(id)
22
21
  end
@@ -29,7 +28,7 @@ module Conekta
29
28
  customer = self
30
29
 
31
30
  if Conekta.api_version == "2.0.0"
32
- submodels = [:fiscal_entities, :payment_sources, :shipping_contacts]
31
+ submodels = [:payment_sources, :shipping_contacts]
33
32
  create_submodels_lists(customer, submodels)
34
33
  else
35
34
  submodels = [:cards]
@@ -62,10 +61,6 @@ module Conekta
62
61
  self.create_member('subscription', params)
63
62
  end
64
63
 
65
- def create_fiscal_entity(params)
66
- self.create_member_with_relation('fiscal_entities', params, self)
67
- end
68
-
69
64
  def create_shipping_contact(params)
70
65
  self.create_member_with_relation('shipping_contacts', params, self)
71
66
  end
@@ -7,10 +7,9 @@ module Conekta
7
7
  include Conekta::Operations::CreateMember
8
8
  include Conekta::Operations::CustomAction
9
9
 
10
- attr_accessor :livemode, :amount, :status, :customer_id, :currency, :capture,
10
+ attr_accessor :livemode, :amount, :payment_status, :customer_id, :currency,
11
11
  :metadata, :created_at, :updated_at, :tax_lines, :line_items,
12
- :shipping_lines, :discount_lines, :shipping_contact, :fiscal_entity,
13
- :charges, :returns
12
+ :shipping_lines, :discount_lines, :shipping_contact, :charges
14
13
 
15
14
  def initialize(id=nil)
16
15
  @id = id
@@ -19,7 +18,6 @@ module Conekta
19
18
  @shipping_lines ||= List.new("ShippingLine", {})
20
19
  @discount_lines ||= List.new("DiscountLine", {})
21
20
  @charges ||= List.new("Charge", {})
22
- @returns ||= List.new("Return", {})
23
21
  super(id)
24
22
  end
25
23
 
@@ -30,14 +28,11 @@ module Conekta
30
28
 
31
29
  order = self
32
30
  submodels = [:line_items, :tax_lines, :shipping_lines, :discount_lines,
33
- :charges, :returns]
31
+ :charges]
34
32
  create_submodels_lists(order, submodels)
35
-
36
- if self.respond_to?(:fiscal_entity) && self.fiscal_entity
37
- self.fiscal_entity.create_attr('order', order)
38
- end
39
33
  end
40
34
 
35
+ #Attribute accessors
41
36
  def create_line_item(params)
42
37
  self.create_member_with_relation('line_items', params, self)
43
38
  end
@@ -58,20 +53,21 @@ module Conekta
58
53
  self.create_member('charges', params)
59
54
  end
60
55
 
61
- def create_return(params)
62
- self.create_member('returns', params)
56
+ def create_shipping_contact(params)
57
+ self.update(shipping_contact: params).shipping_contact
63
58
  end
64
59
 
65
- def create_fiscal_entity(params)
66
- self.update(fiscal_entity: params).fiscal_entity
60
+ #State transitions
61
+ def authorize_capture(params={})
62
+ custom_action(:post, 'capture', params)
67
63
  end
68
64
 
69
- def create_shipping_contact(params)
70
- self.update(shipping_contact: params).shipping_contact
65
+ def void(params={})
66
+ custom_action(:post, 'void', params)
71
67
  end
72
68
 
73
- def capture_order
74
- custom_action(:put, 'capture')
69
+ def refund(params={})
70
+ custom_action(:post, 'refund', params)
75
71
  end
76
72
 
77
73
  private
@@ -33,10 +33,8 @@ module Conekta
33
33
  'tax_line' => ::Conekta::TaxLine,
34
34
  'shipping_line' => ::Conekta::ShippingLine,
35
35
  'discount_line' => ::Conekta::DiscountLine,
36
- 'fiscal_entity' => ::Conekta::FiscalEntity,
37
36
  'shipping_contact' => ::Conekta::ShippingContact,
38
- 'list' => ::Conekta::List,
39
- 'return' => ::Conekta::Return
37
+ 'list' => ::Conekta::List
40
38
  }
41
39
  end
42
40
 
@@ -134,4 +132,4 @@ module Conekta
134
132
  end
135
133
  end
136
134
  end
137
- end
135
+ end
@@ -1,3 +1,3 @@
1
1
  module Conekta
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -21,7 +21,7 @@ describe Conekta::Order do
21
21
 
22
22
  let(:charges) do
23
23
  [{
24
- payment_source: {
24
+ payment_method: {
25
25
  type: "oxxo_cash",
26
26
  expires_at: (Time.now + 3600).to_i
27
27
  },
@@ -31,7 +31,7 @@ describe Conekta::Order do
31
31
 
32
32
  let(:card_charges) do
33
33
  [{
34
- payment_source: {
34
+ payment_method: {
35
35
  type: "card",
36
36
  token_id: "tok_test_visa_4242",
37
37
  },
@@ -49,22 +49,6 @@ describe Conekta::Order do
49
49
  }]
50
50
  end
51
51
 
52
- let(:fiscal_entity) do
53
- {
54
- tax_id: "AMGH851205MN1",
55
- company_name: "Nike SA de CV",
56
- address: {
57
- street1: "250 Alexis St",
58
- internal_number: "19",
59
- external_number: "91",
60
- city: "Red Deer",
61
- state: "Alberta",
62
- country: "CA",
63
- postal_code: "T4N 0B8"
64
- }
65
- }
66
- end
67
-
68
52
  let(:order_data) do
69
53
  {
70
54
  currency: 'mxn',
@@ -91,12 +75,6 @@ describe Conekta::Order do
91
75
  expect(order.metadata["test"]).to eq(true)
92
76
  end
93
77
 
94
- it "successful order with fiscal_entity create" do
95
- order = Conekta::Order.create(order_data.merge(fiscal_entity: fiscal_entity))
96
- expect(order.fiscal_entity).to be_a(Conekta::FiscalEntity)
97
- expect(order.fiscal_entity.order).to eq(order)
98
- end
99
-
100
78
  it "unsuccessful order create" do
101
79
  expect_to_raise_error_list(Conekta::ErrorList, nil, Conekta::ParameterValidationError) \
102
80
  { Conekta::Order.create({}) }
@@ -162,22 +140,6 @@ describe Conekta::Order do
162
140
  }
163
141
  end
164
142
 
165
- let(:fiscal_entity_params) do
166
- {
167
- tax_id: "AMGH851205MN2",
168
- company_name: "Nike SA de CV",
169
- address: {
170
- street1: "250 Alexis St",
171
- internal_number: "20",
172
- external_number: "02",
173
- city: "Red Deer",
174
- state: "Alberta",
175
- country: "CA",
176
- postal_code: "T4N 0B8"
177
- }
178
- }
179
- end
180
-
181
143
  let(:discount_line_params) do
182
144
  {
183
145
  code: "Cupon de descuento",
@@ -188,7 +150,7 @@ describe Conekta::Order do
188
150
 
189
151
  let(:charge_params) do
190
152
  {
191
- payment_source: {
153
+ payment_method: {
192
154
  type: "oxxo_cash",
193
155
  expires_at: (Time.now + 3600).to_i
194
156
  },
@@ -265,12 +227,6 @@ describe Conekta::Order do
265
227
  expect(order.discount_lines.class.to_s).to eq("Conekta::List")
266
228
  end
267
229
 
268
- it "successfully creates fiscal entity for order" do
269
- fiscal_entity = order.create_fiscal_entity(fiscal_entity_params)
270
-
271
- expect(fiscal_entity.class.to_s).to eq("Conekta::FiscalEntity")
272
- end
273
-
274
230
  it "successfully create shipping contact for order" do
275
231
  shipping_contact = order.create_shipping_contact(shipping_contact_params)
276
232
 
@@ -297,33 +253,36 @@ describe Conekta::Order do
297
253
  end
298
254
 
299
255
  it "successfully captures an order" do
300
- order = Conekta::Order.create(order_data_with_charges.
301
- merge(customer_info: customer_info, preauthorize: true))
302
- expect(order.preauthorize).to eq(true)
256
+ order = Conekta::Order.create(order_data_with_card_charges.
257
+ merge(customer_info: customer_info, pre_authorize: true))
258
+ expect(order.payment_status).to eq("pre_authorized")
303
259
 
304
- order.capture_order
260
+ order.authorize_capture
305
261
 
306
- expect(order.preauthorize).to eq(false)
262
+ expect(order.payment_status).to eq("paid")
307
263
  end
308
264
 
309
- context "returns" do
310
- let(:order_return) do
265
+ context "refund" do
266
+ let(:order_refund) do
311
267
  {
312
268
  amount: 35000,
313
- reason: "requested_by_client",
314
- currency: "MXN"
269
+ reason: "requested_by_client"
315
270
  }
316
271
  end
317
272
 
318
- it "test successful return" do
273
+ it "test successful refund" do
319
274
  order = Conekta::Order.create(order_data_with_card_charges.
320
275
  merge(customer_info: customer_info).
321
276
  merge(line_items: line_items))
322
- order.create_return(order_return.merge(order_id: order.id))
323
- returned_order = Conekta::Order.find(order.id)
277
+ begin
278
+ order.refund(order_refund)
279
+ rescue Exception => e
280
+ puts e.details.map{|d| d.message}
281
+ end
282
+
283
+ refunded_order = Conekta::Order.find(order.id)
324
284
 
325
- expect(returned_order.status).to eq("returned")
326
- expect(returned_order.returns.first).to be_a(Conekta::Return)
285
+ expect(refunded_order.payment_status).to eq("refunded")
327
286
  end
328
287
  end
329
288
  end
@@ -8,16 +8,9 @@
8
8
  {
9
9
  "livemode": false,
10
10
  "amount": 20000,
11
- "status": "created",
11
+ "payment_status": "pending_payment",
12
12
  "customer_id": null,
13
13
  "currency": "MXN",
14
- "capture": true,
15
- "last_payment_info": {
16
- "charge_id": "58865636dba34dd852000afe",
17
- "payment_method": "OxxoPayment",
18
- "payment_brand": null,
19
- "status": "pending_payment"
20
- },
21
14
  "customer_info": {
22
15
  "email": "hola@hola.com",
23
16
  "phone": "+5213353319758",
@@ -28,7 +21,6 @@
28
21
  "first_paid_at": 0
29
22
  },
30
23
  "shipping_contact": null,
31
- "fiscal_entity": null,
32
24
  "object": "order",
33
25
  "id": "ord_2fth5M3rEuYiegi7R",
34
26
  "metadata": {
@@ -131,29 +123,14 @@
131
123
  }
132
124
  }
133
125
  ]
134
- },
135
- "returns": {
136
- "starting_after": null,
137
- "ending_before": null,
138
- "object": "list",
139
- "has_more": false,
140
- "total": 0,
141
- "data": []
142
126
  }
143
127
  },
144
128
  {
145
129
  "livemode": false,
146
130
  "amount": 20000,
147
- "status": "returned",
131
+ "payment_status": "refunded",
148
132
  "customer_id": null,
149
133
  "currency": "MXN",
150
- "capture": true,
151
- "last_payment_info": {
152
- "charge_id": "5886562ddba34dd35d000aad",
153
- "payment_method": "CreditCardPayment",
154
- "payment_brand": "VISA",
155
- "status": "paid"
156
- },
157
134
  "customer_info": {
158
135
  "email": "hola@hola.com",
159
136
  "phone": "+5213353319758",
@@ -164,7 +141,6 @@
164
141
  "first_paid_at": 0
165
142
  },
166
143
  "shipping_contact": null,
167
- "fiscal_entity": null,
168
144
  "object": "order",
169
145
  "id": "ord_2fth5EQUZ7UtB9fQT",
170
146
  "metadata": {
@@ -282,59 +258,15 @@
282
258
  }
283
259
  }
284
260
  ]
285
- },
286
- "returns": {
287
- "starting_after": null,
288
- "ending_before": null,
289
- "object": "list",
290
- "has_more": false,
291
- "total": 1,
292
- "data": [
293
- {
294
- "livemode": false,
295
- "amount": 20000,
296
- "currency": "MXN",
297
- "charge_id": "5886562ddba34dd35d000aad",
298
- "reason": "Reason return",
299
- "id": "ord_ret_2fth5KdEjehMzxpTh",
300
- "object": "return",
301
- "created_at": 1485198900,
302
- "parent_id": "ord_2fth5EQUZ7UtB9fQT"
303
- }
304
- ]
305
261
  }
306
262
  },
307
263
  {
308
264
  "livemode": false,
309
265
  "amount": 20000,
310
- "status": "created",
311
266
  "customer_id": null,
312
267
  "currency": "MXN",
313
- "capture": true,
314
- "last_payment_info": null,
315
268
  "customer_info": null,
316
269
  "shipping_contact": null,
317
- "fiscal_entity": {
318
- "tax_id": "AMGH851205MN1",
319
- "company_name": "Test SA de CV",
320
- "phone": "+5213353319758",
321
- "email": "test@conekta.io",
322
- "address": {
323
- "street1": "250 Alexis St",
324
- "street2": null,
325
- "street3": null,
326
- "internal_number": 19,
327
- "external_number": 10,
328
- "city": "Red Deer",
329
- "state": "Alberta",
330
- "zip": "78216",
331
- "country": "mx",
332
- "object": "fiscal_entity_address"
333
- },
334
- "id": "fis_ent_2fth5Diga4CBE9Q5g",
335
- "object": "fiscal_entity",
336
- "created_at": 1485198892
337
- },
338
270
  "object": "order",
339
271
  "id": "ord_2fth5Cys3rdXXRmmH",
340
272
  "metadata": {
@@ -400,27 +332,15 @@
400
332
  "has_more": false,
401
333
  "total": 0,
402
334
  "data": []
403
- },
404
- "returns": {
405
- "starting_after": null,
406
- "ending_before": null,
407
- "object": "list",
408
- "has_more": false,
409
- "total": 0,
410
- "data": []
411
335
  }
412
336
  },
413
337
  {
414
338
  "livemode": false,
415
339
  "amount": 20000,
416
- "status": "created",
417
340
  "customer_id": null,
418
341
  "currency": "MXN",
419
- "capture": true,
420
- "last_payment_info": null,
421
342
  "customer_info": null,
422
343
  "shipping_contact": null,
423
- "fiscal_entity": null,
424
344
  "object": "order",
425
345
  "id": "ord_2fth5CF3Xf4syc56p",
426
346
  "metadata": {
@@ -486,27 +406,15 @@
486
406
  "has_more": false,
487
407
  "total": 0,
488
408
  "data": []
489
- },
490
- "returns": {
491
- "starting_after": null,
492
- "ending_before": null,
493
- "object": "list",
494
- "has_more": false,
495
- "total": 0,
496
- "data": []
497
409
  }
498
410
  },
499
411
  {
500
412
  "livemode": false,
501
413
  "amount": 20000,
502
- "status": "created",
503
414
  "customer_id": null,
504
415
  "currency": "MXN",
505
- "capture": true,
506
- "last_payment_info": null,
507
416
  "customer_info": null,
508
417
  "shipping_contact": null,
509
- "fiscal_entity": null,
510
418
  "object": "order",
511
419
  "id": "ord_2fth5BWE1TWEMLQcN",
512
420
  "metadata": {
@@ -583,27 +491,17 @@
583
491
  "has_more": false,
584
492
  "total": 0,
585
493
  "data": []
586
- },
587
- "returns": {
588
- "starting_after": null,
589
- "ending_before": null,
590
- "object": "list",
591
- "has_more": false,
592
- "total": 0,
593
- "data": []
594
494
  }
595
495
  },
596
496
  {
597
497
  "livemode": false,
598
498
  "amount": 20066,
599
- "status": "created",
600
499
  "customer_id": null,
601
500
  "currency": "MXN",
602
501
  "capture": true,
603
502
  "last_payment_info": null,
604
503
  "customer_info": null,
605
504
  "shipping_contact": null,
606
- "fiscal_entity": null,
607
505
  "object": "order",
608
506
  "id": "ord_2fth59yZRv6zGdkks",
609
507
  "metadata": {
@@ -686,27 +584,15 @@
686
584
  "has_more": false,
687
585
  "total": 0,
688
586
  "data": []
689
- },
690
- "returns": {
691
- "starting_after": null,
692
- "ending_before": null,
693
- "object": "list",
694
- "has_more": false,
695
- "total": 0,
696
- "data": []
697
587
  }
698
588
  },
699
589
  {
700
590
  "livemode": false,
701
591
  "amount": 40000,
702
- "status": "created",
703
592
  "customer_id": null,
704
593
  "currency": "MXN",
705
- "capture": true,
706
- "last_payment_info": null,
707
594
  "customer_info": null,
708
595
  "shipping_contact": null,
709
- "fiscal_entity": null,
710
596
  "object": "order",
711
597
  "id": "ord_2fth58SfvN6sWdVms",
712
598
  "metadata": {
@@ -790,27 +676,15 @@
790
676
  "has_more": false,
791
677
  "total": 0,
792
678
  "data": []
793
- },
794
- "returns": {
795
- "starting_after": null,
796
- "ending_before": null,
797
- "object": "list",
798
- "has_more": false,
799
- "total": 0,
800
- "data": []
801
679
  }
802
680
  },
803
681
  {
804
682
  "livemode": false,
805
683
  "amount": 20000,
806
- "status": "created",
807
684
  "customer_id": null,
808
685
  "currency": "MXN",
809
- "capture": true,
810
- "last_payment_info": null,
811
686
  "customer_info": null,
812
687
  "shipping_contact": null,
813
- "fiscal_entity": null,
814
688
  "object": "order",
815
689
  "id": "ord_2fth56EDMmQvWQZtr",
816
690
  "metadata": {
@@ -876,27 +750,15 @@
876
750
  "has_more": false,
877
751
  "total": 0,
878
752
  "data": []
879
- },
880
- "returns": {
881
- "starting_after": null,
882
- "ending_before": null,
883
- "object": "list",
884
- "has_more": false,
885
- "total": 0,
886
- "data": []
887
753
  }
888
754
  },
889
755
  {
890
756
  "livemode": false,
891
757
  "amount": 20000,
892
- "status": "created",
893
758
  "customer_id": null,
894
759
  "currency": "MXN",
895
- "capture": true,
896
- "last_payment_info": null,
897
760
  "customer_info": null,
898
761
  "shipping_contact": null,
899
- "fiscal_entity": null,
900
762
  "object": "order",
901
763
  "id": "ord_2fth54kaKNHdPHBKk",
902
764
  "metadata": {
@@ -962,27 +824,15 @@
962
824
  "has_more": false,
963
825
  "total": 0,
964
826
  "data": []
965
- },
966
- "returns": {
967
- "starting_after": null,
968
- "ending_before": null,
969
- "object": "list",
970
- "has_more": false,
971
- "total": 0,
972
- "data": []
973
827
  }
974
828
  },
975
829
  {
976
830
  "livemode": false,
977
831
  "amount": 60000,
978
- "status": "created",
979
832
  "customer_id": null,
980
833
  "currency": "USD",
981
- "capture": true,
982
- "last_payment_info": null,
983
834
  "customer_info": null,
984
835
  "shipping_contact": null,
985
- "fiscal_entity": null,
986
836
  "object": "order",
987
837
  "id": "ord_2fth5451GKboLvQfW",
988
838
  "metadata": {
@@ -1048,29 +898,14 @@
1048
898
  "has_more": false,
1049
899
  "total": 0,
1050
900
  "data": []
1051
- },
1052
- "returns": {
1053
- "starting_after": null,
1054
- "ending_before": null,
1055
- "object": "list",
1056
- "has_more": false,
1057
- "total": 0,
1058
- "data": []
1059
901
  }
1060
902
  },
1061
903
  {
1062
904
  "livemode": false,
1063
905
  "amount": 20000,
1064
- "status": "created",
906
+ "payment_status": "pending_payment",
1065
907
  "customer_id": null,
1066
908
  "currency": "MXN",
1067
- "capture": true,
1068
- "last_payment_info": {
1069
- "charge_id": "5886561ddba34dd852000ad8",
1070
- "payment_method": "OxxoPayment",
1071
- "payment_brand": null,
1072
- "status": "pending_payment"
1073
- },
1074
909
  "customer_info": {
1075
910
  "email": "hola@hola.com",
1076
911
  "phone": "+5213353319758",
@@ -1081,7 +916,6 @@
1081
916
  "first_paid_at": 0
1082
917
  },
1083
918
  "shipping_contact": null,
1084
- "fiscal_entity": null,
1085
919
  "object": "order",
1086
920
  "id": "ord_2fth51uaEsBnzUthh",
1087
921
  "metadata": {
@@ -1184,29 +1018,14 @@
1184
1018
  }
1185
1019
  }
1186
1020
  ]
1187
- },
1188
- "returns": {
1189
- "starting_after": null,
1190
- "ending_before": null,
1191
- "object": "list",
1192
- "has_more": false,
1193
- "total": 0,
1194
- "data": []
1195
1021
  }
1196
1022
  },
1197
1023
  {
1198
1024
  "livemode": false,
1199
1025
  "amount": 20000,
1200
- "status": "fulfilled",
1026
+ "payment_status": "paid",
1201
1027
  "customer_id": null,
1202
1028
  "currency": "MXN",
1203
- "capture": true,
1204
- "last_payment_info": {
1205
- "charge_id": "5886561bedbb6ede090004cf",
1206
- "payment_method": "OxxoPayment",
1207
- "payment_brand": null,
1208
- "status": "pending_payment"
1209
- },
1210
1029
  "customer_info": {
1211
1030
  "email": "hola@hola.com",
1212
1031
  "phone": "+5213353319758",
@@ -1217,7 +1036,6 @@
1217
1036
  "first_paid_at": 0
1218
1037
  },
1219
1038
  "shipping_contact": null,
1220
- "fiscal_entity": null,
1221
1039
  "object": "order",
1222
1040
  "id": "ord_2fth51Akifd9NDEDA",
1223
1041
  "metadata": {
@@ -1320,27 +1138,16 @@
1320
1138
  }
1321
1139
  }
1322
1140
  ]
1323
- },
1324
- "returns": {
1325
- "starting_after": null,
1326
- "ending_before": null,
1327
- "object": "list",
1328
- "has_more": false,
1329
- "total": 0,
1330
- "data": []
1331
1141
  }
1332
1142
  },
1333
1143
  {
1334
1144
  "livemode": false,
1335
1145
  "amount": 20000,
1336
- "status": "created",
1146
+ "status": "pending_payment",
1337
1147
  "customer_id": null,
1338
1148
  "currency": "MXN",
1339
- "capture": true,
1340
- "last_payment_info": null,
1341
1149
  "customer_info": null,
1342
1150
  "shipping_contact": null,
1343
- "fiscal_entity": null,
1344
1151
  "object": "order",
1345
1152
  "id": "ord_2fth4yh7gGVrC7s6p",
1346
1153
  "metadata": {
@@ -1406,29 +1213,14 @@
1406
1213
  "has_more": false,
1407
1214
  "total": 0,
1408
1215
  "data": []
1409
- },
1410
- "returns": {
1411
- "starting_after": null,
1412
- "ending_before": null,
1413
- "object": "list",
1414
- "has_more": false,
1415
- "total": 0,
1416
- "data": []
1417
1216
  }
1418
1217
  },
1419
1218
  {
1420
1219
  "livemode": false,
1421
1220
  "amount": 2000,
1422
- "status": "fulfilled",
1221
+ "status": "paid",
1423
1222
  "customer_id": null,
1424
1223
  "currency": "MXN",
1425
- "capture": true,
1426
- "last_payment_info": {
1427
- "charge_id": "588655e8c835f06c7b000a13",
1428
- "payment_method": "CreditCardPayment",
1429
- "payment_brand": "VISA",
1430
- "status": "paid"
1431
- },
1432
1224
  "customer_info": {
1433
1225
  "email": "logan@x-men.org",
1434
1226
  "phone": "4033420642",
@@ -1439,7 +1231,6 @@
1439
1231
  "first_paid_at": 0
1440
1232
  },
1441
1233
  "shipping_contact": null,
1442
- "fiscal_entity": null,
1443
1234
  "object": "order",
1444
1235
  "id": "ord_2fth4kLBsbdqQ2UBT",
1445
1236
  "metadata": {},
@@ -1544,29 +1335,14 @@
1544
1335
  }
1545
1336
  }
1546
1337
  ]
1547
- },
1548
- "returns": {
1549
- "starting_after": null,
1550
- "ending_before": null,
1551
- "object": "list",
1552
- "has_more": false,
1553
- "total": 0,
1554
- "data": []
1555
1338
  }
1556
1339
  },
1557
1340
  {
1558
1341
  "livemode": false,
1559
1342
  "amount": 2000,
1560
- "status": "fulfilled",
1343
+ "payment_status": "paid",
1561
1344
  "customer_id": null,
1562
1345
  "currency": "MXN",
1563
- "capture": true,
1564
- "last_payment_info": {
1565
- "charge_id": "588655d5dba34dd35d000a5d",
1566
- "payment_method": "OxxoPayment",
1567
- "payment_brand": null,
1568
- "status": "paid"
1569
- },
1570
1346
  "customer_info": {
1571
1347
  "email": "logan@x-men.org",
1572
1348
  "phone": "403-342-0642",
@@ -1577,7 +1353,6 @@
1577
1353
  "first_paid_at": 0
1578
1354
  },
1579
1355
  "shipping_contact": null,
1580
- "fiscal_entity": null,
1581
1356
  "object": "order",
1582
1357
  "id": "ord_2fth4kLBsbdqQ2UBQ",
1583
1358
  "metadata": {},
@@ -1675,29 +1450,14 @@
1675
1450
  }
1676
1451
  }
1677
1452
  ]
1678
- },
1679
- "returns": {
1680
- "starting_after": null,
1681
- "ending_before": null,
1682
- "object": "list",
1683
- "has_more": false,
1684
- "total": 0,
1685
- "data": []
1686
1453
  }
1687
1454
  },
1688
1455
  {
1689
1456
  "livemode": false,
1690
1457
  "amount": 2000,
1691
- "status": "fulfilled",
1458
+ "payment_status": "paid",
1692
1459
  "customer_id": null,
1693
1460
  "currency": "MXN",
1694
- "capture": true,
1695
- "last_payment_info": {
1696
- "charge_id": "588655cedba34dd852000aa9",
1697
- "payment_method": "SpeiPayment",
1698
- "payment_brand": null,
1699
- "status": "paid"
1700
- },
1701
1461
  "customer_info": {
1702
1462
  "email": "logan@x-men.org",
1703
1463
  "phone": "403-342-0642",
@@ -1708,7 +1468,6 @@
1708
1468
  "first_paid_at": 0
1709
1469
  },
1710
1470
  "shipping_contact": null,
1711
- "fiscal_entity": null,
1712
1471
  "object": "order",
1713
1472
  "id": "ord_2fth4kLBsbdqQ2UB9",
1714
1473
  "metadata": {},
@@ -1816,29 +1575,14 @@
1816
1575
  }
1817
1576
  }
1818
1577
  ]
1819
- },
1820
- "returns": {
1821
- "starting_after": null,
1822
- "ending_before": null,
1823
- "object": "list",
1824
- "has_more": false,
1825
- "total": 0,
1826
- "data": []
1827
1578
  }
1828
1579
  },
1829
1580
  {
1830
1581
  "livemode": false,
1831
1582
  "amount": 2000,
1832
- "status": "fulfilled",
1583
+ "payment_status": "paid",
1833
1584
  "customer_id": null,
1834
1585
  "currency": "MXN",
1835
- "capture": true,
1836
- "last_payment_info": {
1837
- "charge_id": "588655e1dba34dd35d000a6f",
1838
- "payment_method": "CreditCardPayment",
1839
- "payment_brand": "VISA",
1840
- "status": "paid"
1841
- },
1842
1586
  "customer_info": {
1843
1587
  "email": "logan@x-men.org",
1844
1588
  "phone": "4033420642",
@@ -1849,7 +1593,6 @@
1849
1593
  "first_paid_at": 0
1850
1594
  },
1851
1595
  "shipping_contact": null,
1852
- "fiscal_entity": null,
1853
1596
  "object": "order",
1854
1597
  "id": "ord_2fth4kLBsbdqQ2UAx",
1855
1598
  "metadata": {},
@@ -1954,29 +1697,14 @@
1954
1697
  }
1955
1698
  }
1956
1699
  ]
1957
- },
1958
- "returns": {
1959
- "starting_after": null,
1960
- "ending_before": null,
1961
- "object": "list",
1962
- "has_more": false,
1963
- "total": 0,
1964
- "data": []
1965
1700
  }
1966
1701
  },
1967
1702
  {
1968
1703
  "livemode": false,
1969
1704
  "amount": 2000,
1970
- "status": "returned",
1705
+ "payment_status": "refunded",
1971
1706
  "customer_id": null,
1972
1707
  "currency": "MXN",
1973
- "capture": true,
1974
- "last_payment_info": {
1975
- "charge_id": "588655d9c835f0fde2000aa1",
1976
- "payment_method": "CreditCardPayment",
1977
- "payment_brand": "VISA",
1978
- "status": "refunded"
1979
- },
1980
1708
  "customer_info": {
1981
1709
  "email": "logan@x-men.org",
1982
1710
  "phone": "4033420642",
@@ -1987,7 +1715,6 @@
1987
1715
  "first_paid_at": 0
1988
1716
  },
1989
1717
  "shipping_contact": null,
1990
- "fiscal_entity": null,
1991
1718
  "object": "order",
1992
1719
  "id": "ord_2fth4kLBsbdqQ2UAg",
1993
1720
  "metadata": {},
@@ -2100,41 +1827,14 @@
2100
1827
  }
2101
1828
  }
2102
1829
  ]
2103
- },
2104
- "returns": {
2105
- "starting_after": null,
2106
- "ending_before": null,
2107
- "object": "list",
2108
- "has_more": false,
2109
- "total": 1,
2110
- "data": [
2111
- {
2112
- "livemode": false,
2113
- "amount": -2000,
2114
- "currency": "MXN",
2115
- "charge_id": "588655d9c835f0fde2000aa1",
2116
- "reason": "unknown",
2117
- "id": "ord_ret_2fth4kLBsbdqQ2UAj",
2118
- "object": "return",
2119
- "created_at": 1485198855,
2120
- "parent_id": "ord_2fth4kLBsbdqQ2UAg"
2121
- }
2122
- ]
2123
1830
  }
2124
1831
  },
2125
1832
  {
2126
1833
  "livemode": false,
2127
1834
  "amount": 2000,
2128
- "status": "fulfilled",
1835
+ "payment_status": "paid",
2129
1836
  "customer_id": null,
2130
1837
  "currency": "MXN",
2131
- "capture": true,
2132
- "last_payment_info": {
2133
- "charge_id": "588655cddba34dd35d000a49",
2134
- "payment_method": "BanortePayment",
2135
- "payment_brand": null,
2136
- "status": "paid"
2137
- },
2138
1838
  "customer_info": {
2139
1839
  "email": "logan@x-men.org",
2140
1840
  "phone": "403-342-0642",
@@ -2145,7 +1845,6 @@
2145
1845
  "first_paid_at": 0
2146
1846
  },
2147
1847
  "shipping_contact": null,
2148
- "fiscal_entity": null,
2149
1848
  "object": "order",
2150
1849
  "id": "ord_2fth4kLBsbdqQ2UAa",
2151
1850
  "metadata": {},
@@ -2242,29 +1941,14 @@
2242
1941
  }
2243
1942
  }
2244
1943
  ]
2245
- },
2246
- "returns": {
2247
- "starting_after": null,
2248
- "ending_before": null,
2249
- "object": "list",
2250
- "has_more": false,
2251
- "total": 0,
2252
- "data": []
2253
1944
  }
2254
1945
  },
2255
1946
  {
2256
1947
  "livemode": false,
2257
1948
  "amount": 2000,
2258
- "status": "fulfilled",
1949
+ "payment_status": "paid",
2259
1950
  "customer_id": null,
2260
1951
  "currency": "MXN",
2261
- "capture": true,
2262
- "last_payment_info": {
2263
- "charge_id": "588655cedba34dd35d000a53",
2264
- "payment_method": "CreditCardPayment",
2265
- "payment_brand": "VISA",
2266
- "status": "paid"
2267
- },
2268
1952
  "customer_info": {
2269
1953
  "email": "logan@x-men.org",
2270
1954
  "phone": "4033420642",
@@ -2275,7 +1959,6 @@
2275
1959
  "first_paid_at": 0
2276
1960
  },
2277
1961
  "shipping_contact": null,
2278
- "fiscal_entity": null,
2279
1962
  "object": "order",
2280
1963
  "id": "ord_2fth4jbNMQ5Bmkofq",
2281
1964
  "metadata": {},
@@ -2380,15 +2063,7 @@
2380
2063
  }
2381
2064
  }
2382
2065
  ]
2383
- },
2384
- "returns": {
2385
- "starting_after": null,
2386
- "ending_before": null,
2387
- "object": "list",
2388
- "has_more": false,
2389
- "total": 0,
2390
- "data": []
2391
2066
  }
2392
2067
  }
2393
2068
  ]
2394
- }
2069
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conekta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MauricioMurga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-13 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -187,7 +187,6 @@ files:
187
187
  - spec/conekta/2.0.0/customer_spec.rb
188
188
  - spec/conekta/2.0.0/discount_line_spec.rb
189
189
  - spec/conekta/2.0.0/error_list_spec.rb
190
- - spec/conekta/2.0.0/fiscal_entity_spec.rb
191
190
  - spec/conekta/2.0.0/line_item_spec.rb
192
191
  - spec/conekta/2.0.0/list_spec.rb
193
192
  - spec/conekta/2.0.0/order_spec.rb
@@ -239,7 +238,6 @@ test_files:
239
238
  - spec/conekta/2.0.0/customer_spec.rb
240
239
  - spec/conekta/2.0.0/discount_line_spec.rb
241
240
  - spec/conekta/2.0.0/error_list_spec.rb
242
- - spec/conekta/2.0.0/fiscal_entity_spec.rb
243
241
  - spec/conekta/2.0.0/line_item_spec.rb
244
242
  - spec/conekta/2.0.0/list_spec.rb
245
243
  - spec/conekta/2.0.0/order_spec.rb
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Conekta::FiscalEntity do
4
- include_context "API 2.0.0"
5
- include_context "customer"
6
-
7
- let(:fiscal_entities) do
8
- [{
9
- tax_id: "AMGH851205MN1",
10
- name: "Nike SA de CV",
11
- address: {
12
- street1: "250 Alexis St",
13
- internal_number: "19",
14
- external_number: "91",
15
- city: "Red Deer",
16
- state: "Alberta",
17
- country: "CA",
18
- postal_code: "T4N 0B8"
19
- }
20
- },
21
- {
22
- tax_id: "AMGH851205MN2",
23
- name: "Nike SA de CV",
24
- address: {
25
- street1: "250 Alexis St",
26
- internal_number: "20",
27
- external_number: "02",
28
- city: "Red Deer",
29
- state: "Alberta",
30
- country: "CA",
31
- postal_code: "T4N 0B8"
32
- }
33
- }]
34
- end
35
-
36
- let(:customer) do
37
- Conekta::Customer.create(customer_data.
38
- merge(fiscal_entities: fiscal_entities))
39
- end
40
- let(:fiscal_entity) { customer.fiscal_entities.first }
41
-
42
- context "deleting fiscal entities" do
43
- it "successful fiscal entity delete" do
44
- begin
45
- fiscal_entity.delete
46
- rescue Conekta::ErrorList => list
47
- puts list.details.map{|d|d.message}.inspect
48
- end
49
-
50
- expect(fiscal_entity.deleted).to eq(true)
51
- end
52
- end
53
-
54
- context "updating fiscal entities" do
55
- it "successful fiscal entity update" do
56
- fiscal_entity.update(name: "Adidas")
57
-
58
- expect(fiscal_entity.name).to eq("Adidas")
59
- end
60
-
61
- it "unsuccessful fiscal entity update" do
62
- expect {
63
- fiscal_entity.update(tax_id: nil)
64
- }.to raise_error(Conekta::ErrorList)
65
- end
66
- end
67
- end