moip2 0.1.4 → 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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +644 -0
  3. data/.travis.yml +14 -3
  4. data/CONTRIBUTING.md +42 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +25 -6
  7. data/Guardfile +1 -2
  8. data/README.md +373 -74
  9. data/Rakefile +2 -2
  10. data/changelog.md +36 -0
  11. data/lib/moip2/accounts_api.rb +27 -0
  12. data/lib/moip2/api.rb +25 -2
  13. data/lib/moip2/auth/basic.rb +2 -5
  14. data/lib/moip2/auth/oauth.rb +0 -3
  15. data/lib/moip2/client.rb +45 -31
  16. data/lib/moip2/connect_api.rb +41 -0
  17. data/lib/moip2/customer_api.rb +16 -2
  18. data/lib/moip2/exceptions/invalid_enviroment_error.rb +0 -2
  19. data/lib/moip2/invoice_api.rb +8 -3
  20. data/lib/moip2/keys_api.rb +14 -14
  21. data/lib/moip2/multi_order_api.rb +1 -3
  22. data/lib/moip2/multi_payment_api.rb +1 -1
  23. data/lib/moip2/notifications_api.rb +33 -0
  24. data/lib/moip2/order_api.rb +18 -3
  25. data/lib/moip2/payment_api.rb +11 -1
  26. data/lib/moip2/refund_api.rb +5 -4
  27. data/lib/moip2/resource/account.rb +12 -0
  28. data/lib/moip2/resource/connect.rb +9 -0
  29. data/lib/moip2/resource/credit_card.rb +12 -0
  30. data/lib/moip2/resource/customer.rb +0 -4
  31. data/lib/moip2/resource/invoice.rb +0 -2
  32. data/lib/moip2/resource/keys.rb +1 -3
  33. data/lib/moip2/resource/multi_order.rb +2 -6
  34. data/lib/moip2/resource/multi_payment.rb +1 -3
  35. data/lib/moip2/resource/notification.rb +12 -0
  36. data/lib/moip2/resource/order.rb +0 -4
  37. data/lib/moip2/resource/payment.rb +0 -4
  38. data/lib/moip2/resource/refund.rb +1 -2
  39. data/lib/moip2/resource/webhooks.rb +11 -13
  40. data/lib/moip2/response.rb +7 -7
  41. data/lib/moip2/util/filters_encoder.rb +28 -0
  42. data/lib/moip2/version.rb +1 -1
  43. data/lib/moip2/webhooks_api.rb +16 -16
  44. data/lib/moip2.rb +10 -5
  45. data/moip2.gemspec +21 -7
  46. data/spec/moip2/accounts_api_spec.rb +189 -0
  47. data/spec/moip2/api_spec.rb +22 -4
  48. data/spec/moip2/auth/basic_spec.rb +8 -4
  49. data/spec/moip2/auth/oauth_spec.rb +4 -4
  50. data/spec/moip2/client_spec.rb +20 -27
  51. data/spec/moip2/connect_api_spec.rb +68 -0
  52. data/spec/moip2/customer_api_spec.rb +147 -72
  53. data/spec/moip2/invoice_spec.rb +51 -32
  54. data/spec/moip2/keys_spec.rb +16 -18
  55. data/spec/moip2/multi_order_api_spec.rb +99 -108
  56. data/spec/moip2/multi_payment_api_spec.rb +8 -11
  57. data/spec/moip2/notifications_api_spec.rb +104 -0
  58. data/spec/moip2/order_api_spec.rb +100 -20
  59. data/spec/moip2/payment_api_spec.rb +77 -17
  60. data/spec/moip2/refund_api_spec.rb +2 -4
  61. data/spec/moip2/resource/order_spec.rb +24 -28
  62. data/spec/moip2/response_spec.rb +0 -8
  63. data/spec/moip2/webhooks_spec.rb +18 -21
  64. data/spec/moip2_spec.rb +6 -13
  65. data/spec/spec_helper.rb +24 -10
  66. data/vcr_cassettes/_create_invoice.yml +42 -0
  67. data/vcr_cassettes/_get_invoice.yml +41 -0
  68. data/vcr_cassettes/account_doesnt_exist.yml +44 -0
  69. data/vcr_cassettes/account_exists.yml +46 -0
  70. data/vcr_cassettes/accounts_show_existent.yml +50 -0
  71. data/vcr_cassettes/accounts_show_nonexistent.yml +42 -0
  72. data/vcr_cassettes/cancel_payment.yml +43 -0
  73. data/vcr_cassettes/capture_payment.yml +42 -0
  74. data/vcr_cassettes/create_account_success_company.yml +87 -0
  75. data/vcr_cassettes/create_account_success_standalone.yml +74 -0
  76. data/vcr_cassettes/create_credit_card_customer.yml +41 -0
  77. data/vcr_cassettes/create_invoice.yml +10 -16
  78. data/vcr_cassettes/create_notification.yml +38 -0
  79. data/vcr_cassettes/create_notification_app.yml +38 -0
  80. data/vcr_cassettes/delete_credit_card_customer.yml +40 -0
  81. data/vcr_cassettes/delete_nonexistent_credit_card_customer.yml +40 -0
  82. data/vcr_cassettes/delete_nonexistent_notification.yml +40 -0
  83. data/vcr_cassettes/delete_notification.yml +36 -0
  84. data/vcr_cassettes/find_all_orders_filters.yml +56 -0
  85. data/vcr_cassettes/find_all_orders_limit.yml +48 -0
  86. data/vcr_cassettes/find_all_orders_multi_filters.yml +57 -0
  87. data/vcr_cassettes/find_all_orders_no_filter.yml +56 -0
  88. data/vcr_cassettes/generate_oauth_token.yml +42 -0
  89. data/vcr_cassettes/get_invoice.yml +10 -15
  90. data/vcr_cassettes/get_keys.yml +1 -1
  91. data/vcr_cassettes/get_notification.yml +38 -0
  92. data/vcr_cassettes/get_notifications_list.yml +38 -0
  93. data/vcr_cassettes/get_payment.yml +42 -0
  94. data/vcr_cassettes/get_payment_not_found.yml +40 -0
  95. data/vcr_cassettes/get_webhooks.yml +1 -1
  96. data/vcr_cassettes/list_invoices.yml +2 -2
  97. data/vcr_cassettes/refresh_oauth_token.yml +40 -0
  98. data/vcr_cassettes/update_invoice.yml +1 -1
  99. metadata +69 -7
