public interface PaymentAdminSession extends OsidSession
This session creates, updates, and deletes Payments.
The
data for create and update is provided by the consumer via the form
object. OsidForms
are requested for each create or update
and may not be reused.
Create and update operations differ in their usage. To create a
Payment,
a PaymentForm
is requested using
getPaymentFormForCreate()
specifying the desired payer, customer,
and record Types
or none if no record Types
are needed. The returned PaymentForm
will indicate that it
is to be used with a create operation and can be used to examine metdata
or validate data prior to creation. Once the PaymentForm
is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
PaymentForm
corresponds to an attempted transaction.
For updates, PaymentForms
are requested to the
Payment
Id
that is to be updated using
getPaymentFormForUpdate().
Similarly, the PaymentForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The PaymentForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Payments.
To unmap a
Payment
from the current Business,
the
PaymentBusinessAssignmentSession
should be used. These
delete operations attempt to remove the Payment
itself thus
removing it from all known Business
catalogs.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasPayment(Id paymentId,
Id aliasId)
Adds an
Id to a Payment for the purpose
of creating compatibility. |
boolean |
canCreatePayments()
Tests if this user can create
Payments. |
boolean |
canCreatePaymentWithRecordTypes(Type[] paymentRecordTypes)
Tests if this user can create a single
Payment using
the desired record types. |
boolean |
canDeletePayments()
Tests if this user can delete
Payments. |
boolean |
canManagePaymentAliases()
Tests if this user can manage
Id aliases for
Payments. |
boolean |
canUpdatePayments()
Tests if this user can update
Payments. |
Payment |
createPayment(PaymentForm paymentForm)
Creates a new
Payment. |
void |
deletePayment(Id paymentId)
Deletes a
Payment. |
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
PaymentForm |
getPaymentFormForCreate(Id payerId,
Id customerId,
Type[] paymentRecordTypes)
Gets the payer form for creating new payments.
|
PaymentForm |
getPaymentFormForUpdate(Id paymentId)
Gets the payment form for updating an existing payment.
|
void |
updatePayment(PaymentForm paymentForm)
Updates an existing payment.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBusinessId()
Business
Id
associated with
this session. Business Id
associated with this sessionmandatory
- This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreatePayments()
Payments.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Payment
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Payment
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreatePaymentWithRecordTypes(Type[] paymentRecordTypes)
Payment
using
the desired record types. While
BillingPaymentManager.getPaymentRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Payment.
Providing
an empty array tests if a Payment
can be created with
no records.paymentRecordTypes
- array of payment record types true
if Payment
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- paymentRecordTypes
is null
mandatory
- This method must be implemented. PaymentForm getPaymentFormForCreate(Id payerId, Id customerId, Type[] paymentRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
payerId
- the Id of the associated Payer
customerId
- the Id of the associated Customer
paymentRecordTypes
- array of payment record typesNotFoundException
- payerId
or
customerId
not foundNullArgumentException
- payerId, customerId,
or paymentRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Payment createPayment(PaymentForm paymentForm) throws OperationFailedException, PermissionDeniedException
Payment.
paymentForm
- the form for this Payment
Payment
IllegalStateException
- paymentForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- paymentForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- entryForm did not
originate from getPaymentFormForCreate()
mandatory
- This method must be implemented. boolean canUpdatePayments()
Payments.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Payment
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if Payment
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. PaymentForm getPaymentFormForUpdate(Id paymentId) throws NotFoundException, OperationFailedException, PermissionDeniedException
paymentId
- the Id
of the Payment
NotFoundException
- paymentId
is not
foundNullArgumentException
- paymentId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updatePayment(PaymentForm paymentForm) throws OperationFailedException, PermissionDeniedException
paymentForm
- the form containing the elements to be updatedIllegalStateException
- paymentForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- paymentForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- entryForm did not
originate from getPaymentFormForUpdate()
mandatory
- This method must be implemented. boolean canDeletePayments()
Payments.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Payment
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Payment
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deletePayment(Id paymentId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Payment.
paymentId
- the Id
of the Payment
to removeNotFoundException
- paymentId
not foundNullArgumentException
- paymentId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManagePaymentAliases()
Id
aliases for
Payments.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Payment
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasPayment(Id paymentId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Payment
for the purpose
of creating compatibility. The primary Id
of the
Payer
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another payment, it is reassigned to the given payment
Id.
paymentId
- the Id
of a Payment
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- paymentId
not foundNullArgumentException
- paymentId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.