# Local Debug enviroment setup

## Razer-pay-backend-api

* Create `/home/config`

* Update these file

  * baseEnv.properties

    ```ini
    #部署国家
    DEPLOY_COUNTRY=Singapore
    MANAGEMENT_DEPLOY_COUNTRY=Malaysia,Singapore
    DEPLOY_MODE=uat
    
    ################通用配置部分####################
    #通用redis配置部分
    #REDIS_HOST=172.88.1.229
    #REDIS_PORT=6379
    #REDIS_PASSWORD=clkj123456
    REDIS_HOST=localhost
    REDIS_PORT=6379
    REDIS_PASSWORD=admin
    
    allUrls=Malaysia_https://api-uat.pay.razer.com_ws://api-uat.pay.razer.com:9015/websocket,Singapore_https://api-uat-sg.pay.razer.com_ws://content-uat-sg.pay.razer.com:9015/websocket
    #java api url 前缀
    WEBSOCKET_URL=ws://content-uat-sg.pay.razer.com:9015/websocket
    JAVAAPI_URL_PREFIX=https://api-uat-sg.pay.razer.com
    #MQ host name
    #MQ_HOST_NAME=tcp://172.88.1.149:61616
    #MQ_USERNAME=admin
    #MQ_PASSWORD=admin
    
    MQ_HOST_NAME=tcp://localhost:61616
    MQ_USERNAME=admin
    MQ_PASSWORD=admin
    ```

    

  * Singapore_env.properties

    ```ini
    数据库配置
    jdbc.driverClassName=com.mysql.cj.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/razerpay-singapore-product?useSSL=false&useUnicode=true&characterEncoding=UTF8&characterSetResults=UTF8&serverTimezone=UTC
    jdbc.username=root
    jdbc.password=root
    ```

    

* launch from command prompt `gradle bootrun`

* bypass authentication code - setting breakpoint at BusinessAspect::doAround() class

## razer-pay-wallet-api

