Thursday, 30 July 2015

Braintree Marketplace - Split payment between website owner and seller


Braintree Marketplace - Split payment between website owner and seller


Question: What is Braintree Marketplace?
Braintree Marketplace is platform where it enables you to split payments from customers between your marketplace and your sellers or providers.


Question: Is split payments free in Braintree Marketplace?
Yes, Braintree does not charge extra for split payment.


Question: What is Transaction cost?
2.9% + $0.30 per transaction.


Question: Is there any monthly fees?
No, There is no monthly fees. Also there is no hidden cost.


Question: In which country market place is available?
Currently Its available in USA only.


Question: What Compatibility should be for Marketplace?
Merchant accounts need to be approved by Braintree for use with Marketplace.
Master merchant and sub-merchants must be domiciled in the US and receive funding in USD.


Question: What are useful terminology for Marketplace?
Master merchant: The Marketplace owner
Sub-merchant: Sellers who will receive money along with marketplace owner.
Service fee: Amount getting by sellers.
Escrow: An option that allows you to hold funds through our banking partner until you decide to disburse them; at disbursement.
Webhooks: Notifications sent to your server that indicate whether a merchant was successfully onboarded OR there was a problem disbursing funds.


Question: What information do I need to get from Seller OR Sub-merchant?
You need to get the billing/account information along with basic details.
Following are information which you need to pass in API to create sub-merchant on the behalf of main merchant.
$result = Braintree_MerchantAccount::create(
  [
    '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 Ladders',
      'dbaName' => 'Jane Ladders',
      'taxId' => '98-7654321',
      'address' => [
        'streetAddress' => '111 Main St',
        'locality' => 'Chicago',
        'region' => 'IL',
        'postalCode' => '60622'
      ]
    ],
    'funding' => [
      'descriptor' => 'Blue Ladders',
      'destination' => Braintree_MerchantAccount::FUNDING_DESTINATION_BANK,
      'email' => 'funding@blueladders.com',
      'mobilePhone' => '5555555555',
      'accountNumber' => '1123581321',
      'routingNumber' => '071101307'
    ],
    'tosAccepted' => true,
    'masterMerchantAccountId' => "master_merchant_account_id",
    'id' => "blue_ladders_store"
  ]
);

Response of above code:
Braintree_Result_Successful Object
(
    [success] => 1
    [_returnObjectNames:Braintree_Result_Successful:private] => Array
        (
            [0] => merchantAccount
        )

    [_attributes] => Array
        (
        )

    [merchantAccount] => Braintree_MerchantAccount Object
        (
            [_attributes] => Array
                (
                    [status] => pending
                    [id] => arun_kumar
                    [masterMerchantAccount] => Braintree_MerchantAccount Object
                        (
                            [_attributes] => Array
                                (
                                    [status] => active
                                    [id] => zz62xd782mdfhrzb
                                    [currencyIsoCode] => USD
                                    [subMerchantAccount] => 
                                )

                        )

                    [currencyIsoCode] => USD
                    [subMerchantAccount] => 1
                )

        )

)



Question: How to send money to sub-merchant when customer pay?
$result = Braintree_Transaction::sale([
    'merchantAccountId' => 'submerchant_account_id',
    'amount' => '10.00',
    'paymentMethodNonce' => nonceFromTheClient,
    'serviceFeeAmount' => "1.00" //this amt will be transfered to main merchnat 
]);



Question: What is maximum limit for transaction?
Its more than $80K monthly. But if you are doing much more transaction, you need to contact braintree.


Question: What is Chargeback?
Customer paid for the item and money is deduct from his bank.
After some time customer disputes a transaction to get deducted money, because he get issue is delivered product or becuase of any issue  know as chargeback.



Friday, 17 July 2015

Jquery Interview Questions and Answers for experienced

jquery interview questions and answers for experienced
Question: What is jQuery?
jQuery is a fast, small and feature-rich JavaScript library.
jQuery makes things like HTML document traversal and manipulation, animationevent handling and Ajax much simpler with an easy-to-use API.
It works across a multitude of browsers.


Question: What is Ajax?
Ajax( Short form of Asynchronous JavaScript and XML) is a Web development techniques used on the client-side to create Synchronous OR asynchronous Web applications. It is used to get the data from server without refresh the page.


Question: What is Iframe?
Iframe is an HTML document embedded inside another HTML document on a website. We can embed one OR many iframe in one website.


Question: What is element in HTML?
An HTML element is an individual component of an HTML document or web page.
For example, p,div,span etc know as element.
when these surrounded by angle brackets know as HTML Tags.


Question: What is event in jQuery? Doing any thing, known as event.
For Example, Click event, mouseover event, blur event, double click event etc.


Question: What is jQuery event?
A jQuery object is array-like which means that it contains zero or more indexes.


Question: How to parse a JSON String?
var obj = jQuery.parseJSON( '{ "name": "John" }' );
console.log( obj.name);



Question: How to communicate between iframe and the parent site?
With same domain and same port/protocol
you can use window.opener to change in parent window from child window.
you can use document.getElemetById('#iframeId') to change in child window from parent window.
With different domain OR different port/protocol
You have to use cross-document messaging.

Question: How can I select an element by name or class or id with jQuery?
Select by name
console.log($('div[name=divname]'));

Select by class name
console.log($('div.className'));

Select by classId
console.log($('div#classId'));



Question: How to show the preview an image before it is uploaded to server?
To show the preview you need to use "FileReader" javascript function.
See Demo:http://jsfiddle.net/LvsYc/


Question: How to get html tags from string?
var re = /(<([^>]+)>)/ig; 
    var str = '

Hello!

'; var m; while ((m = re.exec(str)) !== null) { if (m.index === re.lastIndex) { re.lastIndex++; } } console.log(re);



Question: What is use $.each? Give examples?
It is similar to foreach in jQuery.
you can use $.each for normal array OR list of elements. For Example:
$('a.myclass').each(function(index, value){
      console.log($(this).attr('href'));
});

var numberArray = [0,1,2,3,4,5];
jQuery.each(numberArray , function(index, value){
     console.log(index + ':' + value); 
});



Question: What's the difference between jquery.js and jquery.min.js?
Both are same.
only difference jquery.min.js is minified file which have no space, tab.

Question: How to add Email Validation in jQuery?
function IsValidEmail(email) {
  var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  return regex.test(email);
}
console.log(IsValidEmail('myvalidemail@domain.com'));
console.log(IsValidEmail('myInvalidemail@'));
console.log(IsValidEmail('myInvalidemail#domain.com'));



Question: How to get nth jQuery element?
use eq function.
console.log($("div.myclass:eq(2)")); 



Question: How to remove a row from table?
$('tr#myTableRowId').remove();
OR
$('tr.myTableRowClass').remove();


Question:How to bind shortcut-keys with jQuery?
To bind Ctrl+f to a functionName.
$(document).bind('keydown', 'ctrl+f', functionName);

You can check also: http://github.com/jeresig/jquery.hotkeys


Question: How to convert array to JSON?
You can use stringify.
var yourArray = Array('1','2','3','4');
var myJsonString = JSON.stringify(yourArray);



Question: How to check if a div exists with jquery?
if($("div#idName" + name).length > 0) {
  /** It is exist **/
}



Question: How to call a function after 3 seconds?
setTimeout(
  function(){
/** Do here **/

/** Do here **/    
  }, 3000);
}



Question: How to prevent caching in Ajax?
After loading of jQuery, add the below code at the top of all ajax call.
$.ajaxSetup({ cache: false });