示例#1
0
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.refund_id, 'refund_id')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['refundId'] = self.refund_id
     return rs
示例#2
0
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.ip_address, 'ip_address')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['ipAddress'] = self.ip_address
     return rs
示例#3
0
 def get_std_parameters(self):
     rs = {}
     if self.requires_api_token():
         ParamValidator.assert_not_empty(self.api_token, 'api_token')
         rs["token"] = self.api_token
     if self.requires_service_id():
         ParamValidator.assert_not_empty(self.service_id, 'service_id')
         rs["serviceId"] = self.service_id
     return rs
示例#4
0
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.transaction_id, 'transaction_id')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['transactionId'] = self.transaction_id
     if ParamValidator.not_empty(self.entrance_code):
         rs['entranceCode'] = self.entrance_code
     return rs
示例#5
0
文件: capture.py 项目: ssl/python-sdk
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.transaction_id, 'transaction_id')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['transactionId'] = self.transaction_id
     if self.products.__len__() > 0:
         rs['products'] = self.products
     if ParamValidator.not_empty(self.tracktrace):
         rs['tracktrace'] = self.tracktrace
     return rs
示例#6
0
文件: refund.py 项目: ssl/python-sdk
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.transaction_id, 'transaction_id')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['transactionId'] = self.transaction_id
     if ParamValidator.not_empty(self.amount):
         rs['amount'] = self.amount
     if ParamValidator.not_empty(self.description):
         rs['description'] = self.description
     if ParamValidator.not_empty(self.process_date):
         rs['processDate'] = self.process_date
     return rs
示例#7
0
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.transaction_id, 'transaction_id')
     # Get default api parameters
     rs = self.get_std_parameters()
     # Add own parameters
     rs['transactionId'] = self.transaction_id
     if ParamValidator.not_empty(self.amount):
         rs['amount'] = self.amount
     if ParamValidator.not_empty(self.description):
         rs['description'] = self.description
     if ParamValidator.not_empty(self.process_date):
         rs['processDate'] = self.process_date
     if ParamValidator.not_empty(self.products):
         rs['products'] = self.products
     if ParamValidator.not_empty(self.vat_percentage):
         rs['fVatPercentage'] = self.vat_percentage
     if ParamValidator.not_empty(self.exchange_url):
         rs['exchangeUrl'] = self.exchange_url
     return rs
示例#8
0
文件: start.py 项目: ssl/python-sdk
 def get_parameters(self):
     # Validation
     ParamValidator.assert_not_empty(self.amount, 'amount')
     ParamValidator.assert_not_empty(self.ip_address, 'ip_address')
     ParamValidator.assert_not_empty(self.finish_url, 'finish_url')
     if ParamValidator.not_empty(
             self.transfer_value) and (self.transfer_type == 'transaction'
                                       or self.transfer_type == 'merchant'):
         raise ValueError(
             'TransferValue cannot be set without valid TransferType, please fix this.'
         )
     # Default api parameters
     rs = self.get_std_parameters()
     #  Append our own parameters
     rs['amount'] = self.amount
     rs['ipAddress'] = self.ip_address
     rs['finishUrl'] = self.finish_url
     if ParamValidator.not_empty(self.payment_option_id):
         rs['paymentOptionId'] = self.payment_option_id
     if ParamValidator.not_empty(self.payment_option_sub_id):
         rs['paymentOptionSubId'] = self.payment_option_sub_id
     if self.test_mode:
         rs['testMode'] = 1
     else:
         rs['testMode'] = 0
     if ParamValidator.not_empty(self.transfer_type):
         rs['transferType'] = self.transfer_type
     if ParamValidator.not_empty(self.transfer_value):
         rs['transferValue'] = self.transfer_value
     # Now handle complex types
     self._merge_transaction_dict(rs)
     self._merge_stats_data_dict(rs)
     self._merge_sales_data_dict(rs)
     self._merge_end_user_dict(rs)
     return rs
示例#9
0
文件: start.py 项目: ssl/python-sdk
 def _merge_sales_data_dict(self, innerdict):
     if ParamValidator.is_null(self.sale_data):
         return
     if not ParamValidator.is_null(self.sale_data.delivery_date):
         innerdict[
             'saleData[deliveryDate]'] = self.sale_data.delivery_date.strftime(
                 '%d-%m-%Y')
     if not ParamValidator.is_null(self.sale_data.invoice_date):
         innerdict[
             'saleData[invoiceDate]'] = self.sale_data.invoice_date.strftime(
                 '%d-%m-%Y')
     if ParamValidator.not_empty(self.sale_data.order_data) and len(
             self.sale_data.order_data) > 0:
         i = 0
         for item in self.sale_data.order_data:
             ParamValidator.assert_not_empty(
                 item.product_id, 'sales_data.order_data.product_id')
             ParamValidator.assert_not_empty(item.price,
                                             'sales_data.order_data.price')
             ParamValidator.assert_not_empty(
                 item.quantity, 'sales_data.order_data.quantity')
             innerdict['saleData[orderData][{}][productId]'.format(
                 i)] = item.product_id
             innerdict['saleData[orderData][{}][price]'.format(
                 i)] = item.price
             innerdict['saleData[orderData][{}][quantity]'.format(
                 i)] = item.quantity
             if ParamValidator.not_empty(item.description):
                 innerdict['saleData[orderData][{}][description]'.format(
                     i)] = item.description
             if ParamValidator.not_empty(item.vat_code):
                 innerdict['saleData[orderData][{}][vatCode]'.format(
                     i)] = item.vat_code
             if ParamValidator.not_empty(item.vat_percentage):
                 innerdict['saleData[orderData][{}][vatPercentage]'.format(
                     i)] = item.vat_percentage
             if ParamValidator.not_empty(item.product_type):
                 innerdict['saleData[orderData][{}][productType]'.format(
                     i)] = item.product_type