@@ -1,11 +1,11 @@
1
1
  describe Moip2::PaymentApi do
2
-
3
- let(:payment_api) { described_class.new(sandbox_client) }
2
+ let(:payment_api) { described_class.new(sandbox_client) }
4
3
 
5
4
  context "with credit card data" do
6
5
  let(:created_payment) do
7
6
  VCR.use_cassette("create_payment_success") do
8
- payment_api.create("ORD-UEK2XGEXNWL9", {
7
+ payment_api.create(
8
+ "ORD-UEK2XGEXNWL9",
9
9
  installmentCount: 1,
10
10
  fundingInstrument: {
11
11
  method: "CREDIT_CARD",
@@ -19,17 +19,17 @@ describe Moip2::PaymentApi do
19
19
  birthdate: "1988-12-30",
20
20
  taxDocument: {
21
21
  type: "CPF",
22
- number: "33333333333"
22
+ number: "33333333333",
23
23
  },
24
24
  phone: {
25
25
  countryCode: "55",
26
26
  areaCode: "11",
27
- number: "66778899"
28
- }
29
- }
30
- }
31
- }
32
- })
27
+ number: "66778899",
28
+ },
29
+ },
30
+ },
31
+ },
32
+ )
33
33
  end
34
34
  end
35
35
 
@@ -45,23 +45,28 @@ describe Moip2::PaymentApi do
45
45
  context "with credit card hash" do
46
46
  let(:created_payment) do
47
47
  VCR.use_cassette("create_payment_with_hash_success") do
