Skip to content

Online shop/membership #292

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

Open
wants to merge 63 commits into
base: dev
Choose a base branch
from
Open

Online shop/membership #292

wants to merge 63 commits into from

Conversation

adisa39
Copy link
Collaborator

@adisa39 adisa39 commented Jul 17, 2025

Refactor @DarinHajou membership implementation to use centralized membership information for scalability and integrated Pi payment for membership.

Copy link

vercel bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
map-of-pi-backend-react Ready Preview Comment Aug 15, 2025 1:00pm

refData: U2URefDataType
): Promise<IPaymentCrossReference> => {
try {
const newRef = new PaymentCrossReference({
order_id: orderId,
order_id: refData.orderId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

refData: U2URefDataType
): Promise<IPaymentCrossReference> => {
try {
const updatedRef = await PaymentCrossReference.findOneAndUpdate(
{ order_id: orderId },
{ order_id: refData.orderId },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

throw error;
}
};

export const createA2UPayment = async (a2uPaymentData: A2UPaymentDataType): Promise<IPayment | null> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 😎👍

@@ -11,25 +11,23 @@ import SellerItem from "../models/SellerItem";
import User from "../models/User";
import { OrderStatusType } from "../models/enums/orderStatusType";
import { OrderItemStatusType } from "../models/enums/orderItemStatusType";
import { IOrder, IUser, NewOrder, PickedItems } from "../types";
import { IOrder, NewOrder } from "../types";
import logger from "../config/loggingConfig";

export const createOrder = async (
orderData: NewOrder,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

…; resolve unit tests in payment helper layer; misc cleanup; WIP.
user_id: user?._id,
pi_uid: user?.pi_uid,
membership_class,
membership_expiration: membership_duration ? new Date(today.getTime() + durationMs) : null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

membership_expiration -> membership_expiry_date

if (newRank > currentRank || newRank < currentRank) {
Object.assign(existing, {
membership_class,
membership_expiration: new Date(today.getTime() + durationMs),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

membership_expiration -> membership_expiry_date

} from "../models/enums/membershipClassType";
import { IMembership, IUser, MembershipOption } from "../types";

import logger from "../config/loggingConfig";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imported, but no logging..?

existing.membership_expiry_date = null;
existing.mappi_balance = 1;
}
// If not expired, just add 1 mappi to the existing balance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems to contradict your implementation. We still want to add +1 Mappi regardless of whether the user’s existing membership is expired. I’ll go ahead and remove the comment @adisa39.

return membership || null;
};

export const updateOrRenewMembership = async (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for review PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants