can we modifiy the transaction record in hyperledger composer - hyperledger-fabric

I have a transacton called updatewarranty.In that updatewarranty transaction i am updating a asset called warranty.
This is my json
{
"$class": "org.network.warranty.Transfer",
"TransferId": "9427",
"AuthKey": "",
"TransferDate": "2018-06-30T05:50:32.767Z",
"customer": {
"$class": "org.network.warranty.Customer",
"CustomerId": "2599",
"Address1": "",
"Address2": "",
"Authkey": "",
"City": "",
"Country": "",
"Email": "",
"Mobile": "",
"State": "",
"UserType": 0
},
"retailer": {
"$class": "org.network.warranty.Retailer",
"RetailerId": "8389",
"Address1": "",
"Address2": "",
"Authkey": "",
"City": "",
"Country": "",
"Email": "",
"Mobile": "",
"State": "",
"UserType": 0
},
"warranty": {
"$class": "org.network.warranty.Warranty",
"WarrentyId": "0766",
"End_Date": "2018-06-30T05:50:32.767Z",
"Start_Date": "2018-06-30T05:50:32.767Z",
"IS_Internationaly_Valid": "",
"Item_QRCode": ""
}
}
I have a transaction named getwarranty which takes the warranty id as input.
this is my json
{
"$class": "org.network.warranty.getWarranty",
"warranty": "resource:org.network.warranty.Warranty#0766"
}
When i see the transaction record for getwarranty i dont have the entire transfer record. I have only this information
{
"$class": "org.network.warranty.getWarranty",
"warranty": "resource:org.network.warranty.Warranty#0766",
"transactionId": "6e35c9cb-d3a6-41d8-8c95-fa22c7681824",
"timestamp": "2018-06-30T05:50:54.851Z"
}
how can i get the warranty asset?

Related

How to solve mongodb aggregate lookup returning result of all foreign-field in one local-field before opening the other once

