I want to test the Braintree Marketplace API in the sandbox mode. I have already created the sandbox account and using the node.js SDK.
I am referring the docs from here : https://developers.braintreepayments.com/guides/marketplace/onboarding/node
Below is my Node code :
app.get('/', function(req, res) {
merchantAccountParams = {
individual: {
firstName: "Jane",
lastName: "Doe",
email: "jane#14ladders.com",
phone: "5553334444",
dateOfBirth: "1981-11-19",
ssn: "456-45-4567",
address: {
streetAddress: "111 Main St",
locality: "Chicago",
region: "IL",
postalCode: "60622"
}
},
business: {
legalName: "Jane's Ladders",
dbaName: "Jane's Ladders",
taxId: "98-7654321",
address: {
streetAddress: "111 Main St",
locality: "Chicago",
region: "IL",
postalCode: "60622"
}
},
funding: {
descriptor: "Blue Ladders",
//destination: MerchantAccount.FundingDestination.Bank,
destination:"Demo Bank",
email: "funding#blueladders.com",
mobilePhone: "5555555555",
accountNumber: "1123581321",
routingNumber: "071101307"
},
tosAccepted: true,
masterMerchantAccountId: "14ladders_marketplace",
id: "blue_ladders_store"
};
gateway.merchantAccount.create(merchantAccountParams, function (err, result) {
res.send(result.success);
});
});
The above code always return false.I am wondering that can we even test this with the sandbox or not? or am i missing something ?
Anyone face this issue before please help.
Thank you.
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
The destination parameter is not looking for the name of a bank, it is looking for a literal string that indicates if the account should be funded using a bank, email, or mobile_phone. You can use these strings directly, but we suggest you use the constant references, because it makes the code cleaner and protects against future changes.
You can read more about the details of the different funding destination types in our guide and reference.
Related
I am building Graphql api with Strapi. It's a simple application which user can signup and save some of his/her information. I have two tables for that, User [Which is Strapi provided] and Profile which i use to store user additional information. The two tables has relationship
User [User has and belongs to one Profile]
Profile Profile has and belongs to one User and contact component structure.
I want to be able to fetch the current logged in user and it's information from Profile table, but the Contact field which i save as component type return null.
Here is what i am doing so far
extensions/user-permission/config/schema.graphql.js
module.exports = {
definition: `
extend type UsersPermissionsMe {
profile: ProfileMe
}
type ProfileMe {
id: ID!
website: String!
description: String!
contact: ContactMe
}
type ContactMe {
id: ID!
name: String!
phone: String!
email: String!
}
`
}
extensions/user-permission/services/User.js
'use strict';
module.exports = {
fetchAuthenticatedUser(id) {
return strapi.query('user', 'users-permissions').findOne({ id }, ['role', 'profile']);
},
};
And when run GraphQl Query
query {
me {
username
email
profile {
website
description
contact {
name
phone
email
}
}
}
}
it returned
{
"data": {
"me": {
"username": "company",
"email": "company#test.com",
"profile": {
"website": "http://localhost.com",
"description": "lorem text",
"contact": null
}
}
}
}
I want to also get contact data here. I hope someone on Internet can help me.
please help, thanks you.
im trying to turn on 3D Secure in my brain tree drop in initialisation but its failing inside the paymentRequestMethod as the payload never returns a liabilityShifted property;
braintree.dropin.create({
authorization: button.attr("data-client-token"),
container: "#dropin-container",
threeDSecure: {
amount: Number(document.querySelector('[data-chargeable]')).toFixed(2),
}
}, function( createErr, instance ) {
button.on("click", function() {
instance.requestPaymentMethod(function(requestPaymentMethodErr, payload) {
console.log(payload);
nonce = null;
if(requestPaymentMethodErr) {
return;
}
if (payload.liabilityShifted || payload.type !== 'CreditCard') {
nonce = payload.nonce;
button.hide();
payButton.show();
} else {
button.hide();
instance.clearSelectedPaymentMethod();
}
});
});
});
No matter what card I use from the selection the liability shifted is not in the payload and the type is always credit card;
{
binData: {
commercial: "Unknown",
countryOfIssuance: "Unknown",
debit: "Unknown",
durbinRegulated: "Unknown",
healthcare: "Unknown",
issuingBank: "Unknown",
payroll: "Unknown",
prepaid: "Unknown",
productId: "Unknown",
},
description: "ending in 11",
details: {
bin: "411111",
lastTwo: "11",
lastFour: "1111",
cardType: "Visa"
},
nonce: "tokencc_bf_95mrgx_75kwgh_d3qbzb_qy9vq3_b27",
type: "CreditCard"
}
Can anyone advise what I am doing wrong.
Regards
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
liabilityShifted indicates that 3D Secure worked and authentication succeeded. You will also want to ensure that you are using the 3D Secure test cards to result in the expected 3D Secure response. To get the liabilityShifted response in the payload, you will instead need to use the verifyPayload object.
I am trying to implement authentication built on Cognito using their Go SDK. I have been able to get basic username/password authentication to work, but when I add in 2-factor authentication using SMS I am getting stuck.
Steps to reproduce :
I create the user with a username/password and email verification
I validate the email address
I set the phone number and request a verification code
I verify the phone number
I enable 2-factor authentication (via SMS)
I try to sign in and receive the SMS_MFA challenge
I receive the code on my phone and call AdminRespondToAuthChallenge
Problem, I receive an error :
CodeMismatchException: Invalid code or auth state for the user.
status code: 400, request id: 1513894e-8efa-11e8-a8f8-97e5e083c03b
The SMS verification code is certainly correct, so it seems that it must be something to do with the auth state.
The calls to Cognito look like this:
c.cip.SignUp(&cognitoidentityprovider.SignUpInput{
ClientId: aws.String(c.clientID),
Username: aws.String(username),
Password: aws.String(password),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("email"),
Value: aws.String(email),
},
{
Name: aws.String("name"),
Value: aws.String(fullName),
},
},
})
c.cip.ConfirmSignUp(&cognitoidentityprovider.ConfirmSignUpInput{
ClientId: aws.String(c.clientID),
Username: aws.String(username),
ConfirmationCode: aws.String(code),
})
//Add the phone number
c.cip.AdminUpdateUserAttributes(&cognitoidentityprovider.AdminUpdateUserAttributesInput{
UserPoolId: aws.String(c.userPoolID),
Username: aws.String(username),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{
Name: aws.String("phone_number"),
Value: aws.String(phoneNumber),
},
},
})
//Request a verification code
c.cip.GetUserAttributeVerificationCode(&cognitoidentityprovider.GetUserAttributeVerificationCodeInput{
AccessToken: aws.String(accessToken),
AttributeName: aws.String("phone_number"),
})
//Verify the phone number
c.cip.VerifyUserAttribute(&cognitoidentityprovider.VerifyUserAttributeInput{
AccessToken: aws.String(accessToken),
AttributeName: aws.String("phone_number"),
Code: aws.String(code),
})
//Enable SMS 2-factor auth c.cip.AdminSetUserSettings(&cognitoidentityprovider.AdminSetUserSettingsInput{
UserPoolId: aws.String(c.userPoolID),
Username: aws.String(username),
MFAOptions: []*cognitoidentityprovider.MFAOptionType{
&cognitoidentityprovider.MFAOptionType{
AttributeName: aws.String("phone_number"),
DeliveryMedium: aws.String("SMS"),
},
},
})
c.cip.AdminInitiateAuth(&cognitoidentityprovider.AdminInitiateAuthInput{
ClientId: aws.String(c.clientID),
UserPoolId: aws.String(c.userPoolID),
AuthFlow: aws.String("ADMIN_NO_SRP_AUTH"),
AuthParameters: map[string]*string{
"USERNAME": aws.String(username),
"PASSWORD": aws.String(password),
},
})
c.cip.AdminRespondToAuthChallenge(&cognitoidentityprovider.AdminRespondToAuthChallengeInput{
ClientId: aws.String(c.clientID),
UserPoolId: aws.String(c.userPoolID),
ChallengeName: aws.String("SMS_MFA"),
Session: aws.String(session),
ChallengeResponses: map[string]*string{
"USERNAME": aws.String(username),
"SMS_MFA_CODE": aws.String(code),
},
})
Doing a GetUser call shows the current state of the user:
User = {
Enabled: true,
MFAOptions: [{
AttributeName: "phone_number",
DeliveryMedium: "SMS"
}],
PreferredMfaSetting: "SMS_MFA",
UserAttributes: [
{
Name: "sub",
Value: "bd2bb8bc-dfe6-4216-829c-5ae975ce24e5"
},
{
Name: "email_verified",
Value: "true"
},
{
Name: "name",
Value: "Ben Vogan"
},
{
Name: "phone_number_verified",
Value: "true"
},
{
Name: "phone_number",
Value: "<redacted>"
},
{
Name: "email",
Value: "<redacted>"
}
],
UserCreateDate: 2018-07-24 03:29:49 +0000 UTC,
UserLastModifiedDate: 2018-07-24 04:19:51 +0000 UTC,
UserMFASettingList: ["SMS_MFA"],
UserStatus: "CONFIRMED",
Username: "bd2bb8bc-dfe6-4216-829c-5ae975ce24e5"
}
I do not know if there is a way to query the user's auth state so that I can verify that.
The AWS documentation and unhelpful errors are driving me insane so any help would be greatly appreciated!
Thanks.
Your questions seems ambiguous.
step 2 you are
I set the phone number and request a verification code
I verify the phone number
this is nothing but MFA in Cognito. if you have configured the pool correctly.
You cannot have both phone for login and MFA. that doesn't make sense.
but if you have phone for login, then Cognito will send SMS every time with code. password is only for email logins.
i need to know if there is a possibility to know what kind of device are u useing for the facebook mess , im using the microsoftchatbot , and i need to know if the user is using a pc/laptop or a mobile device
i have tryed looking at the session data and i cannot see the device
{ type: 'conversationUpdate',
timestamp: '2017-10-11T09:12:54.8111475Z',
membersAdded: [ { id: 'EmpHard#qQ09zeUT83I', name: 'EMPP' } ],
text: '',
attachments: [],
entities: [],
address:
{ id: 'DC7cCyV4Pn4',
channelId: 'webchat',
user: { id: 'edb347769a4ba0863dd0e8b44d93358d' },
conversation: { id: 'edb347760e8ba0863ddb49a44d93358d' },
bot: { id: 'EmpHard#qQ09zeUT83I', name: 'EMPP' },
serviceUrl: 'https://webchat.botframework.com/' },
source: 'webchat',
agent: 'botbuilder',
user: { id: 'db34776e0e8b49a4ba0863dd4d93358d' } }
The device information is not included in the message data. Facebook messenger doesn't differentiate between mobile devices and desktops.
I'm new to Firebase and I'm building my first app on it so thought I'd ask if my current plans for the app's data structure make sense.
I've read the Firebase blog posts and several answers on SO which have helped me understand the concept of "optimise for the way the data will be read". However, my data will be read in a few different ways and it feels like I may be over complicating things.
Background
The app is like a directory for businesses in multiple towns (schemes) to promote their upcoming events and offers. I think of the data hierarchy like this:
Scheme: A town (the app has multiple schemes)
Category: A group of businesses around a theme (e.g. shoe shops)
Business: An administrative organisation (handles billing etc). Each business can have multiple locations (shops in different towns).
Location: A shop in a town.
Event: Each location can promote events. An event can be promoted at multiple locations but not necessarily all of a business's locations.
Offer: Similar to an event but a different type of object.
Viewing the data
The app user can view the offer & event data in 5 ways:
specific to a business (e.g. Joe's shoes' offers)
for a scheme (e.g. all offers in a Smalltown)
for the whole app (e.g. all offers anywhere)
in a category in a scheme (e.g. all shoe offers in Smalltown)
in a category in the whole app (e.g. all shoe offers anywhere)
In addition, I need to make sure that an administrator from each business can see/edit all of their business's data via a CMS I'm also building.
My approach
This is the data structure I'm thinking of using:
root {
schemes{
scheme1{
name: "smalltown",
logo: "base64 data",
bgcolor: "#FF0000"
},
scheme2{...}
},
businesses{
business1{
name: "Joe's Shoes",
logo: "base64 data",
locations: {
location1: true,
location3: true,
location15: true
},
address_hq: {
street: "45 Acacia Avenue",
town: "Bigtown",
postcode: "BT1 1JS"
},
contact_hq: {
name: "Joe Simpson",
position: "Owner",
email: "joe#joesshoes.com",
tel: "07123 456789"
},
subscription: {
plan: "Standard",
date_start: "10/10/2015",
date_renewal: "10/10/2016"
},
owner: "james1"
},
business2{...}
},
locations{
location1{
name: "Joe's Shoes",
logo: "base64 data",
scheme: "scheme1",
events: {
event1: true,
event27: true
},
offers: {
offer1: true,
offer6: true
},
business: "business1",
owner: "james1"
},
location2{...}
},
events{
event1{
schemes: {
scheme1: true,
scheme4: true
},
locations{
location1: true,
location21: true
},
categories: {
shoes: true,
footwear: true,
fashion: true
},
business: "business1",
date: "5/5/2016",
title: "The History of Shoes",
description: "A fascinating talk about the way shoes have...",
image: "base64 data",
venue: {
street: "Great Hotel",
town: "Bigtown",
postcode: "BT1 1JS"
},
price: "£10"
},
event2{...}
},
offers{
offer1{
schemes: {
scheme1: true,
scheme4: true
},
locations{
location1: true,
location21: true
},
categories: {
shoes: true,
footwear: true,
fashion: true
},
business: "business1",
date_start: "5/5/2016",
date_end: "5/5/2016",
title: "All children's shoes Half Price",
description: "Get 50% off all children's shoes - just in time for the summer",
image: "base64 data",
},
offer2{...}
}
}
Here's a graphic of similar data structure in case it's easier to read:
My question is whether I need to denormalise the data further (repeat more data in more places) or is there a better way to think about this altogether?
It feels like I'm getting potential complications from having to keep data in sync without the ability to simply read from a single place (e.g. I'll need to use queries and indexes (?) to combine location and event data for scheme-wide event listings).
Any advice on making this data structure more efficient would be great.