nova-pay-grpc 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3ea929047d15cce58bde5426cc965ce9b90ca634ff5caa48fd0374c634a36eab
4
+ data.tar.gz: 70b6b4a208019b46c070f40f384945bab9f74bb37ae986a5a011256870a3c603
5
+ SHA512:
6
+ metadata.gz: df2a394158b4e4d6fb12d83e26f81122b3df09f3a21d276b921daf840150d871033fde967100e4d10f05e34b3cb28dd7535412cc746dfe0c9cc2be963b927a2a
7
+ data.tar.gz: 7f5df26fc0e0390686c0d056df7ddc5788bf2712a0d11498661f9591f5802ec22f9a761586ddc742f8e27f46e31ab3fe4ce4fec7de6f4f0d09eec2ba62e95993
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## Unreleased
9
+
10
+ ## 1.0.0 - 2026-01-06
11
+
12
+ ### Added
13
+
14
+ - Initial release of the `nova-pay-grpc` gem, providing shared gRPC proto definitions and Ruby stubs for Nova Pay services.
15
+ - `CheckoutService` with `perform` RPC for handling checkout requests.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Coyô Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Nova Pay gRPC
2
+
3
+ Shared gRPC proto definitions and Ruby stubs for Nova Pay services.
4
+
5
+ This gem provides the necessary files to interact with Nova Pay's gRPC services. It includes the generated Ruby code from the `.proto` files, which define the services and messages.
6
+
7
+ ## Technologies Used
8
+
9
+ * **Ruby:** The primary language for the generated gRPC client code.
10
+ * **gRPC:** The RPC framework used for communication between services.
11
+ * **Protocol Buffers:** The data serialization format used by gRPC.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'nova-pay-grpc'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle install
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install nova-pay-grpc
28
+
29
+ ## Usage
30
+
31
+ This gem provides a client for the `CheckoutService`. Here's a basic example of how to use it:
32
+
33
+ ```ruby
34
+ require 'nova/pay/v1/checkout_services_pb'
35
+
36
+ # Create a stub for the CheckoutService
37
+ stub = Nova::Pay::V1::CheckoutService::Stub.new('localhost:50051', :this_channel_is_insecure)
38
+
39
+ # Create a request object
40
+ request = Nova::Pay::V1::CheckoutRequest.new(
41
+ date: Google::Protobuf::Timestamp.new(seconds: Time.now.to_i),
42
+ checkout_page_id: 'your-checkout-page-id',
43
+ payment_plan_id: 1,
44
+ installments: 1,
45
+ customer: Nova::Pay::V1::CustomerInput.new(
46
+ email: 'customer@example.com',
47
+ name: 'John Doe',
48
+ identification: '12345678900',
49
+ phone: '5511999999999',
50
+ zipcode: '12345678',
51
+ street: 'Main Street',
52
+ number: '123',
53
+ neighborhood: 'Downtown',
54
+ city: 'Anytown',
55
+ state: 'AN',
56
+ ),
57
+ items: [
58
+ Nova::Pay::V1::CheckoutItem.new(
59
+ product_id: 1,
60
+ quantity: 1
61
+ )
62
+ ]
63
+ )
64
+
65
+ # Make the RPC call
66
+ begin
67
+ response = stub.perform(request)
68
+ p response
69
+ rescue GRPC::BadStatus => e
70
+ puts "Error: #{e.details}"
71
+ end
72
+ ```
73
+
74
+ ## Contributing
75
+
76
+ Bug reports and pull requests are welcome on GitHub at https://github.com/coyosoftware/nova-pay-grpc.
77
+
78
+ ## License
79
+
80
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ task :default do
6
+ proto_root = 'proto'
7
+ out_dir = 'lib'
8
+
9
+ Dir.glob("#{proto_root}/**/*.proto").each do |proto|
10
+ sh <<~CMD
11
+ grpc_tools_ruby_protoc -I #{proto_root} --ruby_out=#{out_dir} --grpc_out=#{out_dir} #{proto}
12
+ CMD
13
+ end
14
+ end
15
+
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nova
4
+ module Pay
5
+ module Grpc
6
+ VERSION = "1.0.0"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "grpc/version"
4
+
5
+ require "grpc"
6
+ require 'google/protobuf'
7
+ require 'google/protobuf/well_known_types'
8
+
9
+ require "nova/pay/v1/checkout_pb"
10
+ require "nova/pay/v1/checkout_services_pb"
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: nova/pay/v1/checkout.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/struct_pb'
8
+ require 'google/protobuf/timestamp_pb'
9
+
10
+
11
+ descriptor_data = "\n\x1anova/pay/v1/checkout.proto\x12\x0bnova.pay.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xf1\x02\n\x0f\x43heckoutRequest\x12(\n\x04\x64\x61te\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x0bobservation\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x10\x63heckout_page_id\x18\x03 \x01(\t\x12\x17\n\x0fpayment_plan_id\x18\x04 \x01(\x03\x12\x14\n\x0cinstallments\x18\x05 \x01(\x03\x12,\n\x08\x63ustomer\x18\x06 \x01(\x0b\x32\x1a.nova.pay.v1.CustomerInput\x12(\n\x05items\x18\x07 \x03(\x0b\x32\x19.nova.pay.v1.CheckoutItem\x12\x34\n\x0c\x63redit_cards\x18\x08 \x03(\x0b\x32\x1e.nova.pay.v1.CreditCardPayment\x12*\n\x04meta\x18\t \x01(\x0b\x32\x17.google.protobuf.StructH\x01\x88\x01\x01\x42\x0e\n\x0c_observationB\x07\n\x05_meta\"\x80\x02\n\rCustomerInput\x12\r\n\x05\x65mail\x18\x01 \x01(\t\x12\x16\n\x0eidentification\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x14\n\x0cneighborhood\x18\x04 \x01(\t\x12\x0e\n\x06number\x18\x05 \x01(\t\x12\r\n\x05phone\x18\x06 \x01(\t\x12\x0e\n\x06street\x18\x07 \x01(\t\x12\x0f\n\x07zipcode\x18\x08 \x01(\t\x12\r\n\x05state\x18\t \x01(\t\x12\x0c\n\x04\x63ity\x18\n \x01(\t\x12\x12\n\ncomplement\x18\x0b \x01(\t\x12*\n\x04meta\x18\x0c \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x42\x07\n\x05_meta\"h\n\x0c\x43heckoutItem\x12\x12\n\nproduct_id\x18\x01 \x01(\x03\x12\x10\n\x08quantity\x18\x02 \x01(\x05\x12\x1d\n\x10unit_value_cents\x18\x03 \x01(\x03H\x00\x88\x01\x01\x42\x13\n\x11_unit_value_cents\"x\n\x11\x43reditCardPayment\x12\r\n\x05token\x18\x01 \x01(\t\x12\x0f\n\x07\x63\x61rd_id\x18\x02 \x01(\t\x12\x17\n\x0fpayment_plan_id\x18\x03 \x01(\x03\x12\x14\n\x0cinstallments\x18\x04 \x01(\x05\x12\x14\n\x0c\x61mount_cents\x18\x05 \x01(\x03\"T\n\x10\x43heckoutResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12/\n\x04\x64\x61ta\x18\x03 \x01(\x0b\x32!.nova.pay.v1.CheckoutResponseData\"\xd1\x01\n\x14\x43heckoutResponseData\x12.\n\x0corder_status\x18\x01 \x01(\x0e\x32\x18.nova.pay.v1.OrderStatus\x12\x10\n\x08payments\x18\x02 \x03(\t\x12\x15\n\rbank_slip_url\x18\x03 \x01(\t\x12\x13\n\x0bpix_qr_code\x18\x04 \x01(\t\x12\x17\n\x0fpix_qr_code_url\x18\x05 \x01(\t\x12\x32\n\x0epix_expires_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*\xf6\x01\n\x0bOrderStatus\x12\x18\n\x14ORDER_STATUS_PENDING\x10\x00\x12 \n\x1cORDER_STATUS_WAITING_PAYMENT\x10\x01\x12\x1f\n\x1bORDER_STATUS_PARTIALLY_PAID\x10\x02\x12\x15\n\x11ORDER_STATUS_PAID\x10\x03\x12\x1a\n\x16ORDER_STATUS_CANCELLED\x10\x04\x12#\n\x1fORDER_STATUS_PARTIALLY_REFUNDED\x10\x05\x12\x19\n\x15ORDER_STATUS_REFUNDED\x10\x06\x12\x17\n\x13ORDER_STATUS_BILLED\x10\x07\x32Y\n\x0f\x43heckoutService\x12\x46\n\x07perform\x12\x1c.nova.pay.v1.CheckoutRequest\x1a\x1d.nova.pay.v1.CheckoutResponseb\x06proto3"
12
+
13
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
14
+ pool.add_serialized_file(descriptor_data)
15
+
16
+ module Nova
17
+ module Pay
18
+ module V1
19
+ CheckoutRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CheckoutRequest").msgclass
20
+ CustomerInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CustomerInput").msgclass
21
+ CheckoutItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CheckoutItem").msgclass
22
+ CreditCardPayment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CreditCardPayment").msgclass
23
+ CheckoutResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CheckoutResponse").msgclass
24
+ CheckoutResponseData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.CheckoutResponseData").msgclass
25
+ OrderStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("nova.pay.v1.OrderStatus").enummodule
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: nova/pay/v1/checkout.proto for package 'nova.pay.v1'
3
+
4
+ require 'grpc'
5
+ require 'nova/pay/v1/checkout_pb'
6
+
7
+ module Nova
8
+ module Pay
9
+ module V1
10
+ module CheckoutService
11
+ class Service
12
+
13
+ include ::GRPC::GenericService
14
+
15
+ self.marshal_class_method = :encode
16
+ self.unmarshal_class_method = :decode
17
+ self.service_name = 'nova.pay.v1.CheckoutService'
18
+
19
+ rpc :perform, ::Nova::Pay::V1::CheckoutRequest, ::Nova::Pay::V1::CheckoutResponse
20
+ end
21
+
22
+ Stub = Service.rpc_stub_class
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,78 @@
1
+ syntax = "proto3";
2
+
3
+ import "google/protobuf/struct.proto";
4
+ import "google/protobuf/timestamp.proto";
5
+
6
+ package nova.pay.v1;
7
+
8
+ service CheckoutService {
9
+ rpc perform (CheckoutRequest) returns (CheckoutResponse);
10
+ }
11
+
12
+ enum OrderStatus {
13
+ ORDER_STATUS_PENDING = 0;
14
+ ORDER_STATUS_WAITING_PAYMENT = 1;
15
+ ORDER_STATUS_PARTIALLY_PAID = 2;
16
+ ORDER_STATUS_PAID = 3;
17
+ ORDER_STATUS_CANCELLED = 4;
18
+ ORDER_STATUS_PARTIALLY_REFUNDED = 5;
19
+ ORDER_STATUS_REFUNDED = 6;
20
+ ORDER_STATUS_BILLED = 7;
21
+ }
22
+
23
+ message CheckoutRequest {
24
+ google.protobuf.Timestamp date = 1;
25
+ optional string observation = 2;
26
+ string checkout_page_id = 3;
27
+ int64 payment_plan_id = 4;
28
+ int64 installments = 5;
29
+ CustomerInput customer = 6;
30
+ repeated CheckoutItem items = 7;
31
+ repeated CreditCardPayment credit_cards = 8;
32
+ optional google.protobuf.Struct meta = 9;
33
+ }
34
+
35
+ message CustomerInput {
36
+ string email = 1;
37
+ string identification = 2;
38
+ string name = 3;
39
+ string neighborhood = 4;
40
+ string number = 5;
41
+ string phone = 6;
42
+ string street = 7;
43
+ string zipcode = 8;
44
+ string state = 9;
45
+ string city = 10;
46
+ string complement = 11;
47
+ optional google.protobuf.Struct meta = 12;
48
+ }
49
+
50
+ message CheckoutItem {
51
+ int64 product_id = 1;
52
+ int32 quantity = 2;
53
+ optional int64 unit_value_cents = 3;
54
+ }
55
+
56
+ message CreditCardPayment {
57
+ string token = 1;
58
+ string card_id = 2;
59
+ int64 payment_plan_id = 3;
60
+ int32 installments = 4;
61
+ int64 amount_cents = 5;
62
+ }
63
+
64
+ message CheckoutResponse {
65
+ bool success = 1;
66
+ CheckoutResponseData data = 3;
67
+ }
68
+
69
+ message CheckoutResponseData {
70
+ OrderStatus order_status = 1;
71
+ repeated string payments = 2;
72
+ // Bank slip
73
+ string bank_slip_url = 3;
74
+ // Pix
75
+ string pix_qr_code = 4;
76
+ string pix_qr_code_url = 5;
77
+ google.protobuf.Timestamp pix_expires_at = 6;
78
+ }
@@ -0,0 +1,8 @@
1
+ module Nova
2
+ module Pay
3
+ module Grpc
4
+ VERSION: String
5
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nova-pay-grpc
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Coyô Software
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: grpc-tools
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.76'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.76'
26
+ - !ruby/object:Gem::Dependency
27
+ name: grpc
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.76'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.76'
40
+ email:
41
+ - ti@coyo.com.br
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - CHANGELOG.md
47
+ - LICENSE.txt
48
+ - README.md
49
+ - Rakefile
50
+ - lib/nova/pay/grpc.rb
51
+ - lib/nova/pay/grpc/version.rb
52
+ - lib/nova/pay/v1/checkout_pb.rb
53
+ - lib/nova/pay/v1/checkout_services_pb.rb
54
+ - proto/nova/pay/v1/checkout.proto
55
+ - sig/nova/pay/grpc.rbs
56
+ homepage: https://github.com/coyosoftware/nova-pay-grpc
57
+ licenses: []
58
+ metadata:
59
+ allowed_push_host: https://rubygems.org
60
+ homepage_uri: https://github.com/coyosoftware/nova-pay-grpc
61
+ source_code_uri: https://github.com/coyosoftware/nova-pay-grpc
62
+ changelog_uri: https://github.com/coyosoftware/nova-pay-grpc/blob/master/CHANGELOG.md
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 3.1.0
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubygems_version: 4.0.2
78
+ specification_version: 4
79
+ summary: Shared gRPC proto definitions and Ruby stubs for Nova Pay services.
80
+ test_files: []