I've searched the internet and StackOverflow, but I cannot find the answer or even the question.
I have two collections, artisan and users. I want my query to return all reports and indicate if the specified user has that report as a favorite in their array.
I'm finding hard to remove the other result for the next data that is set in the first result.
i would love to receive some help on how to get the correct value from the aggregate statement.
if you look so closely, you will see that "_id": "5f21f998fe054d2cf0b7f787" is showing 3 times, but the correct one is the one with "user_id": "5f21f998fe054d2cf0b7f787" of artisan. That is the same for others also
Here below is the code and the result i was getting
Thanks
User.aggregate([
{
$lookup: {
from: Artisan.collection.name,
localField: "user._id",
foreignField: "artisan.user_id",
as: "artisan"
}
},
{$unwind: '$artisan'}
])
.then((result) => {
res.json(result);
}, (err) => next(err))
.catch((err) => next(err));```
\\Here is the result
[
{
"_id": "5f21f998fe054d2cf0b7f787",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Ayobami",
"lastname": "Eniola",
"email": "ekundayoolumide#gmail.com",
"password": "$2b$10$BlfwHzVgZ4kWYfG6Ia4x.Oj6cdVG24Cwl3R9FZQ9lK/1LoUg.WbAi",
"user_type": "artisan",
"createdAt": "2020-07-29T22:35:04.601Z",
"updatedAt": "2020-07-29T22:35:04.601Z",
"__v": 0,
"artisan": {
"_id": "5f21f998fe054d2cf0b7f788",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f21f998fe054d2cf0b7f787",
"createdAt": "2020-07-29T22:35:04.645Z",
"updatedAt": "2020-07-29T22:35:04.645Z",
"__v": 0
}
},
{
"_id": "5f21f998fe054d2cf0b7f787",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Ayobami",
"lastname": "Eniola",
"email": "ekundayoolumide#gmail.com",
"password": "$2b$10$BlfwHzVgZ4kWYfG6Ia4x.Oj6cdVG24Cwl3R9FZQ9lK/1LoUg.WbAi",
"user_type": "artisan",
"createdAt": "2020-07-29T22:35:04.601Z",
"updatedAt": "2020-07-29T22:35:04.601Z",
"__v": 0,
"artisan": {
"_id": "5f21fa632fc70100d0339194",
"date_of_birth": null,
"duration": "4 years",
"payment_status": "",
"payment_type": "",
"user_id": "5f21fa632fc70100d0339193",
"createdAt": "2020-07-29T22:38:27.998Z",
"updatedAt": "2020-07-29T22:42:22.601Z",
"__v": 0
}
},
{
"_id": "5f21f998fe054d2cf0b7f787",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Ayobami",
"lastname": "Eniola",
"email": "ekundayoolumide#gmail.com",
"password": "$2b$10$BlfwHzVgZ4kWYfG6Ia4x.Oj6cdVG24Cwl3R9FZQ9lK/1LoUg.WbAi",
"user_type": "artisan",
"createdAt": "2020-07-29T22:35:04.601Z",
"updatedAt": "2020-07-29T22:35:04.601Z",
"__v": 0,
"artisan": {
"_id": "5f227b0433105d3a3864547e",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f227b0433105d3a3864547d",
"createdAt": "2020-07-30T07:47:16.269Z",
"updatedAt": "2020-07-30T07:47:16.269Z",
"__v": 0
}
},
{
"_id": "5f21fa632fc70100d0339193",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide1#gmail.com",
"password": "john1234",
"user_type": "artisan",
"createdAt": "2020-07-29T22:38:27.957Z",
"updatedAt": "2020-07-29T22:42:22.454Z",
"__v": 0,
"artisan": {
"_id": "5f21f998fe054d2cf0b7f788",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f21f998fe054d2cf0b7f787",
"createdAt": "2020-07-29T22:35:04.645Z",
"updatedAt": "2020-07-29T22:35:04.645Z",
"__v": 0
}
},
{
"_id": "5f21fa632fc70100d0339193",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide1#gmail.com",
"password": "john1234",
"user_type": "artisan",
"createdAt": "2020-07-29T22:38:27.957Z",
"updatedAt": "2020-07-29T22:42:22.454Z",
"__v": 0,
"artisan": {
"_id": "5f21fa632fc70100d0339194",
"date_of_birth": null,
"duration": "4 years",
"payment_status": "",
"payment_type": "",
"user_id": "5f21fa632fc70100d0339193",
"createdAt": "2020-07-29T22:38:27.998Z",
"updatedAt": "2020-07-29T22:42:22.601Z",
"__v": 0
}
},
{
"_id": "5f21fa632fc70100d0339193",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide1#gmail.com",
"password": "john1234",
"user_type": "artisan",
"createdAt": "2020-07-29T22:38:27.957Z",
"updatedAt": "2020-07-29T22:42:22.454Z",
"__v": 0,
"artisan": {
"_id": "5f227b0433105d3a3864547e",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f227b0433105d3a3864547d",
"createdAt": "2020-07-30T07:47:16.269Z",
"updatedAt": "2020-07-30T07:47:16.269Z",
"__v": 0
}
},
{
"_id": "5f227b0433105d3a3864547d",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide2#gmail.com",
"password": "$2b$10$jg/nKNpg/RkDA.KFG/flFuy8fwfamLdgCD7MNk16rprDiwoWTKcse",
"user_type": "artisan",
"createdAt": "2020-07-30T07:47:16.234Z",
"updatedAt": "2020-07-30T07:47:16.234Z",
"__v": 0,
"artisan": {
"_id": "5f21f998fe054d2cf0b7f788",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f21f998fe054d2cf0b7f787",
"createdAt": "2020-07-29T22:35:04.645Z",
"updatedAt": "2020-07-29T22:35:04.645Z",
"__v": 0
}
},
{
"_id": "5f227b0433105d3a3864547d",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide2#gmail.com",
"password": "$2b$10$jg/nKNpg/RkDA.KFG/flFuy8fwfamLdgCD7MNk16rprDiwoWTKcse",
"user_type": "artisan",
"createdAt": "2020-07-30T07:47:16.234Z",
"updatedAt": "2020-07-30T07:47:16.234Z",
"__v": 0,
"artisan": {
"_id": "5f21fa632fc70100d0339194",
"date_of_birth": null,
"duration": "4 years",
"payment_status": "",
"payment_type": "",
"user_id": "5f21fa632fc70100d0339193",
"createdAt": "2020-07-29T22:38:27.998Z",
"updatedAt": "2020-07-29T22:42:22.601Z",
"__v": 0
}
},
{
"_id": "5f227b0433105d3a3864547d",
"email_verified": null,
"sex": "male",
"phone_no": 2348117741341,
"address": "10 Oweh Street",
"area": "",
"city": "Lagos",
"state": "Lagos",
"country": "",
"job_type": "great work",
"status": "",
"login_key": "",
"login_valid_till": null,
"firstname": "Johnson",
"othername": "Akinmade",
"lastname": "Eniola",
"email": "ekundayoolumide2#gmail.com",
"password": "$2b$10$jg/nKNpg/RkDA.KFG/flFuy8fwfamLdgCD7MNk16rprDiwoWTKcse",
"user_type": "artisan",
"createdAt": "2020-07-30T07:47:16.234Z",
"updatedAt": "2020-07-30T07:47:16.234Z",
"__v": 0,
"artisan": {
"_id": "5f227b0433105d3a3864547e",
"date_of_birth": null,
"duration": "",
"payment_status": "",
"payment_type": "",
"user_id": "5f227b0433105d3a3864547d",
"createdAt": "2020-07-30T07:47:16.269Z",
"updatedAt": "2020-07-30T07:47:16.269Z",
"__v": 0
}
}
]
Right now you have:
$lookup: {
from: Artisan.collection.name,
localField: "user._id",
foreignField: "artisan.user_id",
as: "artisan"
}
After looking at your results, the documents from the User collection don't have a field named user._id, they just have an _id field. Similarly with your Artisan collection there isn't a field named artist.user_id, there's just a user_id field. Change the localField and foreignField values to only have the name of the fields as they appear in the respective documents.
It should look something like this:
$lookup: {
from: Artisan.collection.name,
localField: "_id",
foreignField: "user_id",
as: "artisan"
}

Azure API Set-body JSON to JSON covert

The response i am getting is below Which i need to convert the input JSON Format to other JSON structure and send the response back. I am struck how to get the data from the JSOn and construct the new JSON format
{
"totalSize": 1,
"done": true,
"records": [{
"attributes": {
"type": "test123",
"url": "/services/data/testapp"
},
"Id": "8373837",
"Name": "6294",
"Application": "9932932932",
"contact": {
"attributes": {
"type": "testcon",
"url": "/services/data/testappsss"
},
"Name": "testName",
"FirstName": "test",
"LastName": "name",
"MailingStreet": null,
"MailingCity": null,
"unemail": "testname#test,.co",
"MailingState": null,
"MailingCountry": null,
"MailingPostalCode": null,
"stuId": "328237832"
},
"currentusbss": "83277832873278",
"currentsu": {
"attributes": {
"type": "testsub",
"url": "/services/data/v44.0jsjsj"
},
"price": 2,
"Name": "SUB-20426"
},
"bal": 234,
"startdate": "2020-02-03",
"enddate": "2020-05-03"
}]
}
I need to convert above JSON format to below JSON format and send it using set-body method in out-bond policies
{
"info": {
"studentName": "testName",
"studentFirstName": "test",
"studentMiddleName": "",
"studentLastName": "Name",
"studentEmail": "testname#test,.co",
"role": "STUDENT",
"billingCountryCode": "US",
"systemId": "XX",
"stuId": "328237832"
},
"address": {
"address1": "1234 Grove St",
"address2": "",
"city": "Tempe",
"countryCode": "US",
"countryDescription": "UNITED STATES",
"stateCode": "AZ",
"stateDescription": "Arizona",
"postalCode": "45235",
"foreignState": "Arizona",
"region": "Domestic",
"phoneNumber": ""
},
"account": {
"institutionId": "1",
"paymentPlan": "N",
"currencyDesc": "United States Dollars",
"currencyType": "USD",
"bal": 234,
"daysLate":"18",
"opportunityId": "9932932932",
"studentParameterName": null,
"studentParameterValue": null
},
"studentTerms": [
{
"startdate": "2020-02-03",
"enddate": "2020-05-03",
"Name": "SUB-20426",
"description": "XQYember 03, 2020 "
}
]
}
You can use Liquid Template for this case:
Using Liquid Templates in Azure API Management
Using Liquid templates with set body
Or you create a new body in the outbound-section with a new JObject

user profile api doesn't return the authenticationMethods info [docusignapi]

From the eSig API, GET /v2.1/accounts/{accountId}/users/{userId}/profile, this will return the authenticationMethods information, but when I tried on sandbox, I didn't get that section.
the whole api url:
https://demo.docusign.net/restapi/v2.1/accounts/xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx/users/xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx/profile
Response:
{
"displayProfile": "true",
"displayOrganizationInfo": "false",
"displayPersonalInfo": "false",
"displayUsageHistory": "false",
"companyName": "dd",
"title": "Z",
"userDetails": {
"userName": "X Y",
"userId": "xxxxxxx-xxxxx-xxxx-a2a2-79cac67194c7",
"uri": "/users/xxxxx-xxxxx-xxxx-a2a2-xxxxxxx",
"email": "xxx#gmail.com",
"createdDateTime": "2019-10-07T12:38:53.2330000Z",
"userAddedToAccountDateTime": "0001-01-01T08:00:00.0000000Z",
"firstName": "X",
"lastName": "Y",
"permissionProfileId": "xxxxxx",
"permissionProfileName": "Account Administrator",
"defaultAccountId": "xxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"address": {
"address1": "",
"address2": "",
"city": "",
"stateOrProvince": "",
"postalCode": "",
"phone": "",
"fax": "",
"country": ""
},
"usageHistory": {
"signedCount": "0",
"sentCount": "0"
},
"userProfileLastModifiedDate": "2019-10-07T06:08:49.1700000Z"
}

How can I get init_point or sandbox_init_point after calling payment.create API with mercadopago?

I have implemented the preference API and I am getting the response which I have attached. Now I am confused about how to get refund with this response or is it possible or not. Can you please suggest some API related to the refund policy?
Thanks for the cooperation in advance.
The response which I am getting:
{
"processing_modes": [],
"metadata": {},
"binary_mode": false,
"payment_methods": {
"excluded_payment_methods": [
{
"id": ""
}
],
"excluded_payment_types": [
{
"id": ""
}
],
"installments": null,
"default_payment_method_id": null,
"default_installments": null
},
"collector_id": 472389951,
"operation_type": "regular_payment",
"items": [
{
"id": "",
"picture_url": "",
"title": "Mojito",
"description": "Cheesy 8",
"category_id": "Blah Blah",
"currency_id": "ARS",
"quantity": 11,
"unit_price": 456
}
],
"payer": {
"name": "",
"surname": "",
"email": "pappu#testuser.com",
"date_created": "",
"phone": {
"area_code": "",
"number": ""
},
"identification": {
"type": "",
"number": ""
},
"address": {
"street_name": "",
"street_number": null,
"zip_code": ""
}
},
"back_urls": {
"success": "http://eb7b02b9.ngrok.io/notification/ipn",
"pending": "http://eb7b02b9.ngrok.io/notification/ipn",
"failure": "http://eb7b02b9.ngrok.io/notification/ipn"
},
"auto_return": "",
"client_id": "3767495422255439",
"marketplace": "NONE",
"marketplace_fee": 0,
"shipments": {
"receiver_address": {
"zip_code": "",
"street_number": null,
"street_name": "",
"floor": "",
"apartment": ""
}
},
"notification_url": "http://fd7842f1.ngrok.io/notification/ipn",
"external_reference": "",
"additional_info": "",
"expires": false,
"expiration_date_from": null,
"expiration_date_to": null,
"date_created": "2019-10-03T03:35:03.228-04:00",
"id": "472389951-fdfcf414-18b7-44b3-afd5-5d3cd73fbfc2",
"init_point": "https://www.mercadopago.com.ar/checkout/v1/redirect?pref_id=472389951-fdfcf414-18b7-44b3-afd5-5d3cd73fbfc2",
"sandbox_init_point": "https://sandbox.mercadopago.com.ar/checkout/v1/redirect?pref_id=472389951-fdfcf414-18b7-44b3-afd5-5d3cd73fbfc2"
}

How to setup Partial Authentication using Authorize API

Okay I am setting up Partial Payments via the Authorize.net API in order to enable multiple cards to be used to cover a single balance/charge.
I'm assuming thier Partial Auth feature covers my use case, but in testing, there is an issue I can show you using the API live console here: https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
Go to the link above and authorize partial payments with the request I edited below and you will notice when you press submit you get a splitTenderId:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "5KP3u95bQpv",
"transactionKey": "346HZ32z3fP4hTG2"
},
"refId": "123456",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "462.25",
"payment": {
"creditCard": {
"cardNumber": "5424000000000015",
"expirationDate": "2020-12",
"cardCode": "999"
}
},
"lineItems": {
"lineItem": {
"itemId": "1",
"name": "vase",
"description": "Cannes logo",
"quantity": "18",
"unitPrice": "45.00"
}
},
"tax": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"duty": {
"amount": "8.55",
"name": "duty name",
"description": "duty description"
},
"shipping": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"poNumber": "456654",
"customer": {
"id": "99999456654"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"shipTo": {
"firstName": "China",
"lastName": "Bayles",
"company": "Thyme for Tea",
"address": "12 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"customerIP": "192.168.1.1",
"transactionSettings": {
"setting": [
{
"settingName": "emailCustomer",
"settingValue": "true"
}, {
"settingName": "allowPartialAuth",
"settingValue": "true"
},
]
},
"userFields": {
"userField": [
{
"name": "MerchantDefinedFieldName1",
"value": "MerchantDefinedFieldValue1"
},
{
"name": "favorite_color",
"value": "blue"
}
]
}
}
}
}
This is only successful because the amount is 462.25 as the docs say to use for testing, if I use any other (real) amount the splitTenderId is not there.
Here is a new example request, you can post this again on the link above:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "5KP3u95bQpv",
"transactionKey": "346HZ32z3fP4hTG2"
},
"refId": "123456",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "462",
"payment": {
"creditCard": {
"cardNumber": "5424000000000015",
"expirationDate": "2020-12",
"cardCode": "999"
}
},
"lineItems": {
"lineItem": {
"itemId": "1",
"name": "vase",
"description": "Cannes logo",
"quantity": "18",
"unitPrice": "45.00"
}
},
"tax": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"duty": {
"amount": "8.55",
"name": "duty name",
"description": "duty description"
},
"shipping": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"poNumber": "456654",
"customer": {
"id": "99999456654"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"shipTo": {
"firstName": "China",
"lastName": "Bayles",
"company": "Thyme for Tea",
"address": "12 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"customerIP": "192.168.1.1",
"transactionSettings": {
"setting": [
{
"settingName": "emailCustomer",
"settingValue": "true"
}, {
"settingName": "allowPartialAuth",
"settingValue": "true"
},
]
},
"userFields": {
"userField": [
{
"name": "MerchantDefinedFieldName1",
"value": "MerchantDefinedFieldValue1"
},
{
"name": "favorite_color",
"value": "blue"
}
]
}
}
}
}
And with the 462 amount entered this is no longer a partial auth payment and I no longer get a splitTenderId.
Can someone please help me figure out what is going on?

Resources