Browse Source

modiry simple pay

tomoya 1 week ago
parent
commit
8d8352e3ba

+ 9 - 9
backend/app/app/api/api_v1/endpoints/simplepayment.py

@@ -32,7 +32,7 @@ def ecpay_payment(
     MerchantTradeNo = 'test'+datetime.now().strftime("NO%Y%m%d%H%M%S")
     remark = {'MerchantTradeNo':MerchantTradeNo}
     remark_string = json.dumps(remark, ensure_ascii=False)
-    ytviews = crud.simplepay.create_with_payment_data(db, 
+    simplepay = crud.simplepay.create_with_payment_data(db, 
                                                         obj_in=user_data, 
                                                         epayment='ecpay',
                                                         remark=remark_string)
@@ -44,10 +44,10 @@ def ecpay_payment(
         'TotalAmount': user_data.amount,
         'TradeDesc': user_data.tradeDesc,
         'ItemName': user_data.item,
-        'ReturnURL': 'https://cloud.choozmo.com/api/v1/payment/ytviews-ecpay-result-return',
+        'ReturnURL': 'https://cloud.choozmo.com/api/v1/payment/simple-pay-ecpay-result-return',
         'ChoosePayment': 'ALL',
-        'ClientBackURL': 'https://cloud.choozmo.com/test-yt-views',
-        'ItemURL': 'https://cloud.choozmo.com/test-yt-views',
+        'ClientBackURL': 'https://cloud.choozmo.com/test-simple-pay',
+        'ItemURL': 'https://cloud.choozmo.com/test-simple-pay',
         'Remark': '',
         'ChooseSubPayment': '',
         'OrderResultURL': '',
@@ -56,7 +56,7 @@ def ecpay_payment(
         'IgnorePayment': 'ATM#CVS#BARCODE',
         'PlatformID': '',
         'InvoiceMark': 'N',
-        'CustomField1': str(ytviews.id),
+        'CustomField1': str(simplepay.id),
         'CustomField2': user_data.taxID if user_data.taxID else '',
         'CustomField3': '',
         'CustomField4': '',
@@ -168,10 +168,10 @@ def ecpay_payment(
         'TotalAmount': user_data.amount,
         'TradeDesc': user_data.tradeDesc,
         'ItemName': user_data.item,
-        'ReturnURL': 'https://cloud.choozmo.com/api/v1/payment/ytviews-ecpay-result-return',
+        'ReturnURL': 'https://cloud.choozmo.com/api/v1/payment/simple-pay-ecpay-result-return',
         'ChoosePayment': 'ALL',
-        'ClientBackURL': 'https://cloud.choozmo.com/yt-views',
-        'ItemURL': 'https://cloud.choozmo.com/yt-views',
+        'ClientBackURL': 'https://cloud.choozmo.com/simple-pay',
+        'ItemURL': 'https://cloud.choozmo.com/simple-pay',
         'Remark': '',
         'ChooseSubPayment': '',
         'OrderResultURL': '',
@@ -321,7 +321,7 @@ CheckMacValue: {CheckMacValue}\
   
   if RtnCode==1:
     simplepay_id = int(CustomField1)
-    simplepay = crud.simplepay.get(db=db, id=ytviews_id)
+    simplepay = crud.simplepay.get(db=db, id=simplepay_id)
     remark = json.loads(simplepay.remark)
     remark['TradeNo'] = TradeNo
     crud.simplepay.update(db, db_obj=simplepay, obj_in={"payment_state":"succeeded", "remark":json.dumps(remark, ensure_ascii=False)})

+ 5 - 5
backend/app/app/schemas/simplepay.py

@@ -20,7 +20,7 @@ class SimplePayBase(BaseModel):
     amount: Optional[str] = None
     
 # Properties to receive on video creation
-class SimplePayCreate(YTViewsBase):
+class SimplePayCreate(SimplePayBase):
     email: EmailStr
     name : str
     phone : str
@@ -35,11 +35,11 @@ class SimplePayCreate(YTViewsBase):
     amount: Optional[str] = None
     
 # Properties to receive on video update
-class SimplePayUpdate(YTViewsBase):
+class SimplePayUpdate(SimplePayBase):
     pass
 
 # Properties shared by models stored in DB
-class SimplePayInDBBase(YTViewsBase):
+class SimplePayInDBBase(SimplePayBase):
     id: int
     email: EmailStr
     name : str
@@ -61,10 +61,10 @@ class SimplePayInDBBase(YTViewsBase):
 
 
 # Properties to return to client
-class SimplePay(YTViewsInDBBase):
+class SimplePay(SimplePayInDBBase):
     pass
 
 
 # Properties properties stored in DB
-class SimplePayInDB(YTViewsInDBBase):
+class SimplePayInDB(SimplePayInDBBase):
     pass