summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-01-26 14:28:28 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-01-26 14:28:28 +0700
commit506b3f58c116e395f6a89e5b6aadf89fe5a7a40e (patch)
tree7f702c8fab493cc07de55a62d46bb1e399353450
parent36f67ca3cd1140a6e8d4cf537a1ce58d5b5ecdc7 (diff)
midtrans implementation
-rw-r--r--indoteknik_api/controllers/api_v1/sale_order.py13
-rwxr-xr-xindoteknik_custom/models/sale_order.py14
2 files changed, 24 insertions, 3 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py
index 90dee56c..f5569afe 100644
--- a/indoteknik_api/controllers/api_v1/sale_order.py
+++ b/indoteknik_api/controllers/api_v1/sale_order.py
@@ -7,6 +7,19 @@ class SaleOrder(controller.Controller):
prefix = '/api/v1/'
PREFIX_PARTNER = prefix + 'partner/<partner_id>/'
+ @http.route(prefix + "sale_order_number", auth='public', method=['GET', 'OPTIONS'])
+ def get_number_sale_order(self, **kw):
+ user_token = self.authenticate()
+ if not user_token:
+ return self.unauthorized_response()
+
+ sale_order_id = int(kw.get('sale_order_id', '0'))
+ if sale_order_id <= 0:
+ return self.unauthorized_response()
+
+ sales = request.env['sale.order'].search_read([('id', '=', sale_order_id)], fields=['id', 'name', 'amount_total'])
+ return self.response(sales)
+
@http.route(PREFIX_PARTNER + 'sale_order', auth='public', method=['GET', 'OPTIONS'])
def get_partner_sale_order(self, **kw):
user_token = self.authenticate()
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 0b9d1f44..b88d9ad0 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -53,11 +53,19 @@ class SaleOrder(models.Model):
partner_purchase_order_description = fields.Text(string='Keterangan PO Customer', copy=False, help="Keterangan purchase order customer, diisi oleh customer melalui website.", tracking=3)
partner_purchase_order_file = fields.Binary(string='File PO Customer', copy=False, help="File purchase order customer, diisi oleh customer melalui website.")
payment_status = fields.Selection([
- ('confirm', 'Menunggu Konfirmasi'),
('pending', 'Pending'),
- ('lunas', 'Lunas'),
+ ('capture', 'Capture'),
+ ('settlement', 'Settlement'),
+ ('deny', 'Deny'),
('cancel', 'Cancel'),
- ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web')
+ ('expire', 'Expire'),
+ ('failure', 'Failure'),
+ ('refund', 'Refund'),
+ ('chargeback', 'Chargeback'),
+ ('partial_refund', 'Partial Refund'),
+ ('partial_chargeback', 'Partial Chargeback'),
+ ('authorize', 'Authorize'),
+ ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
def calculate_so_status_beginning(self):
so_state = ['sale']