how to keep stock in hyperledger fabric - hyperledger-fabric

I am wondering how to keep track of the owners assets. I don't think having an asset called 'stock' would be very effective in this regard, because that would not seem like the blockchain way.
Let say you are sending a shipment with Product asset to another owner. This owner needs to accept the shipment of products. When he accepted it should I add these products to an inventory asset of that owner?
The other option is when the new owner accepted the shipment, do nothing. And when the owner wants to know his inventory he queries all the shipments with his signature to get the ID of the assets he owns.

I suggest you reading the official Commercial Paper Tutorial which is similar to what you're trying to do.
https://hyperledger-fabric.readthedocs.io/en/release-1.4/tutorial/commercial_paper.html#

Related

Bounded Context for a small eCommerce System

I have to develop an eCommerce website following DDD.
I just completed Ardalis and Julie DDD pluralsight course and need to come up with bounded-context for this project.
Can you please assist if I properly identify bounded contexts for this project?
The requirement is as follow :
The system has 3 types of users : Admin, Manager, and Customer
The system needs to record products, then will display them on online listing,
customer users needs to be able to log invoice which must contain : products added to the invoice + the total
Manager user must be able to edit all invoice.
System must have report on all product sold, in-stock, total products
System must have notification sent to managers only about products that need to be replenished.
I'm thinking of creating 3 bounded context as follow :
Product Management (record, list, invoicing)
For me, Invoice should be a value-object as it doesn't make sense alone, it has always to be associated with customer user.
Report Management
User Management (Admin, Manager, Customer)
Regarding notification, I'm gonna just use Domain Event, no need for a specific bounded-context for it.

Get purchased product from PaymentIntent

in my app i want to list past purchases for a stripe customer. So I was looking at the relevant API objects like PaymentIntents, Sessions or Charges. But they all do not seem to contain any reference to Product or Price, which I would need to list the purchased products.
Subscriptions contain a list of items that are contained in that subscription, so I was expecting PaymentIntents to have something like that too.
Does anyone has an idea how to archive my list of past purchases? Thanks!
I did some digging through the Stripe API docs[1] and, out of the three objects you referrenced (PaymentIntent, Session, Charges), the only one that I can see being able to trace back to a product is the Session.
Session objects have a line_items property[2] which can be followed all the way down to line_items.data.price.product[3]. To access this you’ll need to inlcude the expand=["data.line_items"] parameter to your call to list Checkout Sessions. You can read more about expanding API responses here[4]
So for all the charges to your customers that were done using Checkout Sessions, you could list them all, use the customer property to associate earch session with a customer in your application, traverse the the returned data, and then query the API for the product details. If you have a lot of customers & products these API calls will add up fast so I would store this data in your back-end to avoid hitting rate limits[5].
Alternatively, you could just save the product ID (either Stripe or your local version) as metadata[6] for any of the above Stripe payment objects listed. That would allow you to link any payment object you wish to a product.
https://stripe.com/docs/api
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-price-product
https://stripe.com/docs/expand
https://stripe.com/docs/rate-limits
https://stripe.com/docs/api/metadata
I had the same question I found a way to retrieve the products related to a specific PaymentIntent.
You need to get the sessions that was linked to PaymentIntent when the Checkout process was made.
I will give you the code (in PHP) that I use to to this.
\Stripe\Stripe::setApiKey(STRIPE_API_SECRET);
// Find the Session for that PaymentIntent
$sessions = \Stripe\Checkout\Session::all([
'payment_intent' => "pi_xxxxxxxxxx",
'expand' => ['data.line_items'],
]);
You will then have an key line_items that contain the products linked.
Enjoy

Level 3 data with Stripe Payments