48
- payment_api.create("ORD-DDT31SU6LXZO", {
48
+ payment_api.create(
49
+ "ORD-DDT31SU6LXZO",
49
50
  installmentCount: 1,
50
51
  fundingInstrument: {
51
52
  method: "CREDIT_CARD",
52
53
  creditCard: {
53
- hash: "Pf/FTHX09EwW+9mAd2+jhqhVWE8LtdYp+rfoqrSXelFqgkRRdpvcQTKKGA3TVbuInIrH03Cq0Fq1XVwBDgF9EDtFO+L3kacfAl4hfKr55wkvi7yAAZ9MnhqXCzxm+0aOdoc/0UqnsHlxCzpwaGqBZZkQ6Mt+V1e26fxne4OJw2XJeLMOHpPnMM23Uk8BhSsCUVffmiIuE+Ep9VD9b3HkJPqGRPFiKnYT29J6PH2mKYT61u8KM6ZKQu7FmKTtYs25tHtQ2mN7WhfLbAqLARnfBrCKg1a3W+kcWSf4Wjc0z7LWHzFCvT9vxnq8W/fDBAbue102mouV37dlKR8yN7UgZA==",
54
+ hash: "Pf/FTHX09EwW+9mAd2+jhqhVWE8LtdYp+rfoqrSXelFqgkRRdpvcQTKKGA3TVbuInIrH03Cq0Fq1X"\
55
+ "VwBDgF9EDtFO+L3kacfAl4hfKr55wkvi7yAAZ9MnhqXCzxm+0aOdoc/0UqnsHlxCzpwaGqBZZkQ6M"\
56
+ "t+V1e26fxne4OJw2XJeLMOHpPnMM23Uk8BhSsCUVffmiIuE+Ep9VD9b3HkJPqGRPFiKnYT29J6PH2"\
57
+ "mKYT61u8KM6ZKQu7FmKTtYs25tHtQ2mN7WhfLbAqLARnfBrCKg1a3W+kcWSf4Wjc0z7LWHzFCvT9v"\
58
+ "xnq8W/fDBAbue102mouV37dlKR8yN7UgZA==",
54
59
  holder: {
55
60
  fullname: "Jose Portador da Silva",
56
61
  birthdate: "1988-12-30",
57
62
  taxDocument: {
58
63
  type: "CPF",
59
- number: "33333333333"
64
+ number: "33333333333",
60
65
  },
61
- }
62
- }
63
- }
64
- })
66
+ },
67
+ },
68
+ },
69
+ )
65
70
  end
66
71
  end
67
72
 
@@ -73,4 +78,59 @@ describe Moip2::PaymentApi do
73
78
  expect(created_payment).to be_a(Moip2::Resource::Payment)
74
79
  end
75
80
  end
81
+
82
+ describe "#show" do
83
+ let (:payment_id) { "PAY-CRUP19YU2VE1" }
84
+
85
+ let(:payment) do
86
+ VCR.use_cassette("get_payment") do
87
+ payment_api.show(payment_id)
88
+ end
89
+ end
90
+
91
+ it { expect(payment.id).to eq payment_id }
92
+ it { expect(payment.status).to eq "AUTHORIZED" }
93
+ it { expect(payment.installment_count).to eq 1 }
94
+ it { expect(payment.funding_instrument).to_not be_nil }
95
+ it { expect(payment.funding_instrument.credit_card).to_not be_nil }
96
+ it { expect(payment.funding_instrument.credit_card.brand).to eq "MASTERCARD" }
97
+
98
+ context "when payment is not found" do
99
+ let(:payment) do
100
+ VCR.use_cassette("get_payment_not_found") do
101
+ payment_api.show("MOR-INVALID")
102
+ end
103
+ end
104
+
105
+ it "raises a NotFound" do
106
+ expect { payment }.to raise_error Moip2::NotFoundError
107
+ end
108
+ end
109
+ end
110
+
111
+ describe "#capture" do
112
+ let (:captured_payment) do
113
+ VCR.use_cassette("capture_payment") do
114
+ payment_api.capture("PAY-KT5OSI01X8QU")
115
+ end
116
+ end
117
+
118
+ it { expect(captured_payment.id).to eq "PAY-KT5OSI01X8QU" }
119
+ it { expect(captured_payment.status).to eq "AUTHORIZED" }
120
+ it { expect(captured_payment.funding_instrument).to_not be_nil }
121
+ it { expect(captured_payment.installment_count).to eq 1 }
122
+ end
123
+
124
+ describe "#void" do
125
+ let (:cancelled_payment) do
126
+ VCR.use_cassette("cancel_payment") do
127
+ payment_api.void("PAY-IXNGCU456GG4")
128
+ end
129
+ end
130
+
131
+ it { expect(cancelled_payment.id).to eq "PAY-IXNGCU456GG4" }
132
+ it { expect(cancelled_payment.status).to eq "CANCELLED" }
133
+ it { expect(cancelled_payment.funding_instrument).to_not be_nil }
134
+ it { expect(cancelled_payment.installment_count).to eq 1 }
135
+ end
76
136
  end
