Hyperledger Composer Playground Business Logic relationship - blockchain

I'm tasked with learning about HyperLedger Fabric, and I'm supposed to build a business network that has many companies (participants), each company has many Outboxes (also Participants?).
Each Outbox can write Messages(Assets) to the Blockchain.
However, only the company to which the Outbox belongs should be allowed to view/edit etc the message.
So far I've managed to get most of this running, but as of now I still can create new transactions where the message belongs to company 1 and is sent by Outbox 2, which should belong to company 2.
How do I resolve this so that it is impossible to create a Message that belongs to a company 1 and simultaneously to an outbox 2 that itself doesn't belong to company 1?
asset Message identified by messageId {
o String messageId
o String text
--> Company writerCompany
--> App writerApp
}
abstract participant Member identified by memberId{
o String memberId
o String memberName
}
participant App identified by appId{
o String appId
--> Company company
}
participant Company extends Member{
}
participant Auditor extends Member{
}
transaction Write {
--> Message message
--> App writerApp
}
function Write(write) {
write.message.writerApp = write.writerApp;
return getAssetRegistry('org.acme.mynetwork.Message')
.then(function (assetRegistry) {
return assetRegistry.update(write.message);
});
}

Related

Why are my SMS messages sent via Amazon SNS not being received by Indian phone numbers?

