예제 #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);
        }
예제 #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));
        }
예제 #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)));
        }
예제 #4
0
 public static Payments ForPaymentGroup(PaymentGroup group)
 {
     return(FromArray(SwarmDb.GetDatabaseForReading().GetPayments(group)));
 }