@@ -3,7 +3,6 @@ describe Moip2::RefundApi do
3
3
 
4
4
  describe "#create order refund" do
5
5
  describe "refund full" do
6
-
7
6
  let(:order_refunded) do
8
7
  VCR.use_cassette("create_full_order_refunded") do
9
8
  refund_api.create("ORD-7JOU41NX4M1S")
@@ -13,13 +12,12 @@ describe Moip2::RefundApi do
13
12
  it "refunds the entire amount" do
14
13
  expect(order_refunded.status).to eq "COMPLETED"
15
14
  end
16
-
17
15
  end
18
16
 
19
17
  describe "partial refund" do
20
18
  let(:refunded_order) do
21
19
  VCR.use_cassette("create_partial_refunded_order") do
22
- refund_api.create("ORD-6K8XPJD9O2KH", { amount: 100 })
20
+ refund_api.create("ORD-6K8XPJD9O2KH", amount: 100)
23
21
  end
24
22
  end
25
23
 
@@ -44,4 +42,4 @@ describe Moip2::RefundApi do
44
42
  expect(refunded_order.id).to eq "REF-QW4T48M7NDFH"
45
43
  end
46
44
  end
47
- end
45
+ end
@@ -1,37 +1,34 @@
1
1
  describe Moip2::Resource::Order do
2
-
3
2
  let(:order) do
4
- described_class.new(sandbox_client, Moip2::Response.new(nil, { external_id: "ORD-UEK2XGEXNWL9" }))
3
+ described_class.new(sandbox_client, Moip2::Response.new(nil, external_id: "ORD-UEK2XGEXNWL9"))
5
4
  end
6
5
 
7
6
  describe "#create_payment" do
8
7
  let(:created_payment) do
9
8
  VCR.use_cassette("create_payment_success") do
10
- order.create_payment({
11
- installmentCount: 1,
12
- fundingInstrument: {
13
- method: "CREDIT_CARD",
14
- creditCard: {
15
- expirationMonth: 05,
16
- expirationYear: 18,
17
- number: "4012001038443335",
18
- cvc: "123",
19
- holder: {
20
- fullname: "Jose Portador da Silva",
21
- birthdate: "1988-12-30",
22
- taxDocument: {
23
- type: "CPF",
24
- number: "33333333333"
25
- },
26
- phone: {
27
- countryCode: "55",
28
- areaCode: "11",
29
- number: "66778899"
30
- }
31
- }
32
- }
33
- }
34
- })
9
+ order.create_payment(installmentCount: 1,
10
+ fundingInstrument: {
11
+ method: "CREDIT_CARD",
12
+ creditCard: {
13
+ expirationMonth: 05,
14
+ expirationYear: 18,
15
+ number: "4012001038443335",
16
+ cvc: "123",
17
+ holder: {
18
+ fullname: "Jose Portador da Silva",
19
+ birthdate: "1988-12-30",
20
+ taxDocument: {
21
+ type: "CPF",
22
+ number: "33333333333",
23
+ },
24
+ phone: {
25
+ countryCode: "55",
26
+ areaCode: "11",
27
+ number: "66778899",
28
+ },
29
+ },
30
+ },
31
+ })
35
32
  end
