braintree
Version:
A library for integrating with Braintree.
77 lines (62 loc) • 3.22 kB
JavaScript
//@ sourceMappingURL=webhook_notification.map
// Generated by CoffeeScript 1.6.1
var AttributeSetter, Disbursement, MerchantAccount, PartnerMerchant, Subscription, Transaction, ValidationErrorsCollection, WebhookNotification,
__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;
MerchantAccount = require('./merchant_account').MerchantAccount;
Transaction = require('./transaction').Transaction;
Disbursement = require('./disbursement').Disbursement;
PartnerMerchant = require('./partner_merchant').PartnerMerchant;
Subscription = require('./subscription').Subscription;
ValidationErrorsCollection = require('./validation_errors_collection').ValidationErrorsCollection;
WebhookNotification = (function(_super) {
__extends(WebhookNotification, _super);
WebhookNotification.Kind = {
Disbursement: "disbursement",
DisbursementException: "disbursement_exception",
PartnerMerchantConnected: "partner_merchant_connected",
PartnerMerchantDisconnected: "partner_merchant_disconnected",
PartnerMerchantDeclined: "partner_merchant_declined",
SubscriptionCanceled: "subscription_canceled",
SubscriptionChargedSuccessfully: "subscription_charged_successfully",
SubscriptionChargedUnsuccessfully: "subscription_charged_unsuccessfully",
SubscriptionExpired: "subscription_expired",
SubscriptionTrialEnded: "subscription_trial_ended",
SubscriptionWentActive: "subscription_went_active",
SubscriptionWentPastDue: "subscription_went_past_due",
SubMerchantAccountApproved: "sub_merchant_account_approved",
SubMerchantAccountDeclined: "sub_merchant_account_declined",
TransactionDisbursed: "transaction_disbursed"
};
function WebhookNotification(attributes) {
var wrapper_node;
WebhookNotification.__super__.constructor.call(this, attributes);
if (attributes.subject.apiErrorResponse != null) {
wrapper_node = attributes.subject.apiErrorResponse;
} else {
wrapper_node = attributes.subject;
}
if (wrapper_node.subscription != null) {
this.subscription = new Subscription(wrapper_node.subscription);
}
if (wrapper_node.merchantAccount != null) {
this.merchantAccount = new MerchantAccount(wrapper_node.merchantAccount);
}
if (wrapper_node.disbursement != null) {
this.disbursement = new Disbursement(wrapper_node.disbursement);
}
if (wrapper_node.transaction != null) {
this.transaction = new Transaction(wrapper_node.transaction);
}
if (wrapper_node.partnerMerchant != null) {
this.partnerMerchant = new PartnerMerchant(wrapper_node.partnerMerchant);
}
if (wrapper_node.errors != null) {
this.errors = new ValidationErrorsCollection(wrapper_node.errors);
this.message = wrapper_node.message;
}
}
return WebhookNotification;
})(AttributeSetter);
exports.WebhookNotification = WebhookNotification;