Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix promotion rewards by encoding timestamp as seconds #884

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mobile_config/src/client/carrier_service_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl CarrierServiceVerifier for CarrierServiceClient {
&self,
) -> Result<Vec<ServiceProviderPromotions>, Self::Error> {
let mut request = mobile_config::CarrierIncentivePromotionListReqV1 {
timestamp: Utc::now().encode_timestamp_millis(),
timestamp: Utc::now().encode_timestamp(),
jeffgrunewald marked this conversation as resolved.
Show resolved Hide resolved
signer: self.signing_key.public_key().into(),
signature: vec![],
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE reward_type ADD VALUE 'mobile_promotion';
30 changes: 8 additions & 22 deletions reward_index/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum RewardType {
MobileServiceProvider,
MobileUnallocated,
IotUnallocated,
MobilePromotion,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -185,28 +186,13 @@ impl Indexer {
},
r.amount,
))),
// Some(MobileReward::PromotionReward(PromotionReward {
// entity: Some(Entity::SubscriberId(subscriber_id)),
// service_provider_amount,
// matched_amount,
// })) => Ok(Some((
// RewardKey {
// key: bs58::encode(&subscriber_id).into_string(),
// reward_type: RewardType::MobileSubscriber,
// },
// service_provider_amount + matched_amount,
// ))),
// Some(MobileReward::PromotionReward(PromotionReward {
// entity: Some(Entity::GatewayKey(gateway_key)),
// service_provider_amount,
// matched_amount,
// })) => Ok(Some((
// RewardKey {
// key: PublicKeyBinary::from(gateway_key).to_string(),
// reward_type: RewardType::MobileGateway,
// },
// service_provider_amount + matched_amount,
// ))),
Some(MobileReward::PromotionReward(promotion)) => Ok(Some((
RewardKey {
key: promotion.entity,
reward_type: RewardType::MobilePromotion,
},
promotion.service_provider_amount + promotion.matched_amount,
))),
_ => bail!("got an invalid reward share"),
}
}
Expand Down