36
33
  end
37
34
 
@@ -43,5 +40,4 @@ describe Moip2::Resource::Order do
43
40
  expect(created_payment).to be_a(Moip2::Resource::Payment)
44
41
  end
45
42
  end
46
-
47
43
  end
@@ -1,11 +1,9 @@
1
1
  describe Moip2::Response do
2
-
3
2
  let(:parsed_json) { { "id" => "ORD-SOMETHING" } }
4
3
 
5
4
  let(:response) { described_class.new(nil, parsed_json) }
6
5
 
7
6
  describe "method delegation" do
8
-
9
7
  it "delegates []" do
10
8
  expect(response["id"]).to eq("ORD-SOMETHING")
11
9
  end
@@ -13,11 +11,9 @@ describe Moip2::Response do
13
11
  it "delegates attribute to property accessor" do
14
12
  expect(response.id).to eq("ORD-SOMETHING")
15
13
  end
16
-
17
14
  end
18
15
 
19
16
  describe "#success?" do
20
-
21
17
  let(:success_response) do
22
18
  double("Success Response").tap do |success_response|
23
19
  allow(success_response).to receive(:code).and_return(200)
@@ -29,11 +25,9 @@ describe Moip2::Response do
29
25
  it "returns true when response code == 2xx" do
30
26
  expect(response).to be_success
31
27
  end
32
-
33
28
  end
34
29
 
35
30
  describe "#client_error?" do
36
-
37
31
  let(:error_response) do
38
32
  double("Error Response").tap do |error_response|
39
33
  allow(error_response).to receive(:code).and_return(400)
@@ -45,7 +39,5 @@ describe Moip2::Response do
45
39
  it "returns false when response code == 4xx" do
46
40
  expect(response).to be_client_error
47
41
  end
48
-
49
42
  end
50
-
51
43
  end
@@ -1,23 +1,20 @@
1
1
  describe Moip2::WebhooksApi do
2
- let(:webhooks_api) { described_class.new sandbox_oauth_client }
3
-
4
- describe "#show" do
5
-
6
- let(:get_webhooks) do
7
- VCR.use_cassette("get_webhooks") do
8
- webhooks_api.show
9
- end
10
- end
11
-
12
- context 'when shooting request by webhooks' do
13
- it { expect(get_webhooks.webhooks[0][:id]).not_to be_nil }
14
- it { expect(get_webhooks.webhooks[0][:resource_id]).to eq "ORD-2M8Q09MMCCE2" }
15
- it { expect(get_webhooks.webhooks[0][:event]).to eq "ORDER.PAID" }
16
- it { expect(get_webhooks.webhooks[0][:url]) .to eq "http://www.100escolha.com/moip_suporte/" }
17
- it { expect(get_webhooks.webhooks[0][:status]).to eq "CREATED" }
18
- it { expect(get_webhooks.webhooks[0][:sent_at]).to eq "May 13, 2015 7:09:06 PM" }
19
- end
20
-
21
- end
2
+ let(:webhooks_api) { described_class.new sandbox_oauth_client }
22
3
 
23
- end
4
+ describe "#show" do
5
+ let(:get_webhooks) do
6
+ VCR.use_cassette("get_webhooks") do
7
+ webhooks_api.show
8
+ end
9
+ end
10
+
11
+ context "when shooting request by webhooks" do
12
+ it { expect(get_webhooks.webhooks[0][:id]).not_to be_nil }
13
+ it { expect(get_webhooks.webhooks[0][:resource_id]).to eq "ORD-2M8Q09MMCCE2" }
14
+ it { expect(get_webhooks.webhooks[0][:event]).to eq "ORDER.PAID" }
15
+ it { expect(get_webhooks.webhooks[0][:url]) .to eq "http://www.100escolha.com/moip_suporte/" }
16
+ it { expect(get_webhooks.webhooks[0][:status]).to eq "CREATED" }
17
+ it { expect(get_webhooks.webhooks[0][:sent_at]).to eq "May 13, 2015 7:09:06 PM" }
18
+ end
19
+ end
20
+ end
data/spec/moip2_spec.rb CHANGED
@@ -1,17 +1,14 @@
1
1
  describe Moip2 do
