mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
hanzo-build-linux-amd64 is the only ARC runner pool installed on hanzo-k8s today (arm64 pool is paused until DigitalOcean ships arm64 droplets, per ~/work/hanzo/.github/RUNNERS.md). The arm64 job was waiting on spark-hanzoai-arm64 — not provisioned in this cluster — so every build sat in queue forever and the amd64 leg got cancelled. Set platforms: linux/amd64 on the reusable build call to skip arm64 entirely. Re-add arm64 if/when DO ships arm64 droplets and the spark runner pool comes back online.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { stripeInstance } from "..";
|
|
|
|
export interface SubscriptionDiscount {
|
|
couponId: string;
|
|
percentOff?: number;
|
|
amountOff?: number;
|
|
duration: string;
|
|
durationInMonths?: number;
|
|
valid: boolean;
|
|
end?: number;
|
|
}
|
|
|
|
export default async function getSubscriptionItem(
|
|
subscriptionId: string,
|
|
isOldAccount: boolean,
|
|
) {
|
|
const stripe = stripeInstance(isOldAccount);
|
|
const subscription = await stripe.subscriptions.retrieve(subscriptionId, {
|
|
expand: ["discount.coupon"],
|
|
});
|
|
const subscriptionItem = subscription.items.data[0];
|
|
|
|
// Extract discount information if available
|
|
let discount: SubscriptionDiscount | null = null;
|
|
if (subscription.discount && subscription.discount.coupon) {
|
|
const coupon = subscription.discount.coupon;
|
|
discount = {
|
|
couponId: coupon.id,
|
|
percentOff: coupon.percent_off || undefined,
|
|
amountOff: coupon.amount_off || undefined,
|
|
duration: coupon.duration,
|
|
durationInMonths: coupon.duration_in_months || undefined,
|
|
valid: coupon.valid,
|
|
end: subscription.discount.end || undefined,
|
|
};
|
|
}
|
|
|
|
return {
|
|
id: subscriptionItem.id,
|
|
currentPeriodStart: subscription.current_period_start,
|
|
currentPeriodEnd: subscription.current_period_end,
|
|
discount,
|
|
};
|
|
}
|