UNPKG

braintree

Version:

A library for integrating with Braintree.

99 lines (82 loc) 2.59 kB
//@ sourceMappingURL=transaction.map // Generated by CoffeeScript 1.6.1 var AttributeSetter, CreditCard, DisbursementDetails, Transaction, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; AttributeSetter = require('./attribute_setter').AttributeSetter; CreditCard = require('./credit_card').CreditCard; DisbursementDetails = require('./disbursement_details').DisbursementDetails; Transaction = (function(_super) { __extends(Transaction, _super); Transaction.CreatedUsing = { FullInformation: 'full_information', Token: 'token' }; Transaction.EscrowStatus = { HoldPending: 'hold_pending', Held: 'held', ReleasePending: 'release_pending', Released: 'released', Refunded: 'refunded' }; Transaction.Source = { Api: 'api', ControlPanel: 'control_panel', Recurring: 'recurring' }; Transaction.Type = { Credit: 'credit', Sale: 'sale', All: function() { var all, key, value; all = []; for (key in this) { value = this[key]; if (key !== 'All') { all.push(value); } } return all; } }; Transaction.GatewayRejectionReason = { Avs: 'avs', Cvv: 'cvv', AvsAndCvv: 'avs_and_cvv', Duplicate: 'duplicate', Fraud: 'fraud' }; Transaction.Status = { AuthorizationExpired: 'authorization_expired', Authorizing: 'authorizing', Authorized: 'authorized', GatewayRejected: 'gateway_rejected', Failed: 'failed', ProcessorDeclined: 'processor_declined', Settled: 'settled', Settling: 'settling', SubmittedForSettlement: 'submitted_for_settlement', Voided: 'voided', All: function() { var all, key, value; all = []; for (key in this) { value = this[key]; if (key !== 'All') { all.push(value); } } return all; } }; function Transaction(attributes) { Transaction.__super__.constructor.call(this, attributes); this.creditCard = new CreditCard(attributes.creditCard); this.disbursementDetails = new DisbursementDetails(attributes.disbursementDetails); } Transaction.prototype.isDisbursed = function() { return this.disbursementDetails.isValid(); }; return Transaction; })(AttributeSetter); exports.Transaction = Transaction;