Paypal express button line items not showing up - reactjs

I'm using the new 2019 paypal sdk with React and I'm trying to create an order with 2 line items. When I create an order, I'm able to get the correct total inside paypal and complete a transaction, but on the test users receipt, it just shows the total for 25.99 and no line items. I'm following v2 of their api instructions but no items are showing up.
purchase_units: [{
amount: {
currency_code: 'USD',
value: '25.99',
breakdown: {
item_total: { value: '25.99', currency_code: 'USD' }
}
}
}],
items: [
{
name: 'Watercolor texture kit Vol. 1',
unit_amount: {
value: '16.00',
currency_code: 'USD'
},
quantity: '1',
description: 'test desc',
sku: '222'
},
{
name: 'Skinny jeans',
unit_amount: {
currency_code: 'USD',
value: '9.99'
},
quantity: '1',
description: 'test desc',
sku: '30'
}
],

I know this is old, I had a similar problem. I think the items need to be inside the purchase_units. I also found to work that I need to include the descriptors in quotes - the API docs don't specify this though.

This is what I'm using to make it work:
<script id='paypal-js' src={`https://www.paypal.com/sdk/js?client-id=${PaypalKey}&disable-funding=credit,card&commit=true&merchant-id=${PaypalMerchantId}&locale=en_US&integration-date=2019-11-07`}/>
Integration date makes paypal use different versions of the api depending on the date.
purchase_units: [{
amount: {
currency_code: currency,
value: cart.totalPrice,
breakdown: {
item_total: {
value: cart.totalPrice,
currency_code: currency
}
}
},
invoice_id: Math.random().toString(36).substring(14),
items: getPaypalFormatItems(cart, products),
soft_descriptor: 'Digital Purchase', // appears on CC statement
description: 'Paypal payment'
}],
application_context: {
brand_name: 'Every-Tuesday',
shipping_preference: 'NO_SHIPPING',
user_action: 'PAY_NOW'
}

Related

Column not showing data using Gridjs while integrating with React js

currently I am using Gridjs to display my table in my Reactjs application.
This is the code, the Name, and Email is displaying correctly, but the created_at is not, giving me empty. How can I display the data? thank you..
You need to define a custom id for your column if you're using a JSON input.
Example:
const grid = new Grid({
columns: [{
id: 'name',
name: 'Name'
}, {
id: 'email',
name: 'Email'
}, {
id: 'phoneNumber',
name: 'Phone Number'
}],
data: [
{ name: 'John', email: 'john#example.com', phoneNumber: '(353) 01 222 3333' },
{ name: 'Mark', email: 'mark#gmail.com', phoneNumber: '(01) 22 888 4444' },
]
});
See https://gridjs.io/docs/examples/import-json/

Performance and scalability to have one data structure or splitting data structures in MongoDB