2
-
3
2
  describe ".new" do
4
-
5
3
  let(:auth) do
6
4
  Moip2::Auth::Basic.new("TOKEN", "SECRET")
7
5
  end
8
6
 
9
-
10
7
  let(:moip) do
11
8
  described_class.auth = auth
12
9
  described_class.new
13
10
  end
14
-
11
+
15
12
  it "creates a new Api using default environment" do
16
13
  expect(moip.client.env).to eq(:sandbox)
17
14
  end
@@ -23,18 +20,16 @@ describe Moip2 do
23
20
  it "creates a new Client" do
24
21
  expect(moip).to be_a(Moip2::Api)
25
22
  end
26
-
23
+
27
24
  it "valid_env comparision rails variable" do
28
- expect{ Moip2.env=(:production) }.not_to raise_error
25
+ expect { Moip2.env = :production }.not_to raise_error
29
26
  end
30
-
27
+
31
28
  it "invalid enviroment error" do
32
- expect{ Moip2.env=("abc") }.to raise_error(Moip2::InvalidEnviromentError)
29
+ expect { Moip2.env = "abc" }.to raise_error(Moip2::InvalidEnviromentError)
33
30
  end
34
-
35
-
36
- context "when auth is not set" do
37
31
 
32
+ context "when auth is not set" do
38
33
  let(:moip) do
39
34
  described_class.auth = nil
40
35
  described_class.new
@@ -44,7 +39,5 @@ describe Moip2 do
44
39
  expect { moip }.to raise_error
45
40
  end
46
41
  end
47
-
48
42
  end
49
-
50
43
  end
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,34 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
3
-
4
1
  require "moip2"
5
2
 
6
3
  require "vcr"
7
4
  require "webmock"
5
+ require "simplecov"
6
+ SimpleCov.start
8
7
 
9
8
  RSpec.configure do |config|
10
-
11
9
  end
12
- ENV['sandbox_url'] = 'https://sandbox.moip.com.br'
10
+ ENV["sandbox_url"] = "https://sandbox.moip.com.br"
11
+ ENV["connect_sandbox_url"] = "https://connect-sandbox.moip.com.br"
13
12
 
14
13
  VCR.configure do |c|
15
- c.cassette_library_dir = 'vcr_cassettes'
14
+ c.cassette_library_dir = "vcr_cassettes"
16
15
  c.hook_into :webmock # or :fakeweb
17
- c.ignore_hosts 'codeclimate.com'
16
+ c.ignore_hosts "codeclimate.com"
17
+ c.before_record do |i|
18
+ i.response.body.force_encoding("UTF-8")
19
+ end
18
20
  end
19
21
 
20
22
  # Helper methods
21
23
  def sandbox_auth
22
- Moip2::Auth::Basic.new('01010101010101010101010101010101', 'ABABABABABABABABABABABABABABABABABABABAB')
24
+ Moip2::Auth::Basic.new(
25
+ "01010101010101010101010101010101",
26
+ "ABABABABABABABABABABABABABABABABABABABAB",
27
+ )
23
28
  end
24
29
 
25
30
  def sandbox_oauth
26
- Moip2::Auth::OAuth.new "d63tz2xwyu0ewrembove4j5cbv2otpd"
31
+ Moip2::Auth::OAuth.new("9fdc242631454d4c95d82e27b4127394_v2")
27
32
  end
28
33
 
29
34
  def sandbox_client
@@ -35,5 +40,14 @@ def sandbox_oauth_client
35
40
  end
36
41
 
37
42
  def sanbox_client_with_header
