Coder Social home page Coder Social logo

ashrajesh / swift-ea Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 2.0 29 KB

Chainlink external adapter that enables SWIFT financial message data to be accessed by smart contracts via gpi API.

Home Page: https://ashwinrajesh.com/portfolio/chainlink-swift/

License: MIT License

Python 97.39% Dockerfile 2.61%
swift chainlink smart-contracts swift-financial-messages swift-ea chainlink-adapter payments

swift-ea's Introduction

SWIFT-EA

Chainlink external adapter that allows SWIFT financial messages to be accessed by the blockchain or smart contract for transaction verification use cases. Now available on Chainlink Marketplace! https://market.link/adapters/5489131f-fc3e-4523-a0a2-ae633f053b1d

Install

pipenv install

Test

pipenv run pytest -rP

Run Serverless (via AWS Lambda or GCP Functions)

Create zip file

pipenv lock -r > requirements.txt
pipenv run pip install -r requirements.txt -t ./package
pipenv run python -m zipfile -c swift-ea.zip main.py adapter.py bridge.py ./package/*

Solidity Example Integration:

Declare UETR ID for desired Transaction

req.add("UETR", "97ed4827-7b6f-4491-a06f-b548d5a7512d")

GET status via HTTP request from options listed on:

https://developer.swift.com/content/tracker-reference#tag/Get-Payment-Transaction-Details

req.add("status", "transactions") or "changed/transactions" or "cancellation" or "status"

Declare your OAuth Basic 2.0 from Sandbox

req.add("oauth", "YourSWIFT-APIOauthToken")

Sample Request Body

{'id': 0, 'data': {'UETR': '97ed4827-7b6f-4491-a06f-b548d5a7512d', 'status': 'transactions', 'oauth_token': 'YourSWIFT-APIOauthToken'}}

Example JSON Response

{
  "uetr": "97ed4827-7b6f-4491-a06f-b548d5a7512d",
  "transaction_status": "ACCC",
  "initiation_time": "2020-08-30T09:00:00.000Z",
  "completion_time": "2020-08-30T17:00:00.000Z",
  "last_update_time": "2020-08-30T17:00:00.000Z",
  "payment_event": [
    {
      "network_reference": "200830BANABEBBGXXX0001000001",
      "message_name_identification": "103",
      "business_service": "001",
      "tracker_event_type": "CTPT",
      "valid": true,
      "instruction_identification": "abc123",
      "transaction_status": "ACSP",
      "transaction_status_reason": "G000",
      "return": false,
      "settlement_method": "INDA",
      "from": "BANABEBBXXX",
      "to": "BANBUS33XXX",
      "serial_parties": {
        "debtor_agent": "BANABEBBXXX",
        "creditor_agent": "BANDJPJTXXX"
      },
      "sender_acknowledgement_receipt": "2020-08-30T09:30:00.000Z",
      "received_date": "2020-08-30T09:30:01.000Z",
      "instructed_amount": {
        "currency": "USD",
        "amount": "1000.00"
      },
      "interbank_settlement_amount": {
        "currency": "USD",
        "amount": "990.00"
      },
      "interbank_settlement_date": "2020-08-30T00:00:00.000Z",
      "charge_bearer": "CRED",
      "charge_amount": [
        {
          "currency": "USD",
          "amount": "10.00"
        }
      ],
      "last_update_time": "2020-08-30T09:30:01.000Z"
    },
    {
      "network_reference": "200830BANBUS33GXXX0033000007",
      "message_name_identification": "199",
      "business_service": "001",
      "tracker_event_type": "CTSU",
      "valid": true,
      "instruction_identification": "statusabc123",
      "transaction_status": "ACSP",
      "transaction_status_reason": "G000",
      "return": false,
      "forwarded_to_agent": "BANCUS33XXX",
      "settlement_method": "INDA",
      "from": "BANBUS33XXX",
      "to": "TRCKCHZZXXX",
      "originator": "BANBUS33XXX",
      "sender_acknowledgement_receipt": "2020-08-30T10:00:00.000Z",
      "confirmed_amount": {
        "currency": "USD",
        "amount": "970.00"
      },
      "charge_bearer": "CRED",
      "charge_amount": [
        {
          "currency": "USD",
          "amount": "10.00"
        },
        {
          "currency": "USD",
          "amount": "20.00"
        }
      ],
      "last_update_time": "2020-08-30T10:00:00.000Z"
    },
    {
      "network_reference": "200830BANCUS33GXXX0017000003",
      "message_name_identification": "103",
      "business_service": "001",
      "tracker_event_type": "CTPT",
      "valid": true,
      "instruction_identification": "def456",
      "transaction_status": "ACSP",
      "transaction_status_reason": "G000",
      "return": false,
      "settlement_method": "INDA",
      "from": "BANCUS33XXX",
      "to": "BANDJPJTXXX",
      "serial_parties": {
        "debtor_agent": "BANABEBBXXX",
        "creditor_agent": "BANDJPJTXXX"
      },
      "sender_acknowledgement_receipt": "2020-08-30T10:30:00.000Z",
      "received_date": "2020-08-30T10:30:01.000Z",
      "instructed_amount": {
        "currency": "USD",
        "amount": "1000.00"
      },
      "interbank_settlement_amount": {
        "currency": "USD",
        "amount": "940.00"
      },
      "interbank_settlement_date": "2020-08-30T00:00:00.000Z",
      "charge_bearer": "CRED",
      "charge_amount": [
        {
          "currency": "USD",
          "amount": "10.00"
        },
        {
          "currency": "USD",
          "amount": "20.00"
        },
        {
          "currency": "USD",
          "amount": "30.00"
        }
      ],
      "last_update_time": "2020-08-30T10:30:01.000Z"
    },
    {
      "network_reference": "200830BANJPJTGXXX0123000007",
      "message_name_identification": "199",
      "business_service": "001",
      "tracker_event_type": "CTSU",
      "valid": true,
      "instruction_identification": "statusdef456",
      "transaction_status": "ACCC",
      "return": false,
      "funds_available": "2020-08-30T17:00:00.000Z",
      "from": "BANDJPJTXXX",
      "to": "TRCKCHZZXXX",
      "originator": "BANDJPJTXXX",
      "sender_acknowledgement_receipt": "2020-08-30T17:00:00.000Z",
      "confirmed_amount": {
        "currency": "USD",
        "amount": "900.00"
      },
      "charge_bearer": "CRED",
      "charge_amount": [
        {
          "currency": "USD",
          "amount": "10.00"
        },
        {
          "currency": "USD",
          "amount": "20.00"
        },
        {
          "currency": "USD",
          "amount": "30.00"
        },
        {
          "currency": "USD",
          "amount": "40.00"
        }
      ],
      "last_update_time": "2020-08-30T17:00:00.000Z"
    }
  ]
}

Above we observe MT103 payment & MT199 confirmation messages

Testing & Development

swift-ea's People

Contributors

ashrajesh avatar ashwinrajesh8 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.