* create `razer-pay-wallet-api/config/default.json`

  ```json
  {
      "database": {
          "database": "razerpay-singapore-product",
          "username": "root",
          "password": "root",
          "host": "localhost"
      },
      "redis": {
          "host": "localhost",
          "port": 6379,
          "password": "admin",
          "topupLimitCheck": "true"
      },
      "tnc": {
          "title": "Razer Pay Terms of Service & Privacy Policy Update",
          "content": "Razer Pay is updating its Terms of Service to inform you of the changes to the Wallet Limits for verified and unverified Razer Pay Accounts. The updated Terms of Service will take effect on the date of posting that is 06 May 2020. Your registration and/or continued use of the Razer Pay Service shall constitute your acceptance of the updated Terms of Service.  If you would like more information, you may contact our Customer Support – Lina and our other customer support staff."
      },
      "ossConfig": {
          "region": "oss-ap-southeast-3",
          "accessKeyId": "LTAI0NCWIPAQ1Z9N",
          "accessKeySecret": "3sYlH1bc97yYjv5JcwThqyhQMNRa42",
          "bucket": "certification"
      },
      "awsConfig": {
          "accessKeyId": "AKIAJXPY3N7XFSIYCIVQ",
          "secretAccessKey": "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",
          "imagePath": "certification-production",
          "region": "ap-southeast-1",
          "bucket": "rpd-bucket-chenling-singapore",
          "smtp": {
              "accessKeyId": "AKIA4YZEDSSVENY7F4BL",
              "secretAccessKey": "BGYQfUYDbqdWMd79+23DfCyglmPhzx2XLazuTrghNKFv",
              "emailFrom": "noreply@pay.razer.com",
              "region": "us-east-1"
          }
      },
      "deployConfig": {
          "country": "singapore"
      },
      "firebaseConfig": {
          "type": "service_account",
          "project_id": "one-2-pay-my",
          "private_key_id": "f72deabfab3fd34ea4978c301d515c3540c0a5ce",
          "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCg7z54SBWgrKlR\nguA6ztrpik/xE5qDH4yvCwYd48c/I9EUZHEGwfeDIP/FQkmGf9+IoLBNhIh2v8Jl\noeiA99357/Bt4mG+/YUbrv9nlvVbbJkdATKuc46gIIa/waBV5JgWpwdIGwcPt6a1\n4+oypVX0TObfw+D/rT4I5SUlktzAAUMxjdEBuJLQxWZVbBu9BMluJRqoQmSBMmHv\nwXVXdnCZdC5mX8LMQQDrZTHG2+ktspfhWB0i1J2VPxmBtswYBSsMHTN50sMaICaV\nwvpHQV/nI0WhdJghOaCHtYMsxyEjsk5u18r1PzYja1j5srU3UnUnb6c4nlJ3g/43\nxAILRfoPAgMBAAECggEAF/zhIluYQa1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wVAe+/INJg9nFN\nN4st/iN+K/XtNssux2n6sTNFS2JU5jFzMz5KvFgezTYEpV++OU5DvsODqXgGa9Ct\nmGk4HcL55Ep0QHlZp5dgRJ+5XP8bjRNeo2Jhvea6ZvQoAXGaF5JfefI+6oiUlV4S\nLfXBWmItyRijbT+7gSZciQ==\n-----END PRIVATE KEY-----\n",
          "client_email": "firebase-adminsdk-pasnh@one-2-pay-my.iam.gserviceaccount.com",
          "client_id": "101427092907458528864",
          "auth_uri": "https://accounts.google.com/o/oauth2/auth",
          "token_uri": "https://oauth2.googleapis.com/token",
          "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
          "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-pasnh%40one-2-pay-my.iam.gserviceaccount.com"
      },
      "mq": {
          "address": "localhost",
          "port": "61613",
          "user": "admin",
          "pass": "admin",
          "protocolVersion": "1.0"
      },
      "rms": {
          "rmsInitUrl": "https://www.onlinepayment.com.my/MOLPay/API/RazerPay/payment_miniapp.php",
          "rmsSuccessUrl": "https://www.onlinepayment.com.my//MOLPay/RazerPay/notification.php",
          "rmsSecret": "2d150dc8ca3eb40bd38124266d0a8e7867ca5f9e94db85d832497b7351a703a3",
          "rmsApiSecret": "f3a25b8e58a2a222d042eeaa700ad3e58036f862469432eb15dc4ab604d060ce",
          "visaConfirmUrl": "https://visa-backend-sg.pay.razer.com/visa/v1/card/auth/update",
          "visaSecretKey": "a11d7c9d70e3703acc3017cdcb8d3d917fbac1b0db87d24623558da2e4e12c2a"
      },
      "recurringPayment": {
          "recurringPaymentUrl": "https://www.onlinepayment.com.my/MOLPay/API/Recurring/input_v3.php",
          "recordType": "F"
      },
      "testFilter": {
          "accounts": [
              "60101822379"
          ],
          "types": [
              "IS_ICON_DISPLAY"
          ]
      },
      "rmsPrefix": "RZP-",
      "visaConfig": {
          "listCardsUrl": "https://api-sg.pay.razer.com/v3/card/list",
          "changeCardStatusUrl": "https://api-sg.pay.razer.com/v3/card/changeStatus",
          "showCardDetailsUrl": "https://api-sg.pay.razer.com/v3/card/showCardDetails",
          "cardEnquiryUrl": "",
          "getCardStatementUrl": "",
          "generateCardImageUrl": "",
          "setCardPinUrl": " https://api-sg.pay.razer.com/v3/card/setPin",
          "activateCardPinUrl": "https://api-sg.pay.razer.com/v3/card/activate",
          "convertCardUrl": "https://api-sg.pay.razer.com/v3/card/convert"
      },
      "perx": {
          "perx_api_host": "https://api-razer.perxtech.io",
          "perx_client_id": "d0bcb1115b22c807d7d3d0edf0c69a2a798e910edc0cc78cf1c8c35d8717732f",
          "perx_client_secret": "8ca55ca52b89170d0c28f12b163d9dfca0ced0a857c9dd7aa4b7dde7362caabf",
          "event_rule_id_ekyc": "483df061-2b26-4b02-a302-3d7cbc411792",
          "event_rule_id_card_validation": "aa190907-1c74-4030-8b39-a4e43fcc8c28"
      }
  }
  ```

  

* start docker container for mysql & redis

* npm start

* bypass some authentication code in `server.js` if needed

  ```js
  // add this
  app.use('/', routes);
  
  // bypass below
  // app.use('/', [auth, jwtMiddleware.processRequest()], routes);
  // app.use('/', jwtMiddleware.processVisaMiddlewareRequest(), middlewareRoutes);
  ```

  