Giter Club home page Giter Club logo

Comments (5)

prekucki avatar prekucki commented on June 18, 2024

Step 1: Create Agreeemnt

id: 46210999-206c-419d-8072-8422d5b3a437

Step 2: Create allocation

curl -X POST -s -H "Accept: application/json" -H "Content-type: application/json" --data '{"totalAmount": 50, "timeout": null, "makeDeposit": false }' http://127.0.0.1:2001/payment-api/v1/requestor/allocations
{"allocationId":"012e0acb-e137-4fbf-9127-5f2c9e961b3d",
"totalAmount":"50",
"spentAmount":"0",
"remainingAmount":"50",
"makeDeposit":false}

Step 3: Create Actiivity

result: 6b905bf711504c0ab334c95e8b4995bf

Step 4: Issue invoice

curl -X POST -s -H "Accept: application/json" -H "Content-type: application/json" \
 --data '{"agreementId": "46210999-206c-419d-8072-8422d5b3a437",
 "activityIds": ["6b905bf711504c0ab334c95e8b4995bf"], 
"amount": 10, "creditAccountId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f", 
"paymentDueDate": "2030-01-01T00:00:00Z"}' \
http://127.0.0.1:2011/payment-api/v1/provider/invoices
{
  "invoiceId": "cec4c8c1-6658-4918-b2f1-45a0461414fa",
  "issuerId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "recipientId": "0x4563845390a720f93f57dfef1f4f24fc66729ff9",
  "timestamp": "2020-03-02T09:54:10Z",
  "agreementId": "46210999-206c-419d-8072-8422d5b3a437",
  "activityIds": [
    "6b905bf711504c0ab334c95e8b4995bf"
  ],
  "amount": "10",
  "creditAccountId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "paymentDueDate": "2030-01-01T00:00:00Z",
  "status": "ISSUED"
}

from yagna.

prekucki avatar prekucki commented on June 18, 2024

Step 5: Send invoice to requestor

  -H "Content-type: application/json" \
  --data '{}' \
  http://127.0.0.1:2011/payment-api/v1/provider/invoices/cec4c8c1-6658-4918-b2f1-45a0461414fa/send
{
  "invoiceId": "cec4c8c1-6658-4918-b2f1-45a0461414fa",
  "issuerId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "recipientId": "0x4563845390a720f93f57dfef1f4f24fc66729ff9",
  "timestamp": "2020-03-02T09:54:10Z",
  "agreementId": "46210999-206c-419d-8072-8422d5b3a437",
  "activityIds": [
    "6b905bf711504c0ab334c95e8b4995bf"
  ],
  "amount": "10",
  "creditAccountId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "paymentDueDate": "2030-01-01T00:00:00Z",
  "status": "RECEIVED"
}

from yagna.

prekucki avatar prekucki commented on June 18, 2024

Step 6: Invoice event on reqeuestor

FAIL

curl -H 'Accept: application/json' 'http://127.0.0.1:2001/payment-api/v1/requestor/invoiceEvents'

result: HTTP/1.1 501 Not Implemented

curl http://127.0.0.1:2001/payment-api/v1/requestor/invoices

[
  {
    "invoiceId": "cec4c8c1-6658-4918-b2f1-45a0461414fa",
    "issuerId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
    "recipientId": "0x4563845390a720f93f57dfef1f4f24fc66729ff9",
    "timestamp": "2020-03-02T09:54:10Z",
    "agreementId": "46210999-206c-419d-8072-8422d5b3a437",
    "activityIds": [
      "6b905bf711504c0ab334c95e8b4995bf"
    ],
    "amount": "10",
    "creditAccountId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
    "paymentDueDate": "2030-01-01T00:00:00Z",
    "status": "RECEIVED"
  }
]

from yagna.

prekucki avatar prekucki commented on June 18, 2024

Step 7: Requestor accepts invoice and sends InvoiceAccepted

-H "Accept: application/json" \
-H "Content-type: application/json" \
--data '{"totalAmountAccepted": "10", 
"allocationId": "012e0acb-e137-4fbf-9127-5f2c9e961b3d"}' \
http://127.0.0.1:2001/payment-api/v1/requestor/invoices/cec4c8c1-6658-4918-b2f1-45a0461414fa/accept

From a provider perspective:

'http://127.0.0.1:2011/payment-api/v1/provider/invoices/cec4c8c1-6658-4918-b2f1-45a0461414fa'
{
  "invoiceId": "cec4c8c1-6658-4918-b2f1-45a0461414fa",
  "issuerId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "recipientId": "0x4563845390a720f93f57dfef1f4f24fc66729ff9",
  "timestamp": "2020-03-02T09:54:10Z",
  "agreementId": "46210999-206c-419d-8072-8422d5b3a437",
  "activityIds": [
    "6b905bf711504c0ab334c95e8b4995bf"
  ],
  "amount": "10",
  "creditAccountId": "0x0a92dd80ed3d4bcb7448e7f0a5e70acfb8662c1f",
  "paymentDueDate": "2030-01-01T00:00:00Z",
  "status": "SETTLED"
}

from yagna.

prekucki avatar prekucki commented on June 18, 2024

curl -v -H 'Authorization: Bearer 49acf3568f5542a29ad37f75adcecdc6' -H 'Accept: application/json' 'http://127.0.0.1:2001/payment-api/v1/provider/invoiceEvents'

501 Not Implemented

cli not implemented

from yagna.

Related Issues (20)

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.