I'm working on a SAAS system that allows purchases to be made through a clients own payment gateway. We have one client that wants to use Stripe as their gateway, however as they are using Corporate Purchase Cards (CPC), it is necessary to pass Level 3 transaction details through. I've been trying to get details from Stripe on how we ensure that Level 3 data can be passed through successfully, however I'm not really getting anywhere with this in terms of getting any definitive information we can work with.
Stripe say that their system supports level 3 data, we just need to provide the data in the first place, however there is nothing in their documentation about this and the example we have been provided only allows for a single item to be listed - we will need to support a basket of different items.
We are using the Payment Intents process and already support adding in Metadata to the transaction. We've been told that adding metadata for SKU, Unit of Measure, Unit Price and Extended Price will allow level 3 processing, however this does seem to fall short of the information list on other sources (not to mention does not allow listing multiple items in the order due to the metadata keys needing to be unique)
Baed on that, our Metadata population looks like this (values hard coded to example purposes)
Dictionary<string, string> nRetVar = new Dictionary<string, string>();
nRetVar.Add("Customer", "John Smith");
nRetVar.Add("Email", "John.Smith#example.com");
nRetVar.Add("Order Number", "12345");
nRetVar.Add("Order Date", "2020-02-06");
nRetVar.Add("SKU", "ABCD1234");
nRetVar.Add("Unit of Measure", "1 Pack");
nRetVar.Add("Unit Price", "$10.00");
nRetVar.Add("Extended Price", "$15.00");
Stripe support never seem to directly answer any of the questions we have been asking about this, so it's proving very hard to get any progress on this - does anyone have enough experience with this to confirm if this metadata is enough to class as level 3, or is there more that we need to be adding?
Stripe supports Level 3 data in their API on both Charge and PaymentIntent. This feature though is currently "gated" which means you need to get access to the feature on your specific account. It's a bit similar to a long running beta. You should contact their support team again and ask for them to enable Level 3 data on PaymentIntent for your account.
The fields they are expecting as specific to that feature. This does not go inside metadata. The documentation is also gated which means you can only see it once you get access to the feature, to avoid confusion for other developers who don't have access.
You can see what the shape looks like in stripe-java for example on Charge here. The feature is not directly supported on PaymentIntent in the library though as this is still private.

CompanyMask - GroupMask to sharing data between companies ACUMATICA

I'm researching for sharing data from Parent Company to another child company and has read 2 blog below but I don't know that how It's work and how can I implement it.
This is the link of blog:
Company Mask
Group Mask
What I'm expecting is share data about Inventory or User or anything else to another company because I just want to use 1 product for all company.
Is there any ideas to use Company mask and Group mask to share data to another company?
Thanks for reading and thanks for your help!
For sharing data between tenants (companies), CompanyMask is the field. GroupMask is for restriction groups and is to do with row level permission within a tenant. There is an old but very effective blog post here: https://blog.acumatica.com.sg/2013/05/understanding-company-setup-options.html that talks about it in great detail that should get you what you want.

REST API - How to design rest api?

I'm little bit confused about when to create a new entity in rest. I have this rest api implemented in node:
GET api/v1/services - get all services
GET api/v1/services/{serviceId}/suppliers - get all suppliers for service id
Now, I want to add another api for getting all suppliers, no matter which service.
Does the following approach is good practice?
GET api/v1/services/suppliers - get all suppliers
PUT api/v1/services/suppliers/{supplierId} - edit by supplier id
Or should we need to create a new suppliers entity?
I hope that #wizard already found an answer for his question.
But here are my thoughts.
As per my understanding, the resource "api/v1/services/suppliers" is not a right way to get back all the suppliers. We can use the REST Subresources to represent the relationships so that it will be more readable one. But here Supplier resource can't be used outside of parent resource(Services).
But in this case, we want to get all supplier details and also update the specific supplier information. Hence we require a flexible API. So we have to create another endpoint(/api/v1/suppliers) for working with supplier details.
(/api/v1/suppliers - fetch all the supplier details(GET)
and
/api/v1/suppliers/{supplierId} [PUT] for updating a specific supplier.

Resources