Exemplo n.º 1
0
        public static Payment CreateSingle(Organization organization, DateTime dateTime, Currency currency, Int64 amountCents, OutboundInvoice invoice, Person createdByPerson)
        {
            // TODO: Verify that invoice is not already closed; if so, issue refund

            // TODO: Verify correct amount

            invoice.SetPaid();

            PaymentGroup group      = PaymentGroup.Create(organization, dateTime, currency, createdByPerson);
            Payment      newPayment = FromIdentity(SwarmDb.GetDatabaseForWriting().CreatePayment(group.Identity, amountCents, string.Empty, string.Empty, string.Empty, false,
                                                                                                 invoice.Identity));

            group.AmountCents = amountCents;

            return(newPayment);
        }
Exemplo n.º 2
0
        public static Payment Create (PaymentGroup group, double amount, string reference, string fromAccount, string key, bool hasImage)
        {
            // Match against outbound invoice, too

            OutboundInvoice invoice = OutboundInvoice.FromReference(reference);

            // TODO: Verify that invoice is not already closed; if so, issue refund

            // TODO: Verify correct amount

            invoice.Open = false;

            PWEvents.CreateEvent(EventSource.PirateWeb, EventType.OutboundInvoicePaid, 0, group.Organization.Identity,
                                 Geography.RootIdentity, 0, invoice.Identity, string.Empty);

            return FromIdentity (SwarmDb.GetDatabaseForWriting().CreatePayment(group.Identity, amount, reference, fromAccount, key, hasImage,
                                                 invoice.Identity));
        }
Exemplo n.º 3
0
        public static Payment Create(PaymentGroup group, double amount, string reference, string fromAccount, string key, bool hasImage)
        {
            // Match against outbound invoice, too

            OutboundInvoice invoice = OutboundInvoice.FromReference(reference);

            // TODO: Verify that invoice is not already closed; if so, issue refund

            // TODO: Verify correct amount

            invoice.Open = false;

            PWEvents.CreateEvent(EventSource.PirateWeb, EventType.OutboundInvoicePaid, 0, group.Organization.Identity,
                                 Geography.RootIdentity, 0, invoice.Identity, string.Empty);

            return(FromIdentity(SwarmDb.GetDatabaseForWriting().CreatePayment(group.Identity, amount, reference, fromAccount, key, hasImage,
                                                                              invoice.Identity)));
        }
Exemplo n.º 4
0
 public static Payments ForPaymentGroup(PaymentGroup group)
 {
     return(FromArray(SwarmDb.GetDatabaseForReading().GetPayments(group)));
 }