コード例 #1
0
ファイル: request.py プロジェクト: anupsl/pyApps
 def Add(body={}, mobileS='', emailS='', mobileT='', emailT=''):
     tmpDict = {
         'root': {
             'request': [{
                 'type': 'CHANGE_IDENTIFIER',
                 'base_type': 'MERGE',
                 'customer': {
                     'email': emailS,
                     'mobile': mobileS
                 },
                 'old_value': '',
                 'new_value': '',
                 'misc_info': {
                     'target_customer': {
                         'email': emailT,
                         'mobile': mobileT
                     }
                 }
             }]
         }
     }
     if body == {}:
         body = tmpDict
     else:
         body = Utils.mergeDict(tmpDict, body)
     return {
         'body': body,
         'endPoint': constant.config['requestAdd'],
         'method': 'POST'
     }
コード例 #2
0
ファイル: coupon.py プロジェクト: anupsl/pyApps
 def Redeem(body={}, mobile='', code=''):
     tmpDict = {
         'root': {
             'coupon': {
                 'customer': {
                     'mobile': mobile
                 },
                 'code': code,
                 'transaction': {
                     'amount': '100',
                     'number':
                     'AutomationTest' + str(int(time.time() * 100000))
                 }
             }
         }
     }
     if body == {}:
         body = tmpDict
     else:
         body = Utils.mergeDict(tmpDict, body)
     return {
         'body': body,
         'endPoint': constant.config['couponRedeem'],
         'method': 'POST'
     }
コード例 #3
0
 def unsubscribe(body={}):
     tmpDict = {
             'root': {
                 'subscription': {
                      'comment': 'AutomationTest',
                      'is_subscribed': '0',
                      'priority': 'BULK',
                      'scope': 'ALL',
                      'mobile': '',
                      'channel': 'SMS'
                 }
             }
         }
     if body == {}:
         body = tmpDict
     else:
         body = Utils.mergeDict(tmpDict, body)
     return {'body': body, 'endPoint' : constant.config['customerSubscriptions'], 'method' : 'POST'}
コード例 #4
0
 def Add(body={}, mobile=randValues.getRandomMobileNumber()):
     email = 'automail' + mobile + '@gmail.com'
     date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
     tmpDict = {
         'root': {
             'customer': {
                 'mobile': mobile,
                 'email': email,
                 'external_id': mobile,
                 'firstname': ("autofn_" + mobile)[:20],
                 'lastname': ("autoln_" + mobile)[:20],
                 'gender': 'M',
                 'registered_on': date
             }
         }
     }
     if body == {}: 
       body = tmpDict
     else:
       body = Utils.mergeDict(tmpDict, body)
     return {'body': body, 'endPoint' : constant.config['customerAdd'], 'method' : 'POST',
             'mobile': mobile, 'email' : email}
コード例 #5
0
 def Add(body={}, mobile=randValues.getRandomMobileNumber()):
     email = 'automail' + mobile + '@gmail.com'
     date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
     tmpDict = {
         "root": {
             "transaction": {
                 "bill_client_id": "",
                 "type": "regular",
                 "number":
                 'AutomationTest' + str(int(time.time() * 100000)),
                 "amount": "1000",
                 "notes": "No line items",
                 "gross_amount": "1000",
                 "discount": "10",
                 "customer": {
                     "mobile": mobile,
                     "email": email,
                     "external_id": mobile,
                     "firstname": ("autofn_" + mobile)[:20],
                     "lastname": ("autoln_" + mobile)[:20],
                     "type": "loyalty",
                 },
                 "line_items": {
                     'line_item': [{
                         "attributes": {
                             "attribute": {
                                 "name": "Shoes",
                                 "value": "Woodlands"
                             }
                         },
                         "serial": "83",
                         "amount": "382866",
                         "description": "Levis",
                         "item_code": "Levis",
                         "qty": "100",
                         "rate": "5",
                         "value": "500",
                         "discount": "0",
                         "notes": []
                     }, {
                         "attributes": {
                             "attribute": {
                                 "name": "Shoes",
                                 "value": "Woodlands"
                             }
                         },
                         "serial": "83",
                         "amount": "382866",
                         "description": "Levis",
                         "item_code": "Levis",
                         "qty": "100",
                         "rate": "5",
                         "value": "500",
                         "discount": "0",
                         "notes": []
                     }]
                 }
             }
         }
     }
     if body == {}:
         body = tmpDict
     else:
         body = Utils.mergeDict(tmpDict, body)
     return {
         'body': body,
         'endPoint': constant.config['transactionAdd'],
         'method': 'POST',
         'mobile': mobile,
         'email': email,
         'transactionId': body['root']['transaction']['number']
     }