Passing custom attributes to an authorize.net checkout page - authorize.net

We're going to build a portal for an authorize.net merchant. A page in this portal will have a button that will navigate to an authorize.net hosted checkout page.
Is it possible to pass custom metadata to that page which will get stored in authorize.net when the payment is complete? The goal is to allow the merchant to have a reference to the customer's identity in our system.

One Authorize.net Get Accept Hosted parameter designed for this purpose would be the refId (string, up to 20 characters). Which is a merchant-assigned reference ID for the request.
If included in the request, this value is included in the response.
E.g.,
{
"getHostedPaymentPageRequest": {
"merchantAuthentication": {
"name": "LOGIN",
"transactionKey": "TRANSACTION_KEY"
},
"refId": "123456",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "20.00",
"profile": {
"customerProfileId": "123456789"
},
"customer": {
"email": "ellen#example.com"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "US"
}
},
"hostedPaymentSettings": {
"setting": [{
"settingName": "hostedPaymentReturnOptions",
"settingValue": "{\"showReceipt\": true, \"url\": \"https://example.com/receipt\", \"urlText\": \"Continue\", \"cancelUrl\": \"https://example.com/cancel\", \"cancelUrlText\": \"Cancel\"}"
}, {
"settingName": "hostedPaymentButtonOptions",
"settingValue": "{\"text\": \"Pay\"}"
}, {
"settingName": "hostedPaymentStyleOptions",
"settingValue": "{\"bgColor\": \"blue\"}"
}, {
"settingName": "hostedPaymentPaymentOptions",
"settingValue": "{\"cardCodeRequired\": false, \"showCreditCard\": true, \"showBankAccount\": true}"
}, {
"settingName": "hostedPaymentSecurityOptions",
"settingValue": "{\"captcha\": false}"
}, {
"settingName": "hostedPaymentShippingAddressOptions",
"settingValue": "{\"show\": false, \"required\": false}"
}, {
"settingName": "hostedPaymentBillingAddressOptions",
"settingValue": "{\"show\": true, \"required\": false}"
}, {
"settingName": "hostedPaymentCustomerOptions",
"settingValue": "{\"showEmail\": false, \"requiredEmail\": false, \"addPaymentProfile\": true}"
}, {
"settingName": "hostedPaymentOrderOptions",
"settingValue": "{\"show\": true, \"merchantName\": \"G and S Questions Inc.\"}"
}, {
"settingName": "hostedPaymentIFrameCommunicatorUrl",
"settingValue": "{\"url\": \"https://example.com/special\"}"
}]
}
}
}

Related

SSRS Subscription using REST API

Can we create/modify SSRS Subscription using REST API as SQL Server Reporting services 2017 supports REST API calls?
here is an online swagger example they built, but some properties are invalid or missing. Ex: Schedule property is missing and ExtensionSettings.ParameterValues is an array instead of an object
https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0#/Subscriptions/GetSubscriptions
here is an example of a body message that works for me when posting:
{ "DataQuery": null, "DeliveryExtension": "Report Server Email", "Description": "test3", "EventType": "TimedSubscription", "ExtensionSettings": { "Extension": "Report Server Email", "ParameterValues": [ { "IsValueFieldReference": false, "Name": "TO", "Value": "userName" }, { "IsValueFieldReference": false, "Name": "IncludeReport", "Value": "True" }, { "IsValueFieldReference": false, "Name": "RenderFormat", "Value": "PDF" }, { "IsValueFieldReference": false, "Name": "Subject", "Value": "#ReportName was executed at #ExecutionTime" }, { "IsValueFieldReference": false, "Name": "IncludeLink", "Value": "True" }, { "IsValueFieldReference": false, "Name": "Priority", "Value": "NORMAL" } ] }, "IsActive": true, "IsDataDriven": false, "LastRunTime": null, "LastStatus": "New Subscription", "LocalizedDeliveryExtensionName": "E-Mail", "ModifiedBy": "userName", "ModifiedDate": "2020-09-04T13:45:51.343-05:00", "Owner": "userName", "ParameterValues": [], "Report": "/Folder Name/Report Name", "Schedule": { "Definition": { "EndDate": "0001-01-01T00:00:00Z", "EndDateSpecified": false, "Recurrence": { "DailyRecurrence": { "DaysInterval": 1 }, "MinuteRecurrence": null, "MonthlyDOWRecurrence": null, "MonthlyRecurrence": null, "WeeklyRecurrence": null }, "StartDateTime": "2020-09-04T02:00:00-05:00" }, "ScheduleID": null }, "ScheduleDescription": "At 2:00 AM every day, starting 9/4/2020" }

