| Line 13... |
Line 13... |
| 13 |
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
|
13 |
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
|
| 14 |
from shop2020.config.client.ConfigClient import ConfigClient
|
14 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 15 |
import datetime
|
15 |
import datetime
|
| 16 |
from shop2020.utils.Utils import to_java_date
|
16 |
from shop2020.utils.Utils import to_java_date
|
| 17 |
from shop2020.thriftpy.model.v1.order import TransactionService
|
17 |
from shop2020.thriftpy.model.v1.order import TransactionService
|
| 18 |
from shop2020.thriftpy.model.v1.order.ttypes import Transaction, PaymentInfo,\
|
18 |
from shop2020.thriftpy.model.v1.order.ttypes import Transaction, LineItem, TransactionStatus, Order
|
| 19 |
Payment, PaymentStatus, LineItem, TransactionStatus, Order
|
- |
|
| 20 |
|
19 |
|
| 21 |
|
20 |
|
| 22 |
class TransactionClient:
|
21 |
class TransactionClient:
|
| 23 |
file_path = '/tmp/config.properties'
|
22 |
file_path = '/tmp/config.properties'
|
| 24 |
|
23 |
|
| Line 62... |
Line 61... |
| 62 |
transaction.statusDescription = "INIT phase"
|
61 |
transaction.statusDescription = "INIT phase"
|
| 63 |
transaction.transactionStatus = TransactionStatus.INIT
|
62 |
transaction.transactionStatus = TransactionStatus.INIT
|
| 64 |
|
63 |
|
| 65 |
#transaction.expectedDeliveryTime = to_java_date(datetime.datetime.now())
|
64 |
#transaction.expectedDeliveryTime = to_java_date(datetime.datetime.now())
|
| 66 |
|
65 |
|
| 67 |
payment_info = PaymentInfo()
|
66 |
#payment_info = PaymentInfo()
|
| 68 |
payment_info.payments
|
67 |
#payment_info.payments
|
| 69 |
payment_info.payments = {}
|
68 |
#payment_info.payments = {}
|
| 70 |
payment = Payment()
|
69 |
#payment = Payment()
|
| 71 |
payment.merchant_tx_id = "123"
|
70 |
#payment.merchant_tx_id = "123"
|
| 72 |
payment.bank_tx_id = "ICIC0001"
|
71 |
#payment.bank_tx_id = "ICIC0001"
|
| 73 |
payment.mode = "CARD"
|
72 |
#payment.mode = "CARD"
|
| 74 |
payment.amount = 23.5
|
73 |
#payment.amount = 23.5
|
| 75 |
payment.status = PaymentStatus.SUCCESS
|
74 |
#payment.status = PaymentStatus.SUCCESS
|
| 76 |
payment.submissionTimestamp = to_java_date(datetime.datetime.now())
|
75 |
#payment.submissionTimestamp = to_java_date(datetime.datetime.now())
|
| 77 |
payment.completionTimestamp = to_java_date(datetime.datetime.now())
|
76 |
#payment.completionTimestamp = to_java_date(datetime.datetime.now())
|
| 78 |
payment.description = "Sample payment"
|
77 |
#payment.description = "Sample payment"
|
| 79 |
payment_info.payments[to_java_date(datetime.datetime.now())] = payment
|
78 |
#payment_info.payments[to_java_date(datetime.datetime.now())] = payment
|
| 80 |
transaction.paymentInfo = payment_info
|
79 |
#transaction.paymentInfo = payment_info
|
| 81 |
|
80 |
|
| 82 |
order = Order()
|
81 |
order = Order()
|
| 83 |
|
82 |
|
| 84 |
order.status = 5
|
83 |
order.status = 5
|
| 85 |
order.warehouse_id = 1
|
84 |
order.warehouse_id = 1
|