-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: dev
Are you sure you want to change the base?
Conversation
…e mappi allowance
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… without membership
…ser service layer; WIP.
…/map-of-pi-backend-react into online-shop/membership
refData: U2URefDataType | ||
): Promise<IPaymentCrossReference> => { | ||
try { | ||
const newRef = new PaymentCrossReference({ | ||
order_id: orderId, | ||
order_id: refData.orderId, |
There was a problem hiding this comment.
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 }, |
There was a problem hiding this comment.
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> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 😎👍
…ayment service layer; WIP.
@@ -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, |
There was a problem hiding this comment.
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.
…mpt to fix build.
…into payment helper function.
user_id: user?._id, | ||
pi_uid: user?.pi_uid, | ||
membership_class, | ||
membership_expiration: membership_duration ? new Date(today.getTime() + durationMs) : null, |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😵
Refactor @DarinHajou membership implementation to use centralized membership information for scalability and integrated Pi payment for membership.