How to Implement Partial Auth on Authorize.net API [duplicate]

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?

JSON model in loopback

I want to return such model from my customer table.
{
"1521544526409": {
"address": "",
"city": "",
"company": "Atoy oy",
"email": "henry.tuohimaa#atoy.fi",
"forename": "Henry",
"moreinfo": "",
"note": "Customer related notes",
"postalcode": "",
"surname": "Tuohimaa",
"tel": "0503383882"
},
"1521544680834": {
"address": "",
"city": "",
"company": "",
"email": "",
"forename": "dsfdfs",
"note": "",
"postalcode": "",
"surname": "sdffd",
"tel": "fdsdsf"
},
}
Can anyone tell what should my model look like?
Current model is as below.
{
"name": "customer",
"plural": "customer",
"base": "Model",
"idInjection": false,
"options": {
"validateUpsert": true
},
"properties": {
"Id": {
"type": "number",
"id": true
},
"FirstName": {
"type": "string"
},
"LastName": {
"type": "string"
},
"Company": {
"type": "string"
},
},
"validations": [],
"acls": [],
"methods": {}
}
My customer.js file.
const connector = app.dataSources.tovio.connector;
const sql = 'select * from customer INNER JOIN \
address ON address.Id = customer.AddressId';
module.exports = function (Customer) {
Customer.getDetails = function (data, cb) {
connector.execute(sql, null, (err, instance) => {
cb(null, instance);
});
};
Customer.remoteMethod(
'getDetails', {
http: { path: '/getdetails', verb: 'get' },
accepts: { arg: 'Id', type: 'number', http: { source: 'query' } },
returns: { type: 'array', root: true }
}
);
}
My URL is as follow. - http://localhost:3000/api/customer/getdetails
and response is
[
{
"Id": 1,
"FirstName": "Lindsay",
"LastName": "Baxter",
"Company": "Pearl Architectural Design",
"Email": "laron_jones",
"Telephone": "773-617-5179",
"Note": "Note1",
"MoreDetails": "More1kjk",
"AddressId": 1,
"IsActive": 0,
"Created": "2018-04-18T04:38:55.000Z",
"Creator": null,
"Modified": "2018-04-18T04:38:55.000Z",
"Modifier": null,
"Address": "4267 Cherry Ridge Drive",
"City": "Webster",
"PostalCode": "14580"
},
{
"Id": 1,
"FirstName": "James",
"LastName": "Baxter",
"Company": "Hudson",
"Email": "evert.ksd",
"Telephone": "484-319-7836",
"Note": "Note3",
"MoreDetails": "More3",
"AddressId": 1,
"IsActive": 0,
"Created": "2018-04-18T04:38:55.000Z",
"Creator": null,
"Modified": "2018-04-18T04:38:55.000Z",
"Modifier": null,
"Address": "4267 Cherry Ridge Drive",
"City": "Webster",
"PostalCode": "14580"
},
]
// customer.js
module.exports = function (Customer) {
Customer.getDetails = function (id, done) {
Customer.findById(id, function (err, customer) {
if (err || !customer) return done(err, customer)
let res = {
// now you have the customer object, build your response
}
done(null, res)
})
}
Customer.remoteMethod(
'getDetails',
{
path: '/getdetails/:id', verb: 'get' },
accepts: [
{arg: 'id', type: 'number', required: true},
],
returns: { type: 'array', root: true }
}
)
}

Hypen in response data is throwing error when setting as global variable for nested response