I am trying to send text SMS using Amazon SNS in my Springboot application.
This is the configuration class:
#Configuration
#ConfigurationProperties("aws")
public class AwsConfig {
private String accessKeyId;
private String secretAccessKey;
public String getAccessKeyId() {
return accessKeyId;
}
public void setAccessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
}
public String getSecretAccessKey() {
return secretAccessKey;
}
public void setSecretAccessKey(String secretAccessKey) {
this.secretAccessKey = secretAccessKey;
}
public AWSStaticCredentialsProvider awsCredentials() {
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKeyId, secretAccessKey );
return new AWSStaticCredentialsProvider(credentials);
}
#Bean
public AmazonSimpleEmailService getAmazonSimpleEmailService() {
return AmazonSimpleEmailServiceClientBuilder.standard().withCredentials(awsCredentials())
.withRegion("us-east-1").build();
}
#Bean
public AmazonSNS getAmazonSNS() {
return AmazonSNSClientBuilder.standard().withCredentials(awsCredentials())
.withRegion("us-east-1").build();
}
}
This is the class to send messages:
#Service
public class SmsSendingServiceImpl {
#Autowired
private AmazonSNS amazonSNS;
public void sendSMS()
{
Map<String, MessageAttributeValue> smsAttributes = new HashMap<String, MessageAttributeValue>();
smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
.withStringValue("SENDER")
.withDataType("String"));
smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
.withStringValue("Transactional")
.withDataType("String"));
try {
PublishResult result = amazonSNS.publish(new PublishRequest()
.withMessage("This is a test sms.")
.withPhoneNumber("+91-**********").withMessageAttributes(smsAttributes));
System.out.println("Messsage Sent. "+result.getMessageId());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
On calling sendSMS() I do get the Message Sent. message in the console output, but no SMS is being received on the phone number mentioned.
I have tried several different phone numbers for this. None of them are receiving any messages.
It might be worth mentioning that all these numbers are Indian.
Can someone please point out what might be the cause for this?
This is the YouTube video I'm referring to.
The issue you are facing is that India is a country that has special requirements for using a non-numeric sender ID for SMS messages.
Based on Supported Regions and countries documentation for SNS:
Country or region ISO code Supports sender IDs Supports two-way SMS (Amazon Pinpoint only)
India IN Yes3 Yes
Note that the Supports sender IDs column for India is marked as Yes3.
Notes section states:
Senders are required to use a pre-registered alphabetic sender ID. Additional registration steps are required. For more information, see Special requirements for sending SMS messages to recipients in India.
For your origination identity, you can either have origination numbers or sender IDs.
In your case, you cannot opt to use origination numbers as Indian laws require the use of sender IDs instead.
The opposite situation also exists as countries like Canada, China, and the United States require the use of origination numbers (read: U.S. product number comparison for different number types for the number you need to purchase & the SMS cost calculator).
From AWS:
This feature (origination numbers) does not apply when sending SMS to countries where local limitations, laws, or regulations require the use of Sender Ids in the place of origination numbers, for example India.
Therefore, you must follow the Special requirements for sending SMS messages to recipients in India guide. This is what is meant by Additional registration steps are required above.
Unfortunately, there is no workaround for local country laws that AWS apparently needs to abide by.
That said, there may be domestic services that can "circumvent" AWS's legal restriction (as they are domestic/may have special contracts with telecoms etc.). If you don't want to/can't register a sender ID, other services may also be worth looking at.

How data is sent from client to (multi-service) server in gRPC

I am using the gRPC client server framework in one of my application (speech recognition). There are a few important things I want to clarify with my observations.
1. How the optional data field sent, when it is not populated by the client?
Let's see this below example: (assume proto3 is used so all the fields are optional by default)
service NameStudent {
rpc GetRoll(Student) returns (Details) {}
}
#Student'd details
message Student{
int32 roll = 1;
string name = 2;
string gender = 4;
int32 age = 3;
DOB dateofbirth = 5;
}
#Students Date of Birth
message DOB {
int32 dd = 1;
int32 mm = 2;
int32 yy = 3;
}
#Parent's details
message Parent{
string parent =1;
}
#Students all details (includes student + parent)
message Details {
Student student = 1;
Parent parent = 4;
}
Assume that the service takes (input from client) some of the student details, say roll, name, and age, and return that student's (all) details
so now if instead of sending all 3 details (i.e. roll, name and age), even any one or two details can also be sent and (logically assume that) the service works.
In such cases, will the server receive all fields (with blanks/NULLs for omitted fields) or will the client not send that omitted information at all? (see below representations of binary data sent from client)
// roll and name filled
// age is left blank
// gender and DOB are always sent blank from client
{
roll: 170012,
name: "John Doe",
age: ,
gender: "",
dateofbirth: {
dd: ,
mm: ,
yy:
}
}
OR
//only roll and name is sent and rest is just not sent
{
roll: 170012,
name: "John Doe"
}
2. Possible to connect single stub for two services?
If the server offers 2 services and I am making a client stub, will I be able to connect 2 channels from same stub to the same server accessing 2 different services of it?
Question 1
Take a look at this protobuf documentation. In particular:
For any non-repeated fields in proto3, or optional fields in proto2,
the encoded message may or may not have a key-value pair with that
field number.
In practice though, I have observed that optional fields with default values are omitted in the serialization. When the protobuf is deserialized, the parser will interpret the missing field as the default value. You can observe this behavior yourself by using the SerializeToString() method on Python protobuf objects.
Question 2
It's absolutely possible to attach multiple gRPC services to the same server and to interact with multiple services from the same client-side channel. gRPC uses HTTP2 paths to differentiate between multiple services attached to the same server. Take a look at this gRPC Python generated code for an example of that. add_GreeterServicer_to_server associates a user-defined handler with the path /helloworld.Greeter/SayHello, which the stub then uses to identify that service on the server.

OTRS fetch info from url

I've OTRS 5 working fine . I need to retrieve information from web
for example I received emails from support team they put in the subject (customer ID) I need to put in the body message of the Ticket the customer information based on Customer ID which will fetch it from another local system through Url e.x "skldfj.com/dslkde.php?id=23487893"
for example I received ticket in subject: customer 23487893 have issue
in body need to be something like
hello team this customer (ID 23487893) have issue
customer info (fetch it from skldfj.com/dslkde.php?id=23487893)
name
telephone and more

PayPal transaction id is not display in XCart invoice

I would like to know that why XCart have public id instead of PayPal transaction id in their order invoices, And is there any way to displays the PayPal transaction id in invoice after successful order completion through PayPal in XCart .
The reason X-Cart displays internal transaction ID is that if a transaction is not through and you provide a merchant with internal ID, they can go to Orders > Payment transactions section in admin area and will find the transaction details. Paypal's transaction ID would not allow that.
If you want to pull Paypal's transaction ID, you can do that like this:
require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'top.inc.php');
$return = \XLite\Core\Database::getRepo('\XLite\Model\Order')->find(ORDER_ID);
foreach ($return->getEvents() as $event) {
foreach ($event->getDetails() as $detail) {
if ($detail->name == 'Unique customer ID') {
var_dump($detail->value);
}
}
}

How do I get the mailbox and the name of all of the participants of an appointement?

I am working with an Exchange web service, and I want to get the mailbox and the name of all the participants of an appointment.
I do this using:
foreach (Attendee participant in appointment.RequiredAttendees)
{
Console.WriteLine("Attendee {0}", participant.Name);
}
and it returns me nothing.
RequiredAttendees is a string. You need the Recipients collection.