Is there a performance difference if you have an array within a data set (tags) like this:
images cluster:
{
_id: 'imageID1',
title: 'some title name',
tags: ['cool', 'banana', 'animal']
},
{
_id: 'imageID2',
title: 'some other title name',
tags: ['funny', 'creative', 'animal']
}
vs separating the array into different clusters? (I'm using mongodb as my database)
images cluster:
{
_id: 'imageID1',
title: 'some title name',
tagsId: 'imageID1tags'
},
{
_id: 'imageID2',
title: 'some other title name',
tagsId: 'imageID2tags'
}
Tags cluster:
{
_id: '1',
imagesId: 'imageID1',
tag: 'cool'
},
{
_id: '2',
imagesId: 'imageID1',
tag: 'banana'
},
{
_id: '3',
imagesId: 'imageID1',
tag: 'animal'
},
{
_id: '4',
imagesId: 'imageID2',
tag: 'funny'
},
{
_id: '5',
imagesId: 'imageID2',
tag: 'creative'
},
{
_id: '6',
imagesId: 'imageID2',
tag: 'animal'
},
Just side note: You can see (for example purposees), I have 2 animal data, where 1 of them belongs to imageID1 and another imageID2. This cluster will have endless amounts of tags, where it can be duplicate names, unique to its imagesId.
So does it make sense to just simplify it (for scalability and performance considerations) and have it within the images cluster (just 1 data cluster), or spread it out (having 2 data clusters)? I want to eventually do a search on the tags, and then the images associated to the search tag will populate.
So if user searches animal, both of the images will show up.

What schema structure to use for this app?

I want to create an expense tracking app but don't know how to make my schema structure.
The layout:
The schema:
module.exports = {
expenseList: [
{
uid: 'some-uid1',
createdAt: 'some-date1',
expenseItems: [
{
date: 'date11',
desc: 'desc11',
amount: 'amount11'
},
{
date: 'date11',
desc: 'desc11',
amount: 'amount11'
}]
},
{
uid: 'some-uid',
createdAt: 'some-date',
expenseItems: [
{
date: 'date1',
desc: 'desc1',
amount: 'amount1'
},
{
date: 'date1',
desc: 'desc1',
amount: 'amount1'
},
{
date: 'date1',
desc: 'desc1',
amount: 'amount1'
}]
}
]
};
How do I change my schema so I can loop through expenses and display createdAt property as a clickable link that redirects to that expense items?
When do I use Arrays and when do I use Objects in my schema?
Where do I need uid (unique ids)?
I will use firebase for this app
You have an expenseList with a date and expenseItems associated with it. You can have a schema roughly like this. expenseList will be an array of objects. Each expenseList is an object containing uid (to uniquely identify the list), createdAt and array of expenseItems with its own set of properties.
expenseList: [{
uid: 'some-uid',
createdAt: 'some-date',
expenseItems: [
{
date: 'date1',
desc: 'desc1',
amount: 'amount1'
},
{
date: 'date1',
desc: 'desc1',
amount: 'amount1'
}
]
}]
You can iterate over this expenseList to display createdAt in your first screen. On clicking of that, depending on the unique id of that expenseList, fetch the expenseList and display the expenseItems on the second screen.
I have not used firebase before, so you might have to tweak the schema a little.

Empty element in Angular ng-options (with and without grouping)

I have (a seemingly common) problem with empty option values an angular model viewed using a select using ng-options.
$scope.groupTypeOptions = [
{ group: 'g1', name: '---', value: null },
{ group: 'g2', name: 'Feature', value: 'feature' },
{ group: 'g2', name: 'Bug', value: 'bug' },
{ group: 'g2', name: 'Enhancement', value: 'enhancement' }
];
<select ng-model='form.groupType' required ng-options='option.value as option.name group by option.group for option in groupTypeOptions'></select>
A fiddle can be seen here:
http://jsfiddle.net/v6z3zh49/
My goal is to, from a predefined model, show a grouped select with the selected item representing null (or empty string). However, when selecting a value and I always end up with an extra, empty, option element being added. See fiddle above.
I have looked at similar questions, for example here and here, but cannot find a solution.
Any tips?
Try:
$scope.groupTypeOptions = [
{ group: 'g1', name: '---', value: undefined },
{ group: 'g2', name: 'Feature', value: 'feature' },
{ group: 'g2', name: 'Bug', value: 'bug' },
{ group: 'g2', name: 'Enhancement', value: 'enhancement' }
];
It happens because in javascript null !== undefined.
Hope, it will help.
Demo: http://jsfiddle.net/ababashka/skk4uj1y/

Generating a dialog box with CheckBoxes when a Checkbox is selected in ExtJs

I am novice to Ext-js and referring sencha.com for tutorials. I am trying to modify an existing application build in ext-js 2.2. It has in particular page following options for checkbox.
var assetPermissions = [
{ id: 'MF', name: 'Mutual Funds' },
{ id: 'ETF', name: 'ETFs' },
{ id: 'CE', name: 'Closed End Funds' },
{ id: 'ST', name: 'Stocks' },
{ id: 'VA', name: 'Variable Annuities' },
{ id: 'FI', name: 'Bonds' },
{ id: 'SMA', name: 'Separately Managed Accounts' },
{ id: 'MO', name: 'Models' },
{ id: 'MM', name: 'Managed Models' },
{ id: 'UD', name: 'User Defined' },
{ id: 'I:MD', name: 'Model Dashboard' },
{ id: 'I:SC', name: 'Screener' },
{ id: 'CUAS', name: 'Create Custom Assets & Folders' },
{ id: 'OA', name: 'Other Assets'}
];
Now I want that when a user selects the Other Assets option in the check box and another check box should be prompted something like this.
Name Select
ABC
XYZ 
Save | Cancel
I also want a Save and Cancel button for that dialog box and changes made to it are saved.
So can any one suggest how to do this in ExtJs. Thanks.

Resources