BTPayPalLineItem.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #import <Foundation/Foundation.h>
  2. NS_ASSUME_NONNULL_BEGIN
  3. /**
  4. A PayPal line item to be displayed in the PayPal checkout flow.
  5. */
  6. @interface BTPayPalLineItem : NSObject
  7. /**
  8. Use this option to specify whether a line item is a debit (sale) or credit (refund) to the customer.
  9. */
  10. typedef NS_ENUM(NSInteger, BTPayPalLineItemKind) {
  11. /// Debit
  12. BTPayPalLineItemKindDebit = 1,
  13. /// Credit
  14. BTPayPalLineItemKindCredit,
  15. };
  16. /**
  17. Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
  18. */
  19. @property (nonatomic, readonly, copy) NSString *quantity;
  20. /**
  21. Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
  22. */
  23. @property (nonatomic, readonly, copy) NSString *unitAmount;
  24. /**
  25. Item name. Maximum 127 characters.
  26. */
  27. @property (nonatomic, readonly, copy) NSString *name;
  28. /**
  29. Indicates whether the line item is a debit (sale) or credit (refund) to the customer.
  30. */
  31. @property (nonatomic, readonly, assign) BTPayPalLineItemKind kind;
  32. /**
  33. Optional: Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
  34. */
  35. @property (nonatomic, nullable, copy) NSString *unitTaxAmount;
  36. /**
  37. Optional: Item description. Maximum 127 characters.
  38. */
  39. @property (nonatomic, nullable, copy) NSString *itemDescription;
  40. /**
  41. Optional: Product or UPC code for the item. Maximum 127 characters.
  42. */
  43. @property (nonatomic, nullable, copy) NSString *productCode;
  44. /**
  45. Optional: The URL to product information.
  46. */
  47. @property (nonatomic, nullable, strong) NSURL *url;
  48. /**
  49. Initialize a PayPayLineItem
  50. @param quantity Number of units of the item purchased. Can include up to 4 decimal places. This value can't be negative or zero.
  51. @param unitAmount Per-unit price of the item. Can include up to 4 decimal places. This value can't be negative or zero.
  52. @param name Item name. Maximum 127 characters.
  53. @param kind Indicates whether the line item is a debit (sale) or credit (refund) to the customer.
  54. @return A PayPalLineItem.
  55. */
  56. - (instancetype)initWithQuantity:(NSString *)quantity
  57. unitAmount:(NSString *)unitAmount
  58. name:(NSString *)name
  59. kind:(BTPayPalLineItemKind)kind;
  60. /**
  61. Base initializer - do not use.
  62. */
  63. - (instancetype)init __attribute__((unavailable("Please use initWithQuantity:unitAmount:name:kind:")));
  64. /**
  65. Returns the line item in a dictionary.
  66. @return A dictionary with the line item information formatted for a request.
  67. */
  68. - (NSDictionary *)requestParameters;
  69. @end
  70. NS_ASSUME_NONNULL_END