Skip to content

Commit

Permalink
Merge branch 'develop' of https://git.cystack.org/locker/api-core int…
Browse files Browse the repository at this point in the history
…o develop
  • Loading branch information
phuongntt-cystack committed Apr 23, 2024
2 parents b0f2ea4 + 9d52cbb commit 1795086
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions locker_server/api_orm/model_parsers/payment_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,7 @@ def parse_payment(cls, payment_orm: PaymentORM) -> Payment:
saas_market=payment_orm.saas_market,
user=user_parser.parse_user(user_orm=payment_orm.user),
promo_code=cls.parse_promo_code(promo_code_orm=payment_orm.promo_code) if payment_orm.promo_code else None,
net_price=payment_orm.net_price,
channel=payment_orm.channel,
customer=cls.parse_customer(customer_orm=payment_orm.customer) if payment_orm.customer else None,
)
17 changes: 14 additions & 3 deletions locker_server/core/entities/payment/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from locker_server.core.entities.payment.customer import Customer
from locker_server.core.entities.payment.promo_code import PromoCode
from locker_server.core.entities.user.user import User
from locker_server.shared.constants.transactions import CURRENCY_USD, TRANSACTION_TYPE_PAYMENT, DURATION_MONTHLY, \
DURATION_YEARLY, DURATION_HALF_YEARLY
from locker_server.shared.constants.transactions import *


class Payment(object):
Expand All @@ -14,7 +13,9 @@ def __init__(self, id: int, payment_id: str, created_time: float = None, total_p
failure_reason: str = None, stripe_invoice_id: str = None, mobile_invoice_id: str = None,
code: str = None, bank_id: int = None, scope: str = None, plan: str = None,
duration: str = DURATION_MONTHLY, metadata: str = None, enterprise_id: str = None,
saas_market: str = None, user: User = None, promo_code: PromoCode = None, customer: Customer = None):
saas_market: str = None, user: User = None, promo_code: PromoCode = None,
net_price: float = 0, channel: str = PAYMENT_CHANNEL_ORGANIC,
customer: Customer = None):
self._id = id
self._payment_id = payment_id
self._created_time = created_time
Expand All @@ -38,6 +39,8 @@ def __init__(self, id: int, payment_id: str, created_time: float = None, total_p
self._saas_market = saas_market
self._user = user
self._promo_code = promo_code
self._net_price = net_price
self._channel = channel
self._customer = customer

@property
Expand Down Expand Up @@ -136,6 +139,14 @@ def user(self):
def promo_code(self):
return self._promo_code

@property
def net_price(self):
return self._net_price

@property
def channel(self):
return self._channel

@property
def customer(self):
return self._customer
Expand Down

0 comments on commit 1795086

Please sign in to comment.