File size: 1,289 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {
	PURCHASE_CANCELLATION_OFFER_REQUEST,
	PURCHASE_CANCELLATION_OFFER_RECEIVE,
	PURCHASE_CANCELLATION_OFFER_REQUEST_FAILURE,
	PURCHASE_CANCELLATION_OFFER_APPLY,
	PURCHASE_CANCELLATION_OFFER_APPLY_SUCCESS,
	PURCHASE_CANCELLATION_OFFER_APPLY_FAILURE,
} from 'calypso/state/action-types';

import 'calypso/state/data-layer/wpcom/cancellation-offers/index';
import 'calypso/state/cancellation-offers/init';

export const fetchCancellationOffers = ( siteId, purchaseId ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_REQUEST,
	siteId,
	purchaseId,
} );

export const receiveCancellationOffers = ( purchaseId, offers ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_RECEIVE,
	purchaseId,
	offers,
} );

export const receiveCancellationOffersError = ( purchaseId, error ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_REQUEST_FAILURE,
	purchaseId,
	error,
} );

export const applyCancellationOffer = ( siteId, purchaseId ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_APPLY,
	siteId,
	purchaseId,
} );

export const applyCancellationOfferSuccess = ( purchaseId, success ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_APPLY_SUCCESS,
	purchaseId,
	success,
} );

export const applyCancellationOfferError = ( purchaseId, error ) => ( {
	type: PURCHASE_CANCELLATION_OFFER_APPLY_FAILURE,
	purchaseId,
	error,
} );