38
- Moip2::Client.new(:sandbox, sandbox_auth, { headers: { "Moip-Account" => "MPA-UY765TYBL912" } } )
43
+ Moip2::Client.new(:sandbox, sandbox_auth, headers: { "Moip-Account" => "MPA-UY765TYBL912" })
44
+ end
45
+
46
+ def sandbox_client_connect
47
+ Moip2::Client.new(
48
+ :sandbox,
49
+ sandbox_auth,
50
+ ENV["connect_sandbox_url"],
51
+ {},
52
+ )
39
53
  end
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.moip.com.br/v2/invoices
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"amount":13470,"email":"caio.gama@moip.com.br","invoiceType":"subscription","description":"Assinatura
9
+ da aula de desenho"}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ Authorization:
14
+ - OAuth 9fdc242631454d4c95d82e27b4127394_v2
15
+ response:
16
+ status:
17
+ code: 201
18
+ message: Created
19
+ headers:
20
+ Server:
21
+ - nginx
22
+ Date:
23
+ - Mon, 09 Mar 2015 13:23:23 GMT
24
+ Content-Type:
25
+ - application/json
26
+ Content-Length:
27
+ - '140'
28
+ Connection:
29
+ - keep-alive
30
+ Status:
31
+ - 201 Created
32
+ Via:
33
+ - 1.1 vegur
34
+ X-Content-Type-Options:
35
+ - nosniff
36
+ body:
37
+ encoding: UTF-8
38
+ string: '{"id":"INV-4517A209DDA9","amount":13470,"description":"Assinatura da
39
+ aula de desenho","email":"caio.gama@moip.com.br","type":"subscription"}'
40
+ http_version:
41
+ recorded_at: Mon, 09 Mar 2015 13:22:55 GMT
42
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.moip.com.br/v2/invoices/INV-4517A209DDA9
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - OAuth 9fdc242631454d4c95d82e27b4127394_v2
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Mon, 09 Mar 2015 13:25:33 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '140'
27
+ Connection:
28
+ - keep-alive
29
+ Status:
30
+ - 200 OK
31
+ Via:
32
+ - 1.1 vegur
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"id":"INV-4517A209DDA9","amount":13470,"description":"Assinatura da
38
+ aula de desenho","email":"caio.gama@moip.com.br","type":"subscription"}'
39
+ http_version:
40
+ recorded_at: Mon, 09 Mar 2015 13:25:05 GMT
41
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.moip.com.br/v2/accounts/exists?tax_document=555.000.123-40
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - OAuth 9fdc242631454d4c95d82e27b4127394_v2
14
+ User-Agent:
15
+ - MoipRubySDK/0.1.5 (+https://github.com/moip/moip-sdk-ruby)
16
+ response:
17
+ status:
18
+ code: 400
19
+ message: Bad Request
20
+ headers:
21
+ Date:
22
+ - Tue, 22 Aug 2017 12:51:11 GMT
23
+ Server:
24
+ - nginx/1.6.3
25
+ Status:
26
+ - 400 Bad Request
27
+ Content-Type:
28
+ - application/json
29
+ X-Newrelic-App-Data:
30
+ - PxQFUlBXAQoTVVBRBAkAX1MTGhEhCQ0WQg1UDl1KG3VBBEkEHiBjK14MdhEPTk4BHwUCAVhEWRIXHlNLCxUXERBKfydsERYeA0sJTQFPA1JWAwdRVlYPAQJUVVcPCA9SUB0bAk5EBlRTAFlTCFpXAwUGWAJXWRE/
31
+ Content-Length:
32
+ - '3'
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Vary:
36
+ - Origin
37
+ Connection:
38
+ - close
39
+ body:
40
+ encoding: UTF-8
41
+ string: '400'
42
+ http_version:
43
+ recorded_at: Tue, 22 Aug 2017 12:51:11 GMT
44
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.moip.com.br/v2/accounts/exists?tax_document=436.130.670-21
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - OAuth 9fdc242631454d4c95d82e27b4127394_v2
14
+ User-Agent:
15
+ - MoipRubySDK/0.1.5 (+https://github.com/moip/moip-sdk-ruby)
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 22 Aug 2017 12:51:09 GMT
23
+ Server:
24
+ - nginx/1.6.3
25
+ Status:
26
+ - 200 OK
27
+ Content-Type:
28
+ - application/json
29
+ X-Newrelic-App-Data:
30
+ - PxQFUlBXAQoTVVBRBAkAX1MTGhEhCQ0WQg1UDl1KG3VBBEkEHiBjK14MdhEPTk4BHwUCAVhEWRIXHlNLCxUXERBKfydsERYeA0sJTQFPBlZXAwBQUVIIBghSVFYACBtLVR0UBwRVUFAHVA9WDw8HAABWCkNs
31
+ Expires:
32
+ - Wed, 22 Aug 2018 12:51:09 GMT
33
+ Cache-Control:
34
+ - max-age=31536000, public
35
+ Content-Length:
36
+ - '3'
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Vary:
40
+ - Origin
41
+ body:
42
+ encoding: UTF-8
43
+ string: '200'
44
+ http_version:
45
+ recorded_at: Tue, 22 Aug 2017 12:51:10 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.moip.com.br/v2/accounts/MPA-67C15332EB4A
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - OAuth 9fdc242631454d4c95d82e27b4127394_v2
14
+ User-Agent:
15
+ - MoipRubySDK/0.1.5 (+https://github.com/moip/moip-sdk-ruby)
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 22 Aug 2017 13:43:14 GMT
23
+ Server:
24
+ - Apache
25
+ Status:
26
+ - 200 OK
27
+ X-Newrelic-App-Data:
28
+ - PxQFUlBXAQoTV1VaDgMOVUYdFGQHBDcQUQxLA1tMXV1dORYzVBJHNQFUZAQUFVFQVThOFAVtGAcHUllGDBIQPh8ZWQFbV0FcRyxdHBFJdCcwHxVNVk0IHwBKUVYPCAVQXQYAH1JKQVoFBl0ACQ1QVANWDVUDVApASFBWDRUGZQ==
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '1287'
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Vary:
36
+ - Accept-Encoding,Origin
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"id":"MPA-67C15332EB4A","person":{"lastName":"Silva Silva","phone":{"areaCode":"11","countryCode":"55","number":"965213244"},"parentsName":{"mother":"","father":""},"address":{"zipcode":"01234-000","zipCode":"01234-000","street":"Av.
40
+ Brigadeiro Faria Lima","state":"SP","streetNumber":"2927","district":"Itaim","country":"BRA","city":"São
41
+ Paulo"},"taxDocument":{"number":"436.130.670-21","type":"CPF"},"name":"Joaquim","birthDate":"1990-01-01"},"transparentAccount":false,"email":{"confirmed":false,"address":"dev.moip.1503312536@labs.moip.com.br"},"createdAt":"2017-08-21T07:48:39.000-03:00","businessSegment":{"id":0},"company":{"monthlyRevenue":"","businessName":"ACME
42
+ Inc.","phone":{"areaCode":"15","countryCode":"55","number":"40028922"},"openingDate":"2011-01-01","address":{"complement":"12o
43
+ Andar","zipcode":"01452-002","zipCode":"01452-002","street":"Av. Brig Faria
44
+ Lima","state":"SP","streetNumber":"3064","district":"Itaim Bibi","country":"BRA","city":"São
45
+ Paulo"},"taxDocument":{"number":"88.127.676/0001-91","type":"CNPJ"},"name":"ACME
46
+ Factories","constitutionType":""},"_links":{"self":{"href":"https://sandbox.moip.com.br/accounts/MPA-67C15332EB4A"}},"monthlyRevenueId":0,"softDescriptor":"ACME
47
+ Factori","login":"dev.moip.1503312536@labs.moip.com.br","type":"MERCHANT"}'
48
+ http_version:
49
+ recorded_at: Tue, 22 Aug 2017 13:43:13 GMT
50
+ recorded_with: VCR 2.9.3