Coder Social home page Coder Social logo

segovia_prompt's Introduction

Segovia Deployment Manager Coding Exercise

Conclusions and next steps

Result

You can find the script and resulting transaction status message in send_shillings.ipynb. For ease of access, I also included the script in send_shillings.py as I noticed the .ipynb format takes some time and occasional refreshes to load properly in GitHub.

As you can see, I used the same function (send_request_to_gateway) to send the payment (to /api/pay) and subsequently check on the transaction's status (by sending the request to the /api/transactionstatus endpoint) so that I would receive a message about its status right away.

I tend to receive the following message, as the gateway has not yet attempted to process the payment:

{'transactions': [{'transactionId': 'f212f4c3-2efe-4abd-ab2f-ca174491e804',
   'transactionType': 'pay',
   'statusCode': 100,
   'statusDescription': 'The gateway has received the transaction.',
   'provider': 'autodetect',
   'finished': False,
   'statusType': 'pending'}],
 'finished': True}

To see the result after the transaction statusType is no longer pending, I've locally sent a request the /api/transactionstatus endpoint separately a few moments after sending the request to /api/pay, and received the following result:

{'transactions': [{'transactionId': 'f212f4c3-2efe-4abd-ab2f-ca174491e804',
   'statusCode': 406,
   'statusDescription': 'Cannot autodetect payment provider - recipient account ID 254999999999 is not a phone number with a valid country calling code',
   'finished': True,
   'statusType': 'failed',
   'transactionType': 'pay'}],
 'finished': True}

Potential next steps

I understand that Callbacks are the preferred way to receive results. Were I building this script for a client or attempting to receive updates as the status of the transaction changed, I would attempt to use Callbacks as opposed to explicitly pinging the /api/transactionstatus endpoint.

Given that this particular transaction ultimately failed, I would also want to explore the underlying reasons why and hopefully resolve them.

Context and instructions

We are excited that you are considering Segovia for your next role. As part of the interview process, we ask candidates to demonstrate their technical ability via a take-home exercise. Please take no more than 2 hours to finish this exercise.

Your task is to write a script that uses our public API to pay an amount to a recipient and then reports the status of that transaction immediately afterwards. For example, we'd like to send 1,200 Kenyan Shillings (KES) to this phone number: 254999999999.

Our public API is here. You'll need a few pieces of basic information to get started:

  • Public and private keys that you'll need are included in this package (and have already been registered on our servers)
  • key-id: er157YrM1WL
  • client-id: homework-test

We recommend looking at Request Signatures with some sample code to help you get started.

Please add suitable comments and explanation in your code as you see fit. If you don't finish or wish you could have done more at the end of the 2 hours, feel free to document what you would do next.

Happy coding!

segovia_prompt's People

Contributors

varunrajan avatar

Watchers

James Cloos 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.