Skip to content

Commit 4cfd75f

Browse files
authored
feat(billing): Define request and response messages for package service (#208)
* added package request, response, and tests * added package request, response, and tests * id to uid * id to uid and rust * rename
1 parent f98b7a3 commit 4cfd75f

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax = "proto3";
2+
3+
package sentry_protos.billing.v1.services.package.v1;
4+
5+
import "sentry_protos/billing/v1/services/package/v1/package.proto";
6+
7+
message GetPackageRequest {
8+
string package_uid = 1;
9+
}
10+
11+
message GetPackageResponse {
12+
PackageConfig package_config = 1;
13+
}

py/tests/test_billing_v1.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
)
4646
from sentry_protos.billing.v1.common.v1.billing_interval_pb2 import BillingInterval
4747
from sentry_protos.billing.v1.services.package.v1.package_pb2 import PackageConfig
48+
from sentry_protos.billing.v1.services.package.v1.endpoint_get_package_pb2 import (
49+
GetPackageRequest,
50+
GetPackageResponse,
51+
)
4852
from sentry_protos.billing.v1.data_category_pb2 import DataCategory
4953

5054

@@ -378,3 +382,20 @@ def test_package_config_with_billing_interval():
378382
billing_interval=BillingInterval.BILLING_INTERVAL_ANNUAL_BASE_MONTHLY_PAYG,
379383
)
380384
assert annual_package.billing_interval == BillingInterval.BILLING_INTERVAL_ANNUAL_BASE_MONTHLY_PAYG
385+
386+
387+
def test_get_package_request():
388+
request = GetPackageRequest(package_uid="pkg_monthly_123")
389+
assert request.package_uid == "pkg_monthly_123"
390+
391+
392+
def test_get_package_response():
393+
package = PackageConfig(
394+
uid="pkg_monthly_123",
395+
base_price_cents=10000,
396+
billing_interval=BillingInterval.BILLING_INTERVAL_MONTHLY,
397+
)
398+
response = GetPackageResponse(package_config=package)
399+
assert response.package_config.uid == "pkg_monthly_123"
400+
assert response.package_config.base_price_cents == 10000
401+
assert response.package_config.billing_interval == BillingInterval.BILLING_INTERVAL_MONTHLY

rust/src/sentry_protos.billing.v1.services.package.v1.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,13 @@ pub struct PackageConfig {
6464
#[prost(enumeration = "super::super::super::common::v1::BillingInterval", tag = "5")]
6565
pub billing_interval: i32,
6666
}
67+
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
68+
pub struct GetPackageRequest {
69+
#[prost(string, tag = "1")]
70+
pub package_uid: ::prost::alloc::string::String,
71+
}
72+
#[derive(Clone, PartialEq, ::prost::Message)]
73+
pub struct GetPackageResponse {
74+
#[prost(message, optional, tag = "1")]
75+
pub package_config: ::core::option::Option<PackageConfig>,
76+
}

0 commit comments

Comments
 (0)