I have a post man request. Which returns a response data as:
[
{
"id": "7ca27c09-2b67-417e-b367-f97d49824a2f",
"tags": [],
"type": "ApplicationProfile",
"userId": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"profile": {
"User-Profile": {
"PHI": {
"gender": "Male",
"surgeryDate": {
"value": "2017-06-06"
},
"surgeryType": {
"value": "gastricBand"
},
"heightInches": "72",
"approvalPhase": "2",
"profileImageUrl": "",
"motivationalImageUrl": ""
},
"PII": {
"mail": "c11#c111.com",
"lastName": "",
"firstName": "name1",
"shouldReceiveNotifications": true
}
},
"motivationalGoals": [
{
"goal": "Improving health",
"goalId": "2957"
},
{
"goal": "Relieving pain",
"goalId": "2958"
},
{
"goal": "Feeling better",
"goalId": "2960"
}
]
},
"version": 35,
"createdBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"lastModifiedBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"applicationName": "Health Partner",
"createdDateTime": "2017-06-08T16:08:32.497Z",
"lastModifiedDateTime": "2017-06-09T13:23:03.503Z"
},
{
"id": "091b5ebd-b096-436e-a703-f97f0ae77baf",
"tags": [
"Application-Profile"
],
"type": "ApplicationProfile",
"userId": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"profile": {
"User-Profile": {
"PHI": {
"gender": "",
"surgeryDate": {
"value": "2017-06-01"
},
"surgeryType": {
"value": ""
},
"heightInches": "72",
"approvalPhase": "2",
"profileImageUrl": "",
"motivationalImageUrl": ""
},
"PII": {
"mail": "c11#c111.com",
"lastName": "Dev",
"firstName": "Kat",
"shouldReceiveNotifications": true
}
},
"motivationalGoals": [
{
"goal": "Improving health",
"goalId": "2957"
},
{
"goal": "Relieving pain",
"goalId": "2958"
},
{
"goal": "Feeling better",
"goalId": "2960"
}
]
},
"version": 41,
"createdBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"lastModifiedBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"applicationName": "Health Partner Weightloss",
"createdDateTime": "2017-06-03T16:19:57.811Z",
"lastModifiedDateTime": "2017-06-08T16:07:49.555Z"
}
]
I need to extract the value of the emailid and set as global variable.
here is my code:
var jsonData1 = JSON.parse(responseBody);
postman.setGlobalVariable("jsonData1",jsonData1.profile.User-Profile.PII.mail);
But I am getting error. "User is undefined".
The problem here is that the hyphen / minus sign is interpreted as the subtraction operator.
Consider changing your API and using "userProfile" instead of "User-Profile".

AWS CLI create cloudfront distribution: --distribution-config

Trying a cloudfront distribution using the AWS CLI, one needs an argument --distribution-config
aws cloudfront create-distribution
aws: error: argument --distribution-config is required
I assume this is a json string with the configuration for the distribution, but I cannot find any documentation about it.
Where can I find a minimal working example?
The following JSON worked for me. I used get-distribution-config to generate it.
{
"Comment": "example json",
"CacheBehaviors": {
"Quantity": 0
},
"Logging": {
"Bucket": null,
"Prefix": null,
"Enabled": false,
"IncludeCookies": false
},
"Origins": {
"Items": [
{
"S3OriginConfig": {
"OriginAccessIdentity": null
},
"Id": "S3-origin",
"DomainName": "example.s3.amazonaws.com"
}
],
"Quantity": 1
},
"DefaultRootObject": null,
"PriceClass": "PriceClass_All",
"Enabled": false,
"DefaultCacheBehavior": {
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"TargetOriginId": "S3-origin",
"ViewerProtocolPolicy": "allow-all",
"ForwardedValues": {
"Headers": {
"Quantity": 0
},
"Cookies": {
"Forward": "none"
},
"QueryString": false
},
"SmoothStreaming": false,
"AllowedMethods": {
"Items": [
"GET",
"HEAD"
],
"Quantity": 2
},
"MinTTL": 0
},
"CallerReference": "example",
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true
},
"CustomErrorResponses": {
"Quantity": 0
},
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Quantity": 0
}
},
"Aliases": {
"Quantity": 0
}
}
As stated in the documentation you could try to run this command:
aws cloudfront create-distribution --distribution-config file://distconfig.json
The file distconfig.json is a JSON document in the current folder that defines a CloudFront distribution:
distconfig.json
{
"CallerReference": "my-distribution-2015-09-01",
"Aliases": {
"Quantity": 0
},
"DefaultRootObject": "index.html",
"Origins": {
"Quantity": 1,
"Items": [
{
"Id": "my-origin",
"DomainName": "my-bucket.s3.amazonaws.com",
"S3OriginConfig": {
"OriginAccessIdentity": ""
}
}
]
},
"DefaultCacheBehavior": {
"TargetOriginId": "my-origin",
"ForwardedValues": {
"QueryString": true,
"Cookies": {
"Forward": "none"
}
},
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"ViewerProtocolPolicy": "allow-all",
"MinTTL": 3600
},
"CacheBehaviors": {
"Quantity": 0
},
"Comment": "",
"Logging": {
"Enabled": false,
"IncludeCookies": true,
"Bucket": "",
"Prefix": ""
},
"PriceClass": "PriceClass_All",
"Enabled": true
}
If you follow the link I provided, you will have more